Skip to content
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

Can't find Threads if compiled with Clang #22

Closed
AngryPenguinPL opened this issue Nov 12, 2021 · 3 comments · Fixed by #38
Closed

Can't find Threads if compiled with Clang #22

AngryPenguinPL opened this issue Nov 12, 2021 · 3 comments · Fixed by #38
Labels
bug Something isn't working

Comments

@AngryPenguinPL
Copy link

When compile qcoro 0.3.0 with LLVM/Clang 13.0.0 I see this configuration error:

DEBUG util.py:623:  -- Looking for C++ include pthread.h
DEBUG util.py:623:  -- Looking for C++ include pthread.h - not found
DEBUG util.py:621:  CMake Error at /usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
DEBUG util.py:621:    Could NOT find Threads (missing: Threads_FOUND)
DEBUG util.py:621:  Call Stack (most recent call first):
DEBUG util.py:621:    /usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:594 (_FPHSA_FAILURE_MESSAGE)
DEBUG util.py:621:    /usr/share/cmake/Modules/FindThreads.cmake:238 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
DEBUG util.py:621:    CMakeLists.txt:61 (find_package)
DEBUG util.py:623:  -- Configuring incomplete, errors occurred!

Full build log: https://file-store.openmandriva.org/api/v1/file_stores/432e3f9a77df2b7bc68ea7c1edbb36ce6018db68.log?show=true

Details:
OS: OpenMandriva Cooker
Compiler: LLVM/Clang 13.0.0
LTO: Enabled

I tried linking -pthread but was same.

Only compilation with GCC fixed the problem.

The problem is that in Mandriva we try to make sure that every (if possible) package is built with Clang.
So it would be great if a Clang compilation would be possible.

@danvratil
Copy link
Owner

Do you have a link to an SRPM or a spec file? I'm on Fedora, so I can use mock to reproduce & investigate the problem against OM's buildroot, but my spec-writing skills are very rusty :-)

@danvratil danvratil added the bug Something isn't working label Nov 12, 2021
@AngryPenguinPL
Copy link
Author

@danvratil
Copy link
Owner

Sorry for the delay, I finally managed to get around to test it now.

I was able to reproduce the failure. From cmake logs it appears that the problem is not really that CMake would not find pthread.h (the header is there) but rather with linking the the final test program due to missing libc++. I installed lib64c++-devel and now the build passes.

This is a undocumented requirement, I suppose, because qcoro requires using libc++ when building with clang (it's forced in QCoroMacros.cmake). The reason is that in clang coroutines are still considered experimental, and so it expects all the related standard-library code to be in std::experimental namespace and fails to compile against libstdc++, where coroutine are not in experimental.

To fix the packaging, installing libc++-devel should be enough. I am aware of problems when mixing libstdc++ and libc++ and I know that it should be possible to make QCoro work with libstdc++ even when built with clang. I'll work on that...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants