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 error #1448

Open
Helena2007 opened this issue May 2, 2024 · 14 comments
Open

cmake error #1448

Helena2007 opened this issue May 2, 2024 · 14 comments
Labels
discussion General discussion about something

Comments

@Helena2007
Copy link

I have installed Adaptive Cpp. when trying to run the examples project, in the examples/build folder got the following error, when running the cmake command,

cmake .. -DAdaptiveCpp_DIR=/...../AdaptiveCpp/build -DACPP_TARGETS= 'cuda:sm_86'
CMake Warning:
Ignoring extra path from command line:

"cuda:sm_86"

CMake Error at /......../AdaptiveCpp/build/adaptivecpp-config.cmake:33 (include):
include could not find requested file:

adaptivecpp-targets

Call Stack (most recent call first):
CMakeLists.txt:11 (find_package)

CMake Error: File /...../lib/cmake/AdaptiveCpp/syclcc-launch.rule.in does not exist.
CMake Error at /......../AdaptiveCpp/build/adaptivecpp-config.cmake:114 (configure_file):
configure_file Problem configuring file
Call Stack (most recent call first):
CMakeLists.txt:11 (find_package)

-- Configuring incomplete, errors occurred!

I have noticed that in usr/local/lib/cmake folder named AdaptiveCpp has not been generated. However there were no errors when building and installing AdaptiveCpp.

@Helena2007 Helena2007 added the discussion General discussion about something label May 2, 2024
@normallytangent
Copy link
Collaborator

Could you share a reproducer for your installation of AdaptiveCpp?

@illuhad
Copy link
Collaborator

illuhad commented May 2, 2024

Have you actually run make install ? Just running make is insufficient.

The AdaptiveCpp_DIR variable must point to INSTALL_ROOT/lib/cmake/AdaptiveCpp (Replace INSTALL_ROOT with your CMAKE_INSTALL_PREFIX).

@nilsfriess
Copy link
Collaborator

Ignoring extra path from command line:

"cuda:sm_86"

Regarding this: This is probably due to the space after -DACPP_TARGETS=

@Helena2007
Copy link
Author

Helena2007 commented May 4, 2024

