-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[Flang] explicitly link the pthread library when building shared flang-rt. #129956
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
Conversation
| endif () | ||
| if (build_shared) | ||
| add_library("${name_shared}" SHARED ${extra_args} ${ARG_ADDITIONAL_HEADERS} ${ARG_UNPARSED_ARGUMENTS}) | ||
| find_package(Threads REQUIRED) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you move find_package(Threads REQUIRED) to flang-rt/CMakeLists.txt? That's where all the requirements are being collected.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure. Will do.
Meinersbur
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks
flang-rt/CMakeLists.txt
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be great to comment about why pthread is needed/what for, instead of what it is doing.
https://www.jackfranklin.co.uk/blog/code-comments-why-not-how/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure. I will update the comments.
Thanks for the pointer to the blog!
Meinersbur
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM (for new comment)
|
@Meinersbur |
8b8df2e to
707a4cf
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I expected it to be trivially present on Windows, as part of the Win32 CRT (there is a CMAKE_USE_WIN32_THREADS_INIT results variable).
Aynway, LGTM
This patch is to explicitly link the pthread library when building shared flang-rt.
On AIX, for example, it needs to link in
libpthread.aexplicitly in order to resolve the references to thosepthread_*functions ininclude/flang-rt/runtime/lock.h