Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to build Lunar + QT5 + Ogre 1.9 + Gazebo 8 #84

Merged
merged 13 commits into from
Oct 20, 2017
4 changes: 0 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
58 changes: 33 additions & 25 deletions install
Original file line number Diff line number Diff line change
Expand Up @@ -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}}
Expand Down Expand Up @@ -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
Expand All @@ -92,21 +92,36 @@ 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.
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

Expand All @@ -122,17 +137,6 @@ do_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

# This patch originates from here: https://github.com/ros/catkin/pull/784
if [ -d src/catkin ]; then
pushd src/catkin/cmake
Expand All @@ -153,11 +157,15 @@ 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} \
--blacklist opencv3 \
--make-args CXXFLAGS=-D__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES=0 \
--cmake-args \
-DCATKIN_ENABLE_TESTING=1 \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_FIND_FRAMEWORK=LAST \
-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

Expand Down
79 changes: 69 additions & 10 deletions rosdeps.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
gazebo:
libogre-dev:
osx:
homebrew:
packages: [gazebo7]
packages: [ogre1.9]
libpng-dev:
osx:
homebrew:
packages: [libpng]
libwebp-dev:
osx:
homebrew:
packages: [webp]
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll push these changes upstream into rosdistro's rosdep.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

python:
osx:
homebrew:
Expand All @@ -10,21 +18,72 @@ python:
packages: [pip, setuptools, nose]
python-imaging:
osx:
homebrew:
packages: [homebrew/python/pillow]
pip:
packages: [pillow]
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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]

# Use Gazebo 8 instead of 7.
gazebo7:
osx:
homebrew:
packages: [gazebo8]
libgazebo7-dev:
osx:
homebrew:
packages: [gazebo8]

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: []
6 changes: 6 additions & 0 deletions shim/pip
Original file line number Diff line number Diff line change
@@ -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 $?
5 changes: 5 additions & 0 deletions shim/python
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/sh
# This wrapper allows scripts to call python and it actually be
# the python2 that's brewed Python, rather than system python.
python2 $@
exit $?