Thank you, @illuhad @nilsfriess following your suggestions I was able to successfully run the cmake command without any errors.
But got error when running make install
[ 50%] Building CXX object bruteforce_nbody/CMakeFiles/bruteforce_nbody.dir/bruteforce_nbody.cpp.o
[100%] Linking CXX executable bruteforce_nbody
/usr/bin/ld: /....../lib/libacpp-rt.so: undefined reference to `std::condition_variable::wait(std::unique_lockstd::mutex&)@GLIBCXX_3.4.30'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [bruteforce_nbody/CMakeFiles/bruteforce_nbody.dir/build.make:100: bruteforce_nbody/bruteforce_nbody] Error 1
make[1]: *** [CMakeFiles/Makefile2:98: bruteforce_nbody/CMakeFiles/bruteforce_nbody.dir/all] Error 2
make: *** [Makefile:136: all] Error 2
I am using c compiler version 12.3.0 and GCC version 12.3.0

@nilsfriess
Copy link
Collaborator

Can you make sure that the libstdc++ version that you use to build AdaptiveCpp itself and the example match as suggested here:
#1428 (comment) ?

@Helena2007
Copy link
Author

when run the command,
ldd AdaptiveCpp/build/src/runtime/libacpp-rt.so | grep libstdc++
libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007edcf2800000)

AdaptiveCpp uses libstdc++.so.6

@nilsfriess
Copy link
Collaborator

Now we have to find out if that's the same as clang is trying to use when you compile your example. Not sure how to best do this, maybe just compile a simple Hello World program using the clang that acpp is using (you can get that from cat /your/AdaptiveCpp/install/directory/etc/AdaptiveCpp/acpp-core.json | grep \"default-clang\") and then again do ldd helloword | grep libstdc++

@Helena2007
Copy link
Author

when run cat /.../AdaptiveCpp/etc/AdaptiveCpp/acpp-core.json | grep "default-clang" got the output
"default-clang" : "/usr/lib/llvm-14/bin/clang++",

when run the command ldd helloworld | grep libstdc++
libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007383f3000000)

@nilsfriess
Copy link
Collaborator

Not sure what the problem is then.

Have you tried just manually compiling the example using acpp? Maybe something is going wrong with the CMake config for the example. So in the examples/bruteforce_nbody folder run something like

ACPP_INSTALL_DIR/bin/acpp -o bruteforce_nbody bruteforce_nbody.cpp -v

and post the output here.

@Helena2007
Copy link
Author

When run the command /....../AdaptiveCpp/bin/acpp -o bruteforce_nbody bruteforce_nbody.cpp -v got the output:

acpp warning: No optimization flag was given, optimizations are disabled by default. Performance may be degraded. Compile with e.g. -O2/-O3 to enable optimizations.
Ubuntu clang version 14.0.0-1ubuntu1.1
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/lib/llvm-14/bin
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/11
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/12
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/12
Candidate multilib: .;@m64
Selected multilib: .;@m64
Found CUDA installation: /usr/local/cuda-11.5, version 11.5
"/usr/lib/llvm-14/bin/clang" -cc1 -triple x86_64-pc-linux-gnu -emit-obj -mrelax-all --mrelax-relocations -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name bruteforce_nbody.cpp -mrelocation-model pic -pic-level 2 -pic-is-pie -mframe-pointer=all -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -mllvm -treat-scalable-fixed-error-as-warning -debugger-tuning=gdb -v -fcoverage-compilation-dir=/....../AdaptiveCpp/examples/bruteforce_nbody -resource-dir /usr/lib/llvm-14/lib/clang/14.0.0 -isystem /....../AdaptiveCpp/bin/../include/AdaptiveCpp -D OPENSYCL -D HIPSYCL -D ADAPTIVECPP -D ACPP -D HIPSYCL_ENABLE_LLVM_SSCP_TARGET -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/x86_64-linux-gnu/c++/12 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/backward -internal-isystem /usr/lib/llvm-14/lib/clang/14.0.0/include -internal-isystem /usr/local/include -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/12/../../../../x86_64-linux-gnu/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -std=c++17 -fdeprecated-macro -fdebug-compilation-dir=/....../AdaptiveCpp/examples/bruteforce_nbody -ferror-limit 19 -fgnuc-version=4.2.1 -fcxx-exceptions -fexceptions -fcolor-diagnostics -load /....../AdaptiveCpp/bin/../lib/libacpp-clang.so -fpass-plugin=/....../AdaptiveCpp/bin/../lib/libacpp-clang.so -disable-O0-optnone -mllvm -hipsycl-sscp -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /tmp/bruteforce_nbody-e5789b.o -x c++ bruteforce_nbody.cpp
clang -cc1 version 14.0.0 based upon LLVM 14.0.0 default target x86_64-pc-linux-gnu
ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/12/../../../../x86_64-linux-gnu/include"
ignoring nonexistent directory "/include"
#include "..." search starts here:
#include <...> search starts here:
/..../AdaptiveCpp/bin/../include/AdaptiveCpp
/usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12
/usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/x86_64-linux-gnu/c++/12
/usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/backward
/usr/lib/llvm-14/lib/clang/14.0.0/include
/usr/local/include
/usr/include/x86_64-linux-gnu
/usr/include
End of search list.
"/usr/bin/ld" -pie -z relro --hash-style=gnu --build-id --eh-frame-hdr -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 -o bruteforce_nbody /lib/x86_64-linux-gnu/Scrt1.o /lib/x86_64-linux-gnu/crti.o /usr/lib/gcc/x86_64-linux-gnu/12/crtbeginS.o -L/..../AdaptiveCpp/bin/../lib/ -L/usr/lib/gcc/x86_64-linux-gnu/12 -L/usr/lib/gcc/x86_64-linux-gnu/12/../../../../lib64 -L/lib/x86_64-linux-gnu -L/lib/../lib64 -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib64 -L/usr/lib/llvm-14/bin/../lib -L/lib -L/usr/lib /tmp/bruteforce_nbody-e5789b.o -lacpp-rt -rpath=/..../AdaptiveCpp/bin/../lib/ -lstdc++ -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc /usr/lib/gcc/x86_64-linux-gnu/12/crtendS.o /lib/x86_64-linux-gnu/crtn.o

@nilsfriess
Copy link
Collaborator

And does the compilation succeed? Or is there still the same error as before?
If it succeeds this way, then there is probably something wrong with your installation or the way you configured the example/ the project itself. I‘d suggest you then just start over with a clean build directory and if the error persists, post the complete output here so that we can try to reproduce the problem.

@Helena2007
Copy link
Author

Helena2007 commented May 10, 2024

Upon compilation, there were no errors. After the compilation, an executable bruteforce_nbody was created. When this executable was run a txt file named output.txt was created. The txt file contains x, y, z coordinates and a scalar value.
Tried the entire steps with a clean build directory and still the error persists.
In AdaptiveCpp/examples/build folder run the following commands:
cmake .. -DAdaptiveCpp_DIR=/.../AdaptiveCpp/lib/cmake/AdaptiveCpp -DACPP_TARGETS='cuda:sm_86'
-- The C compiler identification is GNU 11.4.0
-- The CXX compiler identification is GNU 11.4.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done (0.3s)
-- Generating done (0.0s)
-- Build files have been written to: /.../AdaptiveCpp/examples/build
Then run the make install command, got the following output:
make install
[100%] Building CXX object bruteforce_nbody/CMakeFiles/bruteforce_nbody.dir/bruteforce_nbody.cpp.o
[100%] Linking CXX executable bruteforce_nbody
/usr/bin/ld: /.../AdaptiveCpp/lib/libacpp-rt.so: undefined reference to `std::condition_variable::wait(std::unique_lockstd::mutex&)@GLIBCXX_3.4.30'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [bruteforce_nbody/CMakeFiles/bruteforce_nbody.dir/build.make:100: bruteforce_nbody/bruteforce_nbody] Error 1
make[1]: *** [CMakeFiles/Makefile2:98: bruteforce_nbody/CMakeFiles/bruteforce_nbody.dir/all] Error 2
make: *** [Makefile:136: all] Error 2

@illuhad
Copy link
Collaborator

illuhad commented May 29, 2024

Upon compilation, there were no errors. After the compilation, an executable bruteforce_nbody was created. When this executable was run a txt file named output.txt was created. The txt file contains x, y, z coordinates and a scalar value.

Okay, this means that acpp compilation and linking works and the program runs correctly.

For building with cmake, can you please:

  • remove CMakeCache.txt in your build directory of the example code
  • rerun cmake as in the command you posted
  • compile with make VERBOSE=1 and post the output of that command.

@Helena2007
Copy link
Author

After running make VERBOSE=1, the output I have obtained is:
/usr/local/bin/cmake -S/.../AdaptiveCpp/examples -B/..../AdaptiveCpp/examples/build --check-build-system CMakeFiles/Makefile.cmake 0
/usr/local/bin/cmake -E cmake_progress_start /..../AdaptiveCpp/examples/build/CMakeFiles /..../AdaptiveCpp/examples/build//CMakeFiles/progress.marks
make -f CMakeFiles/Makefile2 all
make[1]: Entering directory '/.../AdaptiveCpp/examples/build'
make -f bruteforce_nbody/CMakeFiles/bruteforce_nbody.dir/build.make bruteforce_nbody/CMakeFiles/bruteforce_nbody.dir/depend
make[2]: Entering directory '/.../aiRender/AdaptiveCpp/examples/build'
cd /.../AdaptiveCpp/examples/build && /usr/local/bin/cmake -E cmake_depends "Unix Makefiles" /.../AdaptiveCpp/examples /..../AdaptiveCpp/examples/bruteforce_nbody /..../AdaptiveCpp/examples/build /..../AdaptiveCpp/examples/build/bruteforce_nbody /..../AdaptiveCpp/examples/build/bruteforce_nbody/CMakeFiles/bruteforce_nbody.dir/DependInfo.cmake "--color="
Dependencies file "bruteforce_nbody/CMakeFiles/bruteforce_nbody.dir/bruteforce_nbody.cpp.o.d" is newer than depends file "/....../AdaptiveCpp/examples/build/bruteforce_nbody/CMakeFiles/bruteforce_nbody.dir/compiler_depend.internal".
Consolidate compiler generated dependencies of target bruteforce_nbody
make[2]: Leaving directory '/..../AdaptiveCpp/examples/build'
make -f bruteforce_nbody/CMakeFiles/bruteforce_nbody.dir/build.make bruteforce_nbody/CMakeFiles/bruteforce_nbody.dir/build
make[2]: Entering directory '/..../AdaptiveCpp/examples/build'
[100%] Linking CXX executable bruteforce_nbody
cd /..../AdaptiveCpp/examples/build/bruteforce_nbody && /usr/local/bin/cmake -E cmake_link_script CMakeFiles/bruteforce_nbody.dir/link.txt --verbose=1
/...../AdaptiveCpp/lib/cmake/AdaptiveCpp/syclcc-launcher --launcher-cxx-compiler=/usr/bin/c++ --launcher-syclcc=/..../AdaptiveCpp/bin/acpp --acpp-targets="cuda:sm_86" /usr/bin/c++ -O3 -DNDEBUG CMakeFiles/bruteforce_nbody.dir/bruteforce_nbody.cpp.o -o bruteforce_nbody -Wl,-rpath,/..../AdaptiveCpp/lib: /...../AdaptiveCpp/lib/libacpp-rt.so -Wl,-rpath-link,/..../AdaptiveCpp/lib
/usr/bin/ld: /..../AdaptiveCpp/lib/libacpp-rt.so: undefined reference to `std::condition_variable::wait(std::unique_lockstd::mutex&)@GLIBCXX_3.4.30'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [bruteforce_nbody/CMakeFiles/bruteforce_nbody.dir/build.make:100: bruteforce_nbody/bruteforce_nbody] Error 1
make[2]: Leaving directory '/..../AdaptiveCpp/examples/build'
make[1]: *** [CMakeFiles/Makefile2:98: bruteforce_nbody/CMakeFiles/bruteforce_nbody.dir/all] Error 2
make[1]: Leaving directory '/.../AdaptiveCpp/examples/build'
make: *** [Makefile:136: all] Error 2

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

No branches or pull requests

4 participants