Rosanswers logo

I'm getting this error while installing electric on Mac OSX 10.7 Lion. Any help would be appreciated. Thanks.

  mkdir -p bin
  cd build && cmake -Wdev -DCMAKE_TOOLCHAIN_FILE=`rospack find rosbuild`/rostoolchain.cmake  ..
  [rosbuild] Building package rosconsole
  [rosbuild] Including /Users/rosPudding/ros/ros_comm/clients/roslisp/cmake/roslisp.cmake
  [rosbuild] Including /Users/rosPudding/ros/ros_comm/clients/rospy/cmake/rospy.cmake
  [rosbuild] Including /Users/rosPudding/ros/ros_comm/clients/cpp/roscpp/cmake/roscpp.cmake
  -- Configuring done
  -- Generating done
  CMake Warning:
    Manually-specified variables were not used by the project:
  -- Build files have been written to: /Users/rosPudding/ros/ros_comm/tools/rosconsole/build
  cd build && make -l2
  [  0%] Built target rospack_genmsg_libexe
  [  0%] Built target rosbuild_precompile
  [ 50%] Building CXX object CMakeFiles/rosconsole.dir/src/rosconsole/rosconsole.o
  make[3]: /usr/bin/g++-4.2: No such file or directory
  make[3]: *** [CMakeFiles/rosconsole.dir/src/rosconsole/rosconsole.o] Error 1
  make[2]: *** [CMakeFiles/rosconsole.dir/all] Error 2
  make[1]: *** [all] Error 2
[ rosmake ] Output from build of package rosconsole written to:
[ rosmake ]    /Users/rosPudding/.ros/rosmake/rosmake_output-20111231-224403/rosconsole/build_output.log            
[rosmake-1] Finished <<< rosconsole [FAIL] [ 3.06 seconds ]
[ rosmake ] Halting due to failure in package rosconsole. 
[ rosmake ] Waiting for other threads to complete.
[rosmake-0] Finished <<< rospy [PASS] [ 1.15 seconds ] 
[ rosmake ] Results:
[ rosmake ] Built 18 packages with 1 failures. 
[ rosmake ] Summary output to directory
[ rosmake ] /Users/rosPudding/.ros/rosmake/rosmake_output-20111231-224403
Traceback (most recent call last):
  File "/usr/local/bin/rosinstall", line 5, in <module>
    pkg_resources.run_script('rosinstall==0.5.22', 'rosinstall')
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 489, in run_script
    self.require(requires)[0].run_script(script_name, ns)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 1214, in run_script
    exec script_code in namespace, namespace
  File "/Library/Python/2.7/site-packages/rosinstall-0.5.22-py2.7.egg/EGG-INFO/scripts/rosinstall", line 679, in <module>        
  File "/Library/Python/2.7/site-packages/rosinstall-0.5.22-py2.7.egg/EGG-INFO/scripts/rosinstall", line 670, in rosinstall_main        
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 504, in check_call
    raise CalledProcessError(retcode, cmd)
  subprocess.CalledProcessError: Command 'source /Users/rosPudding/ros/setup.sh && rosmake ros ros_comm --rosdep-install' returned non-zero exit status 1

I think I've tried this patch but no good. CMakeLists.txt I used is here. However, I concern what wjwwood says in this page (copied below). This sounds like the patch can solve the issue but it doesn't work for me:

The latest patch, ros_comm-1.6.5-rosconsole_g++-4.2.patch, has not been released. With completely up-to-date Xcode installs this will cause a failure when compiling rosconsole as g++-4.2 no longer exists.

I have tested the new patch, I think it needs to be applied so it can be in the next release.

Originally posted by 130s on ROS Answers with karma: 10937 on 2011-12-31

Post score: 0


1 Answer 1


Rosanswers logo

This happens due to the fact that Xcode-4.2 does not come with g++-4.2.

The patch you linked does fix this issue, but I don't know why it doesn't work for you.

Does /usr/bin/g++-4.2 exist on your computer?

Are you sure that you are building and patching the same ROS source install? I often have multiple and some times when I do rosmake I am unintentionally building one and editing another.

This is the output of svn diff on my install of ROS:

Index: CMakeLists.txt
--- CMakeLists.txt  (revision 15449)
+++ CMakeLists.txt  (working copy)
@@ -11,8 +11,15 @@


+# See ticket: https://code.ros.org/trac/ros/ticket/3626
+# On mac use g++-4.2
 IF(${CMAKE_SYSTEM} MATCHES "Darwin-11.*")
-  set(CMAKE_CXX_COMPILER /usr/bin/g++-4.2)
+  IF(EXISTS "/usr/bin/g++-4.2")
+    set(CMAKE_CXX_COMPILER /usr/bin/g++-4.2)
+  ELSE(EXISTS "/usr/bin/g++-4.2")
+    # If there is no g++-4.2 use clang++
+    set(CMAKE_CXX_COMPILER /usr/bin/clang++)
+  ENDIF(EXISTS "/usr/bin/g++-4.2")


Other than that I don't know why that patch wouldn't work. Let use know here if it continues to be a problem.

Originally posted by William with karma: 17335 on 2011-12-31

This answer was ACCEPTED on the original site

Post score: 1


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.