-
Notifications
You must be signed in to change notification settings - Fork 279
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cmake: usrsctplib: link against threads library #644
Conversation
@weinrank : What do you think? |
The change successfully adds the "-pthread" flag as a compiler option, I'm fine with it. Do we also need this flag for Apple? General question, since I've not clue about the pthread flag itself: why do we need it? Best |
The usrsctp library uses threads, but building it with cmake does not link against the system's thread library. Use cmake's "Threads" package as usual to deal with all supported platforms. (autoconf's configure.ac correctly adds `-pthread` to CFLAGS.) This is needed because programs which do not use threads themselves but link against usrsctplib will otherwise fail to link since `pthread_*` symbols used in libusrsctp.so are not resolved. programs/CMakeFiles.txt avoids this problem by unconditionally using the "Threads" package for every program including those that do not use threads themselves.
cff98f6
to
75b2ff7
Compare
I don't know, but my udpated diff lets cmake's "Threads" package handle all platform specific bits, so that is no longer our problem.
The new commit message hopefully explains it better.
or it'll fail to run eventually:
|
-pthread
on Linux and BSD
OK, so the point is that you want to deal with Is that is correct? |
Follow 40e35a7 "cmake: usrsctplib: link against threads library (sctplab#644)"; this is not in "Libs:" since programs do not need to link against pthreads themselves. See https://people.freedesktop.org/~dbn/pkg-config-guide.html
Follow 40e35a7 "cmake: usrsctplib: link against threads library (#644)"; this is not in "Libs:" since programs do not need to link against pthreads themselves. See https://people.freedesktop.org/~dbn/pkg-config-guide.html
The usrsctp library uses threads, but building it with cmake does not
link against the system's thread library.
Use cmake's "Threads" package as usual to deal with all supported
platforms.
(autoconf's configure.ac correctly adds
-pthread
to CFLAGS.)This is needed because programs which do not use threads themselves but
link against usrsctplib will otherwise fail to link since
pthread_*
symbols used in libusrsctp.so are not resolved.
programs/CMakeFiles.txt avoids this problem by unconditionally using the
"Threads" package for every program including those that do not use
threads themselves.