diff --git a/.travis.yml b/.travis.yml index 0bd65ba..7ed81d6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,25 +2,9 @@ language: generic matrix: include: - # OSRF has bottles of Gazebo on Yosemite, so test gazebo_ros on that. - - os: osx - osx_image: xcode7 - env: ROS_DISTRO=indigo ROS_CONFIGURATION=gazebo_ros - - # Check up to rviz on El Capitan (this build sometimes times out). - - os: osx - osx_image: xcode8 - env: ROS_DISTRO=indigo ROS_CONFIGURATION=rviz - - # Building anything GUI from Kinetic fails due to qt4/5 issues. - os: osx osx_image: xcode8 - env: ROS_DISTRO=kinetic ROS_CONFIGURATION=ros_base - -cache: - directories: - - $HOME/Library/Caches/pip - - $HOME/Library/Caches/Homebrew + env: ROS_CONFIGURATION=rviz PATH=/usr/local/bin:/usr/bin:/usr/sbin:/bin script: - ./install diff --git a/README.md b/README.md index 284ceb6..be94aee 100644 --- a/README.md +++ b/README.md @@ -2,9 +2,9 @@ ros-install-osx [![Build Status](https://travis-ci.org/mikepurvis/ros-install- =============== This repo aims to maintain a usable, scripted, up-to-date installation procedure for -[ROS](http://ros.org). The intent is that the `install` script may be executed on a -bare Yosemite or El Capitan machine and produce a working desktop_full installation, -including RQT, rviz, and Gazebo. +[ROS](http://ros.org), currently Lunar. The intent is that the `install` script may +be executed on a El Capitan or newer machine and produce a working desktop_full +installation, including RQT, rviz, and Gazebo. This is the successor to my [popular gist on the same topic][1]. @@ -14,10 +14,6 @@ This is the successor to my [popular gist on the same topic][1]. Usage ----- - curl https://raw.githubusercontent.com/mikepurvis/ros-install-osx/master/install | bash - -or - ```shell git clone https://github.com/mikepurvis/ros-install-osx.git cd ros-install-osx diff --git a/circle.yml b/circle.yml new file mode 100644 index 0000000..f6db5fb --- /dev/null +++ b/circle.yml @@ -0,0 +1,7 @@ +machine: + xcode: + version: 8.2 + +compile: + override: + - ./install diff --git a/install b/install index 8ad3fcf..7a83062 100755 --- a/install +++ b/install @@ -22,7 +22,7 @@ # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE # POSSIBILITY OF SUCH DAMAGE. -ROS_DISTRO=${ROS_DISTRO:-indigo} +ROS_DISTRO=${ROS_DISTRO:-lunar} ROS_CONFIGURATION=${ROS_CONFIGURATION:-desktop_full} ROS_EXTRA_PACKAGES=${ROS_EXTRA_PACKAGES:-} ROS_INSTALL_DIR=${ROS_INSTALL_DIR:-/opt/ros/${ROS_DISTRO}} @@ -77,7 +77,7 @@ do_install() fi # Brewed Python - if [ $(which python) != "/usr/local/bin/python" ]; then + if [ ! "$(which python2)" = "/usr/local/bin/python2" ]; then brew install python mkdir -p ~/Library/Python/2.7/lib/python/site-packages echo "$(brew --prefix)/lib/python2.7/site-packages" >> ~/Library/Python/2.7/lib/python/site-packages/homebrew.pth @@ -92,21 +92,37 @@ do_install() # Homebrew science gives us vtk and PCL, among other things. brew tap homebrew/science - # Homebrew python gets us bottles for numpy, scipy, etc. - brew tap homebrew/python - # ROS infrastructure tools brew install libyaml || true - pip install -U setuptools rosdep rosinstall_generator wstool rosinstall catkin_tools bloom empy sphinx pycurl + pip2 install -U setuptools rosdep rosinstall_generator wstool rosinstall catkin_tools bloom empy sphinx pycurl + + # Rosdep has an issue detecting that qt5 is correctly installed, so preinstall it. This is a keg-only formula, + # so add its location to the prefix path in order for workspace packages to be able to find it. + brew install qt5 pyqt5 sip + export CMAKE_PREFIX_PATH=$(brew --prefix qt5) + + # This hack is required to make qt_gui_cpp compile correctly. See https://github.com/mikepurvis/ros-install-osx/pull/84#issuecomment-338209466 + pushd /usr/local/share/sip + if [ ! -e PyQt5 ]; then + ln -s Qt5 PyQt5 + fi + popd + + # Get homebrew's opencv3 from a bottle so that we don't have to build it. + brew install opencv3 + + # Mock out python and pip so that we get the brewed versions when rosdep and other programs call them. + # Mock out pip so that we get the brewed pip2 when rosdep calls it to make an installation. + export PATH=$(pwd)/shim:$PATH # Initialize and update rosdep if [ ! -d /etc/ros/rosdep/ ]; then echo "This sudo prompt is to initialize rosdep (creates the /etc/ros/rosdep path)." sudo rosdep init fi - if [ ! -f /etc/ros/rosdep/10-ros-install-osx.list ]; then - echo "This sudo prompt adds the the brewed python rosdep yaml to /etc/ros/rosdep/10-ros-install-osx.list." - sudo sh -c "echo 'yaml https://raw.githubusercontent.com/mikepurvis/ros-install-osx/master/rosdeps.yaml osx' > /etc/ros/rosdep/sources.list.d/10-ros-install-osx.list" + if [ ! -f /etc/ros/rosdep/sources.list.d/10-ros-install-osx.list ]; then + echo "This sudo prompt adds the the brewed python rosdep yaml to /etc/ros/rosdep/sources.list.d/10-ros-install-osx.list" + sudo sh -c "echo 'yaml file://$(pwd)/rosdeps.yaml osx' > /etc/ros/rosdep/sources.list.d/10-ros-install-osx.list" fi rosdep update @@ -116,32 +132,34 @@ do_install() rm -rf "$WS" fi mkdir $WS - pushd $WS + cd $WS # Standard source install rosinstall_generator ${ROS_CONFIGURATION} ${ROS_EXTRA_PACKAGES} --rosdistro ${ROS_DISTRO} --deps --tar > ${WS}.rosinstall - wstool init -j8 src ${WS}.rosinstall - - # Grabbing these older meshes allows rviz to run with Ogre 1.7 rather than Ogre 1.8+. - # Some details here: https://github.com/ros-visualization/rviz/issues/782 - if [ -d src/rviz ]; then - pushd src/rviz/ogre_media/models - curl https://raw.githubusercontent.com/ros-visualization/rviz/hydro-devel/ogre_media/models/rviz_cone.mesh > rviz_cone.mesh - curl https://raw.githubusercontent.com/ros-visualization/rviz/hydro-devel/ogre_media/models/rviz_cube.mesh > rviz_cube.mesh - curl https://raw.githubusercontent.com/ros-visualization/rviz/hydro-devel/ogre_media/models/rviz_cylinder.mesh > rviz_cylinder.mesh - curl https://raw.githubusercontent.com/ros-visualization/rviz/hydro-devel/ogre_media/models/rviz_sphere.mesh > rviz_sphere.mesh - popd - fi + wstool init src + pushd src + # Avoid downloading opencv3; we already installed it from homebrew. + wstool merge file://$(pwd)/../${WS}.rosinstall + wstool remove opencv3 + wstool update -j8 + + # This patch originates from: https://github.com/ros/catkin/pull/784 + if [ -d catkin ]; then + pushd catkin/cmake + curl https://raw.githubusercontent.com/ros/catkin/8a47f4eceb4954beb4a5b38b50793d0bbe2c96cf/cmake/catkinConfig.cmake.in > catkinConfig.cmake.in + popd + fi - # This patch originates from here: https://github.com/ros/catkin/pull/784 - if [ -d src/catkin ]; then - pushd src/catkin/cmake - curl https://raw.githubusercontent.com/ros/catkin/8a47f4eceb4954beb4a5b38b50793d0bbe2c96cf/cmake/catkinConfig.cmake.in > catkinConfig.cmake.in - popd - fi + # This patch originates from: https://github.com/ros-visualization/rviz/pull/1165 + if [ -d rviz ]; then + pushd rviz + curl https://raw.githubusercontent.com/mikepurvis/rviz/21eac2bcc061bb623fd17aa449f6215c493b27f2/CMakeLists.txt > CMakeLists.txt + popd + fi - # Package dependencies. - rosdep install --from-paths src --ignore-src --rosdistro ${ROS_DISTRO} -y --as-root pip:no --skip-keys=python-qt-bindings-qwt5 + # Package dependencies. + rosdep install --from-paths . --ignore-src --rosdistro ${ROS_DISTRO} -y --as-root pip:no + popd # Clean out or create the install directory. if [ -d ${ROS_INSTALL_DIR} ]; then @@ -153,13 +171,16 @@ do_install() fi # Parallel build. - catkin config --install --install-space ${ROS_INSTALL_DIR} --cmake-args \ - -DCATKIN_ENABLE_TESTING=1 \ - -DCMAKE_BUILD_TYPE=Release \ - -DPYTHON_LIBRARY=$(python -c "import sys; print sys.prefix")/lib/libpython2.7.dylib \ - -DPYTHON_INCLUDE_DIR=$(python -c "import sys; print sys.prefix")/include/python2.7 + catkin config --install \ + --install-space ${ROS_INSTALL_DIR} \ + --cmake-args \ + -DCATKIN_ENABLE_TESTING=1 \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_FIND_FRAMEWORK=LAST \ + -DPYTHON_EXECUTABLE=$(which python2) \ + -DPYTHON_LIBRARY=$(python2 -c "import sys; print sys.prefix")/lib/libpython2.7.dylib \ + -DPYTHON_INCLUDE_DIR=$(python2 -c "import sys; print sys.prefix")/include/python2.7 catkin build --limit-status-rate 1 - popd echo "Installation successful, please source the ROS workspace:" echo diff --git a/rosdeps.yaml b/rosdeps.yaml index d694428..576ee79 100644 --- a/rosdeps.yaml +++ b/rosdeps.yaml @@ -1,30 +1,89 @@ -gazebo: +# Override the default key to get us Ogre 1.9 instead of 1.7. +libogre-dev: osx: homebrew: - packages: [gazebo7] + packages: [ogre1.9] + +# Use Gazebo 8 instead of 7. +gazebo7: + osx: + homebrew: + packages: [gazebo8] +libgazebo7-dev: + osx: + homebrew: + packages: [gazebo8] + +# Don't try to install opencv3 +opencv3: + osx: + homebrew: + packages: [] + +# Installing all this Python stuff from homebrew instead of pip +# means we get pre-built bottles and don't have to build it all +# each time. python: osx: homebrew: packages: [python] pip: packages: [pip, setuptools, nose] -python-imaging: - osx: - homebrew: - packages: [homebrew/python/pillow] python-matplotlib: osx: homebrew: - packages: [homebrew/python/matplotlib] + packages: [homebrew/science/matplotlib] python-numpy: osx: homebrew: - packages: [homebrew/python/numpy] -python-scapy: + packages: [numpy] +python-scipy: osx: homebrew: - packages: [homebrew/python/scapy] -python-scipy: + packages: [scipy] +python-wxtools: + osx: + homebrew: + packages: [wxmac] + +# Zero out all the QT5 keys. We'll install it ourselves upfront. +libqt5-opengl-dev: + osx: + homebrew: + packages: [] +libqt5-opengl: + osx: + homebrew: + packages: [] +libqt5-core: + osx: + homebrew: + packages: [] +python-qt5-bindings-gl: + osx: + homebrew: + packages: [] +python-qt5-bindings-webkit: + osx: + homebrew: + packages: [] +libqt5-gui: + osx: + homebrew: + packages: [] +libqt5-widgets: + osx: + homebrew: + packages: [] +qtbase5-dev: + osx: + homebrew: + packages: [] +qt5-qmake: + osx: + homebrew: + packages: [] +python-qt5-bindings: osx: homebrew: - packages: [homebrew/python/scipy] + packages: [] diff --git a/shim/pip b/shim/pip new file mode 100755 index 0000000..ad72626 --- /dev/null +++ b/shim/pip @@ -0,0 +1,6 @@ +#!/bin/sh +# This wrapper allows rosdep to call pip and it actually be +# the pip2 that's part of brewed Python, rather than the missing +# system pip. +pip2 $@ +exit $?