# catkin_make build error on melodic-ros

After a catkin_make, I am having the following error I can not figure out the problem, please any help?

$catkin_make Base path: /home/obara/catkin_ws Source space: /home/obara/catkin_ws/src Build space: /home/obara/catkin_ws/build Devel space: /home/obara/catkin_ws/devel Install space: /home/obara/catkin_ws/install Creating symlink "/home/obara/catkin_ws/src/CMakeLists.txt" pointing to "/opt/ros/melodic/share/catkin/cmake/toplevel.cmake" #### #### Running command: "cmake /home/obara/catkin_ws/src -DCATKIN_DEVEL_PREFIX=/home/obara/catkin_ws/devel -DCMAKE_INSTALL_PREFIX=/home/obara/catkin_ws/install -G Unix Makefiles" in "/home/obara/catkin_ws/build" #### CMake Warning (dev) in CMakeLists.txt: No project() command is present. The top-level CMakeLists.txt file must contain a literal, direct call to the project() command. Add a line of code such as project(ProjectName) near the top of the file, but after cmake_minimum_required(). CMake is pretending there is a "project(Project)" command on the first line. This warning is for project developers. Use -Wno-dev to suppress it. -- The C compiler identification is GNU 7.5.0 -- The CXX compiler identification is GNU 7.5.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 -- Using CATKIN_DEVEL_PREFIX: /home/obara/catkin_ws/devel -- Using CMAKE_PREFIX_PATH: /opt/ros/melodic -- This workspace overlays: /opt/ros/melodic -- Found PythonInterp: /usr/bin/python2 (found suitable version "2.7.17", minimum required is "2") -- Using PYTHON_EXECUTABLE: /usr/bin/python2 -- Using Debian Python package layout -- Using empy: /usr/bin/empy -- Using CATKIN_ENABLE_TESTING: ON -- Call enable_testing() -- Using CATKIN_TEST_RESULTS_DIR: /home/obara/catkin_ws/build/test_results -- Found gtest sources under '/usr/src/googletest': gtests will be built -- Found gmock sources under '/usr/src/googletest': gmock will be built -- Found PythonInterp: /usr/bin/python2 (found version "2.7.17") -- Looking for pthread.h -- Looking for pthread.h - found -- Performing Test CMAKE_HAVE_LIBC_PTHREAD -- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed -- Looking for pthread_create in pthreads -- Looking for pthread_create in pthreads - not found -- Looking for pthread_create in pthread -- Looking for pthread_create in pthread - found -- Found Threads: TRUE -- Using Python nosetests: /usr/bin/nosetests-2.7 -- catkin 0.7.26 -- BUILD_SHARED_LIBS is on /home/obara/catkin_ws/devel/env.sh: 31: /tmp/setup.sh.xW2NBTgTbE: Syntax error: Unterminated quoted string Traceback (most recent call last): File "/home/obara/catkin_ws/build/catkin_generated/generate_cached_setup.py", line 22, in <module> code = generate_environment_script('/home/obara/catkin_ws/devel/env.sh') File "/opt/ros/melodic/lib/python2.7/dist-packages/catkin/environment_cache.py", line 62, in generate_environment_script output = subprocess.check_output([env_script, sys.executable, '-c', python_code]) File "/usr/lib/python2.7/subprocess.py", line 223, in check_output raise CalledProcessError(retcode, cmd, output=output) subprocess.CalledProcessError: Command '['/home/obara/catkin_ws/devel/env.sh', '/usr/bin/python2', '-c', 'import os; print(dict(os.environ))']' returned non-zero exit status 2 CMake Error at /opt/ros/melodic/share/catkin/cmake/safe_execute_process.cmake:11 ... edit retag close merge delete ## Comments Can you try to do a clean catkin_make? (i use to remove build and devel folders inside the workspace, i dudnno if there is better way) Can you show us your CMakelists.txt? ( 2020-07-28 05:30:03 -0600 )edit Thanks for your reply. Doing a " catkin_make clean " generates exactly the same error. I will attach the CMakelists.txt in my next reply ( 2020-07-28 05:45:51 -0600 )edit ## 1 Answer Sort by » oldest newest most voted # toplevel CMakeLists.txt for a catkin workspace # catkin/cmake/toplevel.cmake cmake_minimum_required(VERSION 3.0.2) set(CATKIN_TOPLEVEL TRUE) # search for catkin within the workspace set(_cmd "catkin_find_pkg" "catkin" "${CMAKE_SOURCE_DIR}")
execute_process(COMMAND ${_cmd} RESULT_VARIABLE _res OUTPUT_VARIABLE _out ERROR_VARIABLE _err OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_STRIP_TRAILING_WHITESPACE ) if(NOT _res EQUAL 0 AND NOT _res EQUAL 2) # searching fot catkin resulted in an error string(REPLACE ";" " " _cmd_str "${_cmd}")
message(FATAL_ERROR "Search for 'catkin' in workspace failed (${_cmd_str}):${_err}")
endif()

# include catkin from workspace or via find_package()
if(_res EQUAL 0)
set(catkin_EXTRAS_DIR "${CMAKE_SOURCE_DIR}/${_out}/cmake")
# include all.cmake without add_subdirectory to let it operate in same scope
include(${catkin_EXTRAS_DIR}/all.cmake NO_POLICY_SCOPE) add_subdirectory("${_out}")

else()
# use either CMAKE_PREFIX_PATH explicitly passed to CMake as a command line argument
# or CMAKE_PREFIX_PATH from the environment
if(NOT DEFINED CMAKE_PREFIX_PATH)
if(NOT "$ENV{CMAKE_PREFIX_PATH}" STREQUAL "") if(NOT WIN32) string(REPLACE ":" ";" CMAKE_PREFIX_PATH$ENV{CMAKE_PREFIX_PATH})
else()
set(CMAKE_PREFIX_PATH $ENV{CMAKE_PREFIX_PATH}) endif() endif() endif() # list of catkin workspaces set(catkin_search_path "") foreach(path${CMAKE_PREFIX_PATH})
if(EXISTS "${path}/.catkin") list(FIND catkin_search_path${path} _index)
if(_index EQUAL -1)
list(APPEND catkin_search_path ${path}) endif() endif() endforeach() # search for catkin in all workspaces set(CATKIN_TOPLEVEL_FIND_PACKAGE TRUE) find_package(catkin QUIET NO_POLICY_SCOPE PATHS${catkin_search_path}
NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
unset(CATKIN_TOPLEVEL_FIND_PACKAGE)

if(NOT catkin_FOUND)
message(FATAL_ERROR "find_package(catkin) failed. catkin was neither found in the workspace nor in the CMAKE_PREFIX_PATH. One reason may be that no ROS setup.sh was sourced before.")
endif()
endif()

catkin_workspace()

more

Good morning sir!

First of all, i think it should be better to add this as an edit in your answer, more than converting it as a reply.

Second. Sorry for not be specific, but i wanted to see the Cmakelists.txt from the project instead of the workspace.

So,

/home/obara/catkin_ws/src/CMakeLists.txt


I want:

/home/obara/catkin_ws/src/your_project_name/CMakeLists.txt


maybe you have to search in a subproject:

/home/obara/catkin_ws/src/your_project_name/your_subproject_name/CMakeLists.txt

( 2020-07-29 00:43:03 -0600 )edit

I actually have not added any project. I think catkin_make should work initially based on what I have read, even without adding any project,

( 2020-07-29 02:43:04 -0600 )edit