Skip to content

Commit

Permalink
Garden: fix physics, rendering, transport rpath issues and add tests (#…
Browse files Browse the repository at this point in the history
…2409)

This adds custom CMAKE_INSTALL_RPATH entries for
formulae with binaries installed to nested subfolders,
such as <prefix>/libexec/gz/transport12 and
<prefix>/lib/gz-physics-6/engine-plugins.
This should fix library loading issues with ARM CPUs.
This adds tests as well.

* gz-rendering: patch for ogre2 rpath
* gz-physics6: revision bump
* gz-rendering7: revision bump
* gz-transport12: revision bump
* update  bottle.

Signed-off-by: Steve Peters <[email protected]>
Co-authored-by: OSRF Build Bot <[email protected]>
  • Loading branch information
scpeters and osrfbuild authored Sep 18, 2023
1 parent 58059a0 commit db97e86
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 15 deletions.
34 changes: 28 additions & 6 deletions Formula/gz-physics6.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@ class GzPhysics6 < Formula
url "https://osrf-distributions.s3.amazonaws.com/gz-physics/releases/gz-physics-6.5.0.tar.bz2"
sha256 "807345b1e8ca3b33678cd5424331f50d7e609be453491247c88267ec8af0adee"
license "Apache-2.0"
revision 1

bottle do
root_url "https://osrf-distributions.s3.amazonaws.com/bottles-simulation"
sha256 ventura: "11339ffc950754980e92302f2721784a7ad1d1cc76869ea13d1da61bc6fbc47f"
sha256 monterey: "6981b3711f914e88cdbf86464559adb0d5d146b4e3161385ced44789bb4447d5"
sha256 big_sur: "fe19abc81ae3e805ce5fe4ff90fc071a24b11c1828f5b4acd5605821740f6df9"
sha256 ventura: "2a2ddc047ebbb1d413ae87844572d6be59e657e76f7ef4d3ac5da66f21f9acd5"
sha256 monterey: "0f0aefaddd5545fcc3b7eb0f01ec278466f0d32f0ebdcea187a7967750ed26cd"
sha256 big_sur: "3da98f2f48f3e0f0a94fe9c405803e1ad54419041f3fed61b3f8d46969c913fc"
end

depends_on "cmake" => :build
Expand All @@ -27,14 +28,35 @@ class GzPhysics6 < Formula
depends_on "sdformat13"

def install
rpaths = [
rpath,
rpath(source: lib/"gz-physics-6/engine-plugins", target: lib),
]
cmake_args = std_cmake_args
cmake_args << "-DBUILD_TESTING=OFF"
cmake_args << "-DCMAKE_INSTALL_RPATH=#{rpath}"
system "cmake", ".", *cmake_args
system "make", "install"
cmake_args << "-DCMAKE_INSTALL_RPATH=#{rpaths.join(";")}"

mkdir "build" do
system "cmake", "..", *cmake_args
system "make", "install"
end
end

test do
# test plugins in subfolders
%w[bullet-featherstone bullet dartsim tpe].each do |engine|
p = lib/"gz-physics-6/engine-plugins/libgz-physics-#{engine}-plugin.dylib"
# Use gz-plugin --info command to check plugin linking
cmd = Formula["gz-plugin2"].opt_libexec/"gz/plugin2/gz-plugin"
args = ["--info", "--plugin"] << p
# print command and check return code
system cmd, *args
# check that library was loaded properly
_, stderr = system_command(cmd, args: args)
error_string = "Error while loading the library"
assert stderr.exclude?(error_string), error_string
end
# build against API
(testpath/"test.cpp").write <<-EOS
#include "gz/plugin/Loader.hh"
#include "gz/physics/ConstructEmpty.hh"
Expand Down
33 changes: 29 additions & 4 deletions Formula/gz-rendering7.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@ class GzRendering7 < Formula
url "https://osrf-distributions.s3.amazonaws.com/gz-rendering/releases/gz-rendering-7.4.1.tar.bz2"
sha256 "fea3a6b06c8fab598ffbc56a60dba48779282ac828260251b9058a6b5a5b823a"
license "Apache-2.0"
revision 1

head "https://github.com/gazebosim/gz-rendering.git", branch: "gz-rendering7"

bottle do
root_url "https://osrf-distributions.s3.amazonaws.com/bottles-simulation"
sha256 ventura: "b79e201679fd148c68065f77092498413a18c5d0ecff03646f027e0c3498d108"
sha256 monterey: "1c586df54e9f6139cf168b090bb4f1c5beb0e7f49ea1af163cb39e31398aac41"
sha256 big_sur: "1067c6d25e463b3c30f06aaba1d41040750b1422493113b549c07f892dd586d8"
sha256 ventura: "553fc8ea77688fd97354525418814a0d0b3a0a29b85de011987e2b29417cb865"
sha256 monterey: "ea61caed7c72f4bce5d559f888f7baa3c368b56da165d9c08cdc836ea4a247e1"
sha256 big_sur: "39844d2004e2e338d77556ad696c47de3ac39800132845c5ba39a3e57adae9d3"
end

