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

Linking error with clang #11

Open
stwunsch opened this issue Feb 18, 2020 · 5 comments
Open

Linking error with clang #11

stwunsch opened this issue Feb 18, 2020 · 5 comments

Comments

@stwunsch
Copy link

Hi!

I get undefined references if i build with the following cmake command:

cmake /path/to/vdt -DDIAG=ON -DDEBUG=ON -DCMAKE_CXX_COMPILER="clang++" -DCMAKE_C_COMPILER="clang

The error:

/usr/bin/ld: CMakeFiles/test_randomPool.dir/test_randomPool.cpp.o: in function `refMath::exp(double)':
/home/stefan/workspace/vdt/include/diagnostic/vdtdiag_helper.h:54: undefined reference to `__exp_finite'
/usr/bin/ld: CMakeFiles/test_randomPool.dir/test_randomPool.cpp.o: in function `refMath::expf(float)':
/home/stefan/workspace/vdt/include/diagnostic/vdtdiag_helper.h:55: undefined reference to `__expf_finite'
/usr/bin/ld: CMakeFiles/test_randomPool.dir/test_randomPool.cpp.o: in function `refMath::log(double)':
/home/stefan/workspace/vdt/include/diagnostic/vdtdiag_helper.h:56: undefined reference to `__log_finite'
/usr/bin/ld: CMakeFiles/test_randomPool.dir/test_randomPool.cpp.o: in function `refMath::logf(float)':
/home/stefan/workspace/vdt/include/diagnostic/vdtdiag_helper.h:57: undefined reference to `__logf_finite'
/usr/bin/ld: CMakeFiles/test_randomPool.dir/test_randomPool.cpp.o: in function `std::log(long double)':
/usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/9.2.1/../../../../include/c++/9.2.1/cmath:343: undefined reference to `__logl_finite'
/usr/bin/ld: /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/9.2.1/../../../../include/c++/9.2.1/cmath:343: undefined reference to `__logl_finite'
clang-9: error: linker command failed with exit code 1 (use -v to see invocation)

My setup:

clang 9.0.1
cmake 3.16.4

Best
Stefan

@stwunsch
Copy link
Author

It fails only if we use -Ofast. Everything is fine with -O3.

@stwunsch
Copy link
Author

This seems very much related: cms-sw/cmssw#24935

@stwunsch
Copy link
Author

stwunsch commented Feb 18, 2020

These are the symbols, which are undefined:

nm lib/libvdt.so | c++filt | grep finit
                 U __expf_finite
                 U __exp_finite
                 U __logf_finite
                 U __log_finite

Strangely they don't show up if I build with gcc, only with clang (and -Ofast).

@XapaJIaMnu
Copy link

@stwunsch
Copy link
Author

Thanks for the ping!

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

No branches or pull requests

2 participants