Manoj
Manoj

Reputation: 314

Error setting up catkin workspace

I am following these tutorials:

In step catkin_make i'm getting error:

-- The C compiler identification is unknown
CMake Error at /usr/share/cmake-2.8/Modules/CMakeDetermineCCompiler.cmake:186 (configure_file):
configure_file Problem configuring file

-- The CXX compiler identification is unknown
CMake Error at /usr/share/cmake-2.8/Modules/CMakeDetermineCXXCompiler.cmake:185 (configure_file):
configure_file Problem configuring file

-- Check for working C compiler: /usr/bin/cc
CMake Error at /usr/share/cmake-2.8/Modules/CMakeTestCCompiler.cmake:47 (try_compile):
Unknown extension ".c" for file

/home/manoj/catkin_ws/build/CMakeFiles/CMakeTmp/testCCompiler.c

try_compile() works only for enabled languages.  Currently these are:

C CXX

See project() command to enable other languages.

-- Check for working C compiler: /usr/bin/cc -- broken
CMake Error at /usr/share/cmake-2.8/Modules/CMakeTestCCompiler.cmake:61 (message):
The C compiler "/usr/bin/cc" is not able to compile a simple test program.

It fails with the following output:

I tried setting environment variables CC and CXX to /usr/bin/gcc and /usr/bin/g++, but to no use.

Also tried a fresh install of cmake, still no use. I am using Ubuntu on Windows Subsystem for Linux.

Help! Thanks in Advance.

Upvotes: 3

Views: 1880

Answers (3)

Abdullah
Abdullah

Reputation: 1

Deleting CMakeCache.txt on build folder worked for me.

Edit: Before this i ran sudo apt-get install cmake and sudo apt install mingw-w64

Upvotes: 0

Manoj
Manoj

Reputation: 314

The error is with the cmake on WSL. Fix is inbound. Report, discussion & repro's over here: Bash on Windows: Bugs

Upvotes: 0

Vtik
Vtik

Reputation: 3130

try adding the following lines to your CMakeLists.txt before the catkin_package() :

set(CMAKE_C_COMPILER "/usr/bin/gcc")
set(CMAKE_CXX_COMPILER "/usr/bin/g++")

Sometimes, it's also better to clean up your build (usually by deleting the /devel and /build folders in your catkin_ws) and do a fresh catkin_make.

For the record, this approach is not recommended (see here, method 3), but it may help !

Upvotes: 1

Related Questions