depends_on "cmake" => [:build, :test]
Expand All @@ -27,10 +28,20 @@ class GzRendering7 < Formula
depends_on "ogre1.9"
depends_on "ogre2.3"

patch do
# use CMAKE_INSTALL_RPATH values in ogre2 library
url "https://github.com/gazebosim/gz-rendering/commit/65ffacb49e5c5477e2ee5241bb45fdfd2273a5ae.patch?full_index=1"
sha256 "ed13b1d5e74d3a4e66c33a52149eb6be581b5f97014e2745d9e18ad216913fd8"
end

def install
rpaths = [
rpath,
rpath(source: lib/"gz-rendering-7/engine-plugins", target: lib),
]
cmake_args = std_cmake_args
cmake_args << "-DBUILD_TESTING=OFF"
cmake_args << "-DCMAKE_INSTALL_RPATH=#{rpath}"
cmake_args << "-DCMAKE_INSTALL_RPATH=#{rpaths.join(";")}"

mkdir "build" do
system "cmake", "..", *cmake_args
Expand All @@ -39,6 +50,20 @@ def install
end

test do
# test plugins in subfolders
["ogre", "ogre2"].each do |engine|
p = lib/"gz-rendering-7/engine-plugins/libgz-rendering-#{engine}.dylib"
# Use gz-plugin --info command to check plugin linking
cmd = Formula["gz-plugin2"].opt_libexec/"gz/plugin2/gz-plugin"
args = ["--info", "--plugin"] << p
# print command and check return code
system cmd, *args
# check that library was loaded properly
_, stderr = system_command(cmd, args: args)
error_string = "Error while loading the library"
assert stderr.exclude?(error_string), error_string
end
# build against API
github_actions = ENV["HOMEBREW_GITHUB_ACTIONS"].present?
(testpath/"test.cpp").write <<-EOS
#include <gz/rendering/RenderEngine.hh>
Expand Down
18 changes: 13 additions & 5 deletions Formula/gz-transport12.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ class GzTransport12 < Formula
url "https://osrf-distributions.s3.amazonaws.com/gz-transport/releases/gz-transport-12.2.0.tar.bz2"
sha256 "731ec9f87fd815c62486ed4e2c3ecbeff5b8b4a8f09cc5e7abf4d8758cebe048"
license "Apache-2.0"
revision 12
revision 13

head "https://github.com/gazebosim/gz-transport.git", branch: "gz-transport12"

bottle do
root_url "https://osrf-distributions.s3.amazonaws.com/bottles-simulation"
sha256 ventura: "e2277d2560c81e2478f865359b45a9e0a61c30841fc29a1540d6923270832070"
sha256 monterey: "4cd9f47d9db13508c172e3c8fcb9dce8f3563018db1ae862aa6be2850760e727"
sha256 big_sur: "898238b0bf771ba7420f0190b4f7e615e8899a8bc6120b328d4267caee7d5d79"
sha256 ventura: "3e3a928f9dd36f8c97fc7b2fff27142f5d7e1c10e9194bf747c3841955d2d99b"
sha256 monterey: "250cf7691f8794722b1283971af31073b7f462fcd24bcda7f65a1d7c06c460ac"
sha256 big_sur: "277dcbdc9d2af2325d16dbd24917a0ea5901acb4ef3ea5ee461c3b631697369a"
end

depends_on "doxygen" => [:build, :optional]
Expand All @@ -36,9 +36,13 @@ class GzTransport12 < Formula
end

def install
rpaths = [
rpath,
rpath(source: libexec/"gz/transport12", target: lib),
]
cmake_args = std_cmake_args
cmake_args << "-DBUILD_TESTING=OFF"
cmake_args << "-DCMAKE_INSTALL_RPATH=#{rpath}"
cmake_args << "-DCMAKE_INSTALL_RPATH=#{rpaths.join(";")}"

# Use build folder
mkdir "build" do
Expand All @@ -48,6 +52,10 @@ def install
end

test do
# test CLI executables
system libexec/"gz/transport12/gz-transport-service"
system libexec/"gz/transport12/gz-transport-topic"
# build against API
(testpath/"test.cpp").write <<-EOS
#include <iostream>
#include <gz/transport.hh>
Expand Down

0 comments on commit db97e86

Please sign in to comment.