Ask Your Question
2

Mac OS X install error: No available formula for gtest

asked 2012-08-26 22:51:04 -0600

updated 2012-08-28 16:55:26 -0600

Kevin gravatar image

Hi Everybody!

I am trying to install ROS Electric on OS X Lion. I follow this tutorial but when I execute the command

rosinstall ~/ros "http://packages.ros.org/cgi-bin/gen_rosinstall.py?rosdistro=electric&variant=desktop-full&overlay=no"

I get the following error:

...
Bootstrapping ROS build
Detected ros_comm bootstrapping it too.
Using environment variable ROS_OS_OVERRIDE name = osxbrew version = lion
[ rosmake ] Packages requested are: ['ros', 'ros_comm']                                                                                                                                                
[ rosmake ] Logging to directory/Users/martin_peris/.ros/rosmake/rosmake_output-20120827-171936                                                                                                        
[ rosmake ] Expanded args ['ros', 'ros_comm'] to:
['rosunit', 'rospack', 'rosmake', 'rosemacs', 'rosdep', 'roscreate', 'rosclean', 'rosboost_cfg', 'rosbash', 'test_rospack', 'test_rosmake', 'test_roslib', 'test_rosdep', 'test_roscreate', 'roslib', 'roslang', 'rosbuild', 'mk', 'xmlrpcpp', 'roswtf', 'rostime', 'message_filters', 'cpp_common', 'topic_tools', 'rostopic', 'rostest', 'rosservice', 'rosparam', 'rosout', 'rosnode', 'rosmsg', 'rosmaster', 'roslaunch', 'rosgraph', 'rosconsole', 'rosbagmigration', 'rosbag', 'test_topic_tools', 'test_roswtf', 'test_rostopic', 'test_rostime', 'test_rostest', 'test_rosservice', 'test_rospy', 'test_rosparam', 'test_rosnode', 'test_rosmsg', 'test_rosmaster', 'test_roslib_comm', 'test_roslaunch', 'test_rosgraph', 'test_roscpp_serialization_perf', 'test_roscpp_serialization', 'test_roscpp', 'test_rosbag', 'test_ros', 'test_crosspackage', 'perf_roscpp', 'roscore_migration_rules', 'std_srvs', 'std_msgs', 'rosgraph_msgs', 'rospy', 'roslisp', 'roscpp_traits', 'roscpp_serialization', 'roscpp']
[ rosmake ] Generating Install Script using rosdep then executing. This may take a minute, you will be prompted for permissions. . .                                                                   
Using environment variable ROS_OS_OVERRIDE name = osxbrew version = lion
Executing script below with cwd=/var/folders/yz/rvk6x5qs5vd2h4bfp83xwm3r0000gn/T
{{{
#!/bin/bash
#Packages ['gtest']
brew install gtest --universal
}}}

Error: No available formula for gtest 
Failed to install gtest!
[ rosmake ] rosdep install failed: Rosdep install failed                                                                                                                                               
Traceback (most recent call last):
  File "/usr/local/bin/rosinstall", line 16, in <module>
    sys.exit(not rosinstall_main(sys.argv))
  File "/Library/Python/2.7/site-packages/rosinstall/rosinstall_cli.py", line 228, in rosinstall_main
options.catkinpp)
  File "/Library/Python/2.7/site-packages/rosinstall/rosinstall_cmd.py", line 100, in cmd_generate_ros_files
subprocess.check_call("source %s && rosmake ros%s --rosdep-install%s" % (os.path.join(path, 'setup.sh'), ros_comm_insert, rosdep_yes_insert), shell=True, executable='/bin/bash')
  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/martin_peris/ros/setup.sh && rosmake ros ros_comm --rosdep-install' returned non-zero exit status 1
Martin-iMac:~ martin_peris$ brew install gtest --universal
Error: No available formula for gtest

I have been researching a bit and it seems like gtest formula has been removed from hombrew. Any Ideas? workarounds? suggestions?

UPDATE

As long as I can not answer my own questions, I post a (suboptimal) solution to my problem. I created manually the file /usr/local/Library/Formula/gtest.rb with the contents:

require 'formula'

class Gtest < Formula
  url 'http://googletest.googlecode.com/files/gtest-1.5.0.tar.gz'
  homepage 'http://code.google.com/p/googletest/'
  md5 '7e27f5f3b79dd1ce9092e159cdbd0635'

  def options
    [
      ["--universal", "Build for both 32 & 64 bit Intel."],
    ]
  end

  def install
    ENV.universal_binary if ARGV.build_universal?

    system "./configure", "--prefix=#{prefix}", "--disable-debug", "--disable-dependency-tracking"
    # gtest-config tries to be clever in locating libraries, but Homebrew's
    # Cellar confuses it. This lets `gtest-config --libs` work correctly
    inreplace 'scripts/gtest-config', '`dirname $0`', '$bindir'
    system "make install"
  end
end

I have no longer problems with gtest, but now the installation fails for another reason. I guess I should start a new question for that.

Thanks!!

edit retag flag offensive close merge delete

Comments

The above formula as it is, gave some errors relating to md5 being not supported anymore. Replacing md5 with sha256 and updating the key number in front to match that for the current file, allowed brew to download the files, but eventually gave gtest compile errors relating to TR1_TUPLE

Sanket gravatar imageSanket ( 2016-03-09 14:19:22 -0600 )edit

I got rid of the TR1_TUPLE error using system "./configure CPPFLAGS=-DGTEST_USE_OWN_TR1_TUPLE=1”,... in the formula above. However the build for test still fails and but now it does not give any details on what the error is.

Sanket gravatar imageSanket ( 2016-03-09 15:46:08 -0600 )edit

2 Answers

Sort by » oldest newest most voted
2

answered 2012-08-27 06:09:31 -0600

WilliamWoodall gravatar image

The reason for not carrying gtest as a formula anymore is that Google actually suggests against a pre-built gtest library, instead they figure you should build gtest with your project to ensure similar build flags.

See: http://code.google.com/p/googletest/wiki/FAQ#Why_is_it_not_recommended_to_install_a_pre-compiled_copy_of_Goog

There are open tickets related to this problem.

https://github.com/ros/homebrew-fuerte/issues/5

https://github.com/ros/catkin/issues/157

In the short term installing gtest manually will work, but a better long term solution is in progress.

edit flag offensive delete link more
0

answered 2016-03-09 16:57:07 -0600

Sanket gravatar image

An update on the formula script from above that resolved some errors on mac OS X regarding TR1 tuples during gtest compilation and unsupported md5, in case anyone is facing similar issues:

 require 'formula'

 class Gtest < Formula
   url 'http://googletest.googlecode.com/files/gtest-1.5.0.tar.gz'
   homepage 'http://code.google.com/p/googletest/'
   sha256 '24156a23cfa49a194c48d1b630fd8eaa63fffc403719b5ddb94cdbe8d9a96aff'

   def options
     [
       ["--universal", "Build for both 32 & 64 bit Intel."],
     ]
   end

   def install
     ENV.universal_binary if ARGV.build_universal?

    system "./configure","CPPFLAGS=-DGTEST_USE_OWN_TR1_TUPLE=1", "--prefix=#{prefix}", "--disable-debug", "--disable-dependency-tracking"
    # gtest-config tries to be clever in locating libraries, but Homebrew's
    # Cellar confuses it. This lets `gtest-config --libs` work correctly
    inreplace 'scripts/gtest-config', '`dirname $0`', '$bindir'
    system "make install"
  end
end
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2012-08-26 22:51:04 -0600

Seen: 6,236 times

Last updated: Mar 09 '16