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

CMake configures wrong for Clang #6128

Open
stevenrbrandt opened this issue Jan 9, 2023 · 3 comments
Open

CMake configures wrong for Clang #6128

stevenrbrandt opened this issue Jan 9, 2023 · 3 comments

Comments

@stevenrbrandt
Copy link
Member

stevenrbrandt commented Jan 9, 2023

Expected Behavior

on docker image stevenrbrandt/clangmi

git clone https://github.com/STEllAR-GROUP/parallelnumericalintegration.git
mkdir parallelnumericalintegration/build
cd parallelnumericalintegration/build
cmake -DCMAKE_CXX_COMPILER=$(which clang++) ..

fails with

[ 10%] Building CXX object src/CMakeFiles/taylor_par_hpx.dir/taylor_par_hpx.cpp.o
[ 20%] Linking CXX executable taylor_par_hpx
/usr/bin/ld: /usr/local/lib64/libhpx_wrap.a(hpx_wrap.cpp.o): undefined reference to symbol '_ZNKSt3__114error_category10equivalentEiRKNS_15error_conditionE'
/usr/bin/ld: /usr/lib64/libc++.so.1: error adding symbols: DSO missing from command line
clang-14: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [src/CMakeFiles/taylor_par_hpx.dir/build.make:103: src/taylor_par_hpx] Error 1
make[1]: *** [CMakeFiles/Makefile2:862: src/CMakeFiles/taylor_par_hpx.dir/all] Error 2
make: *** [Makefile:146: all] Error 2

You can fix the problem by configuring as follows:

cmake -DCMAKE_CXX_COMPILER=$(which clang++) -DCMAKE_CXX_FLAGS=-stdlib=libc++ ..

Specifications

... Please describe your environment
Docker image: stevenrbrandt/clangmi

  • HPX Version: 1.8.1
  • Platform (compiler, OS):
    $ uname -a
    Linux 49a6c2f51cac 5.10.102.1-microsoft-standard-WSL2 Full path specified in CTest #1 SMP Wed Mar 2 00:30:59 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
@stevenrbrandt
Copy link
Member Author

Here's how I configured HPX

cmake \
    -DHPX_WITH_EXAMPLES=OFF \
    -DHPX_WITH_MORE_THAN_64_THREADS=ON \
    -DCMAKE_CXX_COMPILER=clang++ \
    -DHPX_WITH_CXX_STANDARD=20 \
    -DCMAKE_CXX_FLAGS=-stdlib=libc++ \
    -DHPX_WITH_FETCH_ASIO=ON \
    ..

@hkaiser
Copy link
Member

hkaiser commented Jan 11, 2023

You used -DCMAKE_CXX_FLAGS=-stdlib=libc++ while configuring HPX, I'd expect you need to do the same for all depending projects.

@stevenrbrandt
Copy link
Member Author

So the question is, why doesn't cmake pass the flags along? The hpxcxx command does. Shouldn't they both do it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants