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

Installation instruction for Ubuntu 22 with Clang-12 #330

Closed
oscarkfpang opened this issue Jul 9, 2024 · 1 comment
Closed

Installation instruction for Ubuntu 22 with Clang-12 #330

oscarkfpang opened this issue Jul 9, 2024 · 1 comment

Comments

@oscarkfpang
Copy link

When I configure the build directory with

cmake .. -DCMAKE_BUILD_TYPE:STRING=Release -G Ninja -DCMAKE_C_COMPILER:STRING=clang-12 -DCMAKE_CXX_COMPILER:STRING=clang++-12 -DMJPC_BUILD_GRPC_SERVICE:BOOL=ON

under Ubuntu 22.04 with Clang-12 installed, I encountered the following error:

==============================================================================================
-- The C compiler identification is Clang 12.0.1
-- The CXX compiler identification is Clang 12.0.1
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/clang-12 - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - failed
-- Check for working CXX compiler: /usr/bin/clang++-12
-- Check for working CXX compiler: /usr/bin/clang++-12 - broken
CMake Error at /usr/share/cmake-3.22/Modules/CMakeTestCXXCompiler.cmake:62 (message):
The C++ compiler

"/usr/bin/clang++-12"

is not able to compile a simple test program.

It fails with the following output:

Change Dir: /home/oscar/mujoco_mpc/build/CMakeFiles/CMakeTmp

Run Build Command(s):/usr/bin/ninja cmTC_73a1c && [1/2] Building CXX object CMakeFiles/cmTC_73a1c.dir/testCXXCompiler.cxx.o
[2/2] Linking CXX executable cmTC_73a1c
FAILED: cmTC_73a1c 
: && /usr/bin/clang++-12   CMakeFiles/cmTC_73a1c.dir/testCXXCompiler.cxx.o -o cmTC_73a1c   && :
/usr/bin/ld: cannot find -lstdc++: No such file or directory
clang: error: linker command failed with exit code 1 (use -v to see invocation)
ninja: build stopped: subcommand failed.

CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:25 (project)

-- Configuring incomplete, errors occurred!

==============================================================================================

After googling the problem, I need to install this

sudo apt-get install libstdc++-12-dev

Then clean up the build directory and configure again with success. After that, continue the build process.

@thowell
Copy link
Collaborator

thowell commented Jul 9, 2024

Thanks for the fix! I opened a PR (#331) that adds this additional step to the README.

@thowell thowell closed this as completed Jul 9, 2024
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