secure-software-engineering / phasar

A LLVM-based static analysis framework.
Other
933 stars 140 forks source link

Ubuntu22 installation error: /usr/bin/ld: cannot find -lstdc++: No such file or directory #639

Closed AnonymousAuthor000 closed 1 year ago

AnonymousAuthor000 commented 1 year ago

Bug description

Describe here the issue that you are experiencing.

Steps to reproduce

Actual result: Describe here what happens after you run the steps above (i.e. the buggy behaviour)

Expected result: Describe here what should happen after you run the steps above (i.e. what would be the correct behaviour)

Context (Environment)

Operating System:

Here is the error:

with unit tests. CMake Warning: Ignoring empty string ("") provided on the command line.

-- The CXX compiler identification is Clang 14.0.0 -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - failed -- Check for working CXX compiler: /usr/local/llvm-14/bin/clang++ -- Check for working CXX compiler: /usr/local/llvm-14/bin/clang++ - broken CMake Error at /home/mingyi/anaconda3/envs/libopt/lib/python3.9/site-packages/cmake/data/share/cmake-3.26/Modules/CMakeTestCXXCompiler.cmake:60 (message): The C++ compiler

"/usr/local/llvm-14/bin/clang++"

is not able to compile a simple test program.

It fails with the following output:

Change Dir: /data/sda/mingyi/DL2C/phasar/build/CMakeFiles/CMakeScratch/TryCompile-zBFeDd

Run Build Command(s):/usr/bin/ninja -v cmTC_e9dcf && [1/2] /usr/local/llvm-14/bin/clang++    -MD -MT CMakeFiles/cmTC_e9dcf.dir/testCXXCompiler.cxx.o -MF CMakeFiles/cmTC_e9dcf.dir/testCXXCompiler.cxx.o.d -o CMakeFiles/cmTC_e9dcf.dir/testCXXCompiler.cxx.o -c /data/sda/mingyi/DL2C/phasar/build/CMakeFiles/CMakeScratch/TryCompile-zBFeDd/testCXXCompiler.cxx
[2/2] : && /usr/local/llvm-14/bin/clang++   CMakeFiles/cmTC_e9dcf.dir/testCXXCompiler.cxx.o -o cmTC_e9dcf   && :
FAILED: cmTC_e9dcf 
: && /usr/local/llvm-14/bin/clang++   CMakeFiles/cmTC_e9dcf.dir/testCXXCompiler.cxx.o -o cmTC_e9dcf   && :
/usr/bin/ld: cannot find -lstdc++: No such file or directory
clang-14: error: linker command failed with exit code 1 (use -v to see invocation)
ninja: build stopped: subcommand failed.

I am using gcc-11. I tried to reinstall the llvm, and it doesn't work.

fabianbs96 commented 1 year ago

Hi @AnonymousAuthor000, the error message indicates that clang cannot link against the C++ standard library. Have you checked whether you can compile a simple program using clang++ or g++? If that does not work I suggest you to try re-installing g++ as clang++ uses the standard libraray implementation from g++. If that does not work, you may want to try out using libc++ instead of libstdc++ which is an alterantive stanrdary library implementation provided by LLVM.

rezaarezvan commented 1 year ago

Hey @AnonymousAuthor000 I'm also on Ubuntu 22.04 LTS. This worked for me! (Solution 1, top comment)

fabianbs96 commented 1 year ago

@rezaarezvan, thank you for pointing that out! @AnonymousAuthor000 does that work for you?

AnonymousAuthor000 commented 1 year ago

I will try, thanks for your reply.

AnonymousAuthor000 commented 1 year ago

I installed the libstdc++-12-dev, the problem now is solved. Thanks for all your information.