Skip to content
Snippets Groups Projects

meson: drop pthread-stubs on BSDs

Merged Jan Beich requested to merge (removed):pthread-stubs into main
2 unresolved threads

Drop pointless dependency poisoning build of every VAAPI and OpenCL driver. NetBSD already disables downstream by overriding PTHREADSTUBS_LIBS.

libdrm doesn't install static libraries since 56b07338, so this mainly affects subprojects. However, any project that bundles likely uses old version and has broken BSD support.

CC @nia, @manu

Merge request reports

Checking pipeline status.

Approved by

Merged by Emil VelikovEmil Velikov 2 years ago (Feb 21, 2023 3:15pm UTC)

Merge details

  • Changes merged into main with 332809f3.
  • Deleted the source branch.

Pipeline #813182 passed

Pipeline passed for 332809f3 on main

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • added meson non-linux labels

  • Reviewed-by: Emmanuel Vadot manu@FreeBSD.org

  • @jbeich I've read the MR & commit message and I'm not sure what it's trying it to say. Keep in mind that I'm the person who made pthread-stub 0.4 a no-op or -pthread wrapper :wink:

    In more detail: The pthread-stub is no-op on linux, yet this commit replaces it with -pthread for no obvious (documented) reason.

    Based off the NetBSD link pthread-stub it a no-op there, yet this adds -pthread across the board...

    - if ['freebsd', 'dragonfly', 'netbsd'].contains(host_machine.system())
    + if ['freebsd', 'dragonfly'].contains(host_machine.system())
        dep_pthread_stubs = dependency('pthread-stubs', version : '>= 0.4')

    Hence ^^ is what you want, yet this MR goes the opposite direction.

    Edited by Emil Velikov
    • No! Everyone wait! :) Here:

      • the whole point of pthread-stubs is that you always depend on it
        • and it depends on pthreads or doesn't depending on the platform
      • if you conditionally depend on pthread-stubs based on the platform you're doing it wrong
        • because you're literally just replicating pthread-stubs's knowledge in your build system
          • and that knowledge is the only thing in pthread-stubs 0.4
        • so you might as well directly depend on pthreads conditionally!

      (UPD also, in that case not having stubs should be considered the "norm", they are the optional thing — so the listed platforms should be the one with the stubs in libc)

      So it should either be something like

      if ['linux', 'gnu', 'netbsd', 'sunos', 'cygwin', 'gnu/kfreebsd'].contains(host_machine.system())
        dep_maybe_threads = []
      else
        dep_maybe_threads = dependency('threads')
      endif
      dep_threads = dependency('threads')

      Or dep_pthread_stubs = dependency('pthread-stubs', version : '>= 0.4') unconditionally.

      Based off the NetBSD link pthread-stub it a no-op there

      Yeah, actually that seems true: https://github.com/NetBSD/src/tree/trunk/lib/libc/thread-stub


      …anyway, does anyone actually benefit from this optimization? Are non-threaded high-performance graphical programs even a thing?

      Edited by Val Packett
    • If we look at the pthread-stubs README, there is no such strictness you always depend on it, plus it has a decent list where it's a no-op and where it falls back to -pthread

      Since it's a no-op in some cases, distributions (Linux or BSD) have chosen to patch it out, rather than provide a dummy package. As we want to work with distros, we removed where it made sense or we had feedback. So based on the NetBSD patch/feedback let's drop that.

      If we have a similar patch/feedback for other platforms (say FreeBSD) we can do the same.

      …anyway, does anyone actually benefit from this optimization? Are non-threaded high-performance graphical programs even a thing?

      This is a good question, yet orthogonal. Each distro has specific use-cases/programs of interest, and in some cases different linker. As such they can make the call for themselves and let us know.

      Edited by Emil Velikov
    • I mean, since it basically is a list of "where it's a no-op and where it falls back to -pthread" — that's all it is now — "removing it where makes sense" means you're creating another instance of such a list, in the build system. It's somewhat silly to have two levels of these lists.

    • Author Contributor

      where it falls back to -pthread

      FreeBSD deprecated -pthread in favor of -lpthread sometime in 2015.

      https://cgit.freebsd.org/ports/log/?qt=grep&q=remove+%24PTHREAD_LIBS
      https://cgit.freebsd.org/ports/commit/?id=c560a8562508

      Edited by Jan Beich
    • Please register or sign in to reply
  • Jan Beich added 82 commits

    added 82 commits

    Compare with previous version

  • Jan Beich added 1 commit

    added 1 commit

    • 690f7437 - meson: drop pthread-stubs dependency on BSDs

    Compare with previous version

  • Jan Beich added 84 commits

    added 84 commits

    Compare with previous version

  • Emil Velikov approved this merge request

    approved this merge request

  • merged

Please register or sign in to reply
Loading