Skip to content

Commit

Permalink
Garden: rpath issues in gui plugins, ogre2.3 (#2410)
Browse files Browse the repository at this point in the history
This adds custom CMAKE_INSTALL_RPATH entries for
ogre2.3, gz-gui7, gz-sim7, gz-launch6 formulae for
binaries installed to nested subfolders,
such as <prefix>/libexec/gz/launch6 and
<prefix>/lib/gz-sim-6/plugins/gui.
This should fix library loading issues with ARM CPUs
and requiring a special version of brew to run gz sim.
This adds tests as well.

* ogre2.3: add gz-plugin2 as a test dependency
* gz-gui7: revision bump
* gz-launch6: revision bump
* gz-sim7: revision bump
* ogre2.3: 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 19, 2023
1 parent db97e86 commit 9fb0d08
Show file tree
Hide file tree
Showing 4 changed files with 105 additions and 23 deletions.
28 changes: 23 additions & 5 deletions Formula/gz-gui7.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ class GzGui7 < Formula
url "https://osrf-distributions.s3.amazonaws.com/gz-gui/releases/gz-gui-7.2.0.tar.bz2"
sha256 "d44ca605165d296205995a6d5fe3c5bcc58436699fdeae455839b703430b2023"
license "Apache-2.0"
revision 12
revision 13

head "https://github.com/gazebosim/gz-gui.git", branch: "gz-gui7"

bottle do
root_url "https://osrf-distributions.s3.amazonaws.com/bottles-simulation"
sha256 ventura: "e167b99208d779c9cc114e24b6274141b59bd77a08cd17f6e297484729203659"
sha256 monterey: "212ba21ede9a5bfed23ec8eb7909da1bd673a715bdd77716b0f17a9554cb5493"
sha256 big_sur: "6cbc1332d02e2d6ba7bb9e60a20eee3eb691bf974ab2488e0f80b6508084ff03"
sha256 ventura: "658b921f85bbd8e135ecb1e48fb9a72baf8065741bb242a7862eee0da3cb8e2c"
sha256 monterey: "facbe9636dc631f98b37aeefdba4ba7b3ca32821b2080517ce9e23f4b0963cb5"
sha256 big_sur: "ffe297c1e835d7d1241622d3e4fbba6cf375b45fe174560a91d81f0f3302ae33"
end

depends_on "cmake" => [:build, :test]
Expand All @@ -35,9 +35,13 @@ class GzGui7 < Formula
end

def install
rpaths = [
rpath,
rpath(source: lib/"gz-gui-7/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 @@ -46,6 +50,20 @@ def install
end

test do
# test some plugins in subfolders
%w[CameraFps Publisher TopicViewer WorldStats].each do |plugin|
p = lib/"gz-gui-7/plugins/lib#{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 <iostream>
Expand Down
30 changes: 25 additions & 5 deletions Formula/gz-launch6.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ class GzLaunch6 < Formula
url "https://osrf-distributions.s3.amazonaws.com/gz-launch/releases/gz-launch-6.0.0.tar.bz2"
sha256 "e59e988c8a454cacc9f8f5727d1ab0d2c7fc8476083ec96065a0f89913957b0a"
license "Apache-2.0"
revision 11
revision 12

head "https://github.com/gazebosim/gz-launch.git", branch: "gz-launch6"

bottle do
root_url "https://osrf-distributions.s3.amazonaws.com/bottles-simulation"
sha256 ventura: "d5a96d60b2b517a0f23dde7e6ac4999b989b757e40423b5dcd793c34cb7e701a"
sha256 monterey: "58433548d9a79aecc23936ded43294bd5daa28a4c7264e7940c2d825f4a1fd93"
sha256 big_sur: "abbb98550806133ba6dc130ce896d32a7e0c2a24d05d7790f884e61810c55911"
sha256 ventura: "d950332f45f28f730bbdd371d1ad7aa29002eaa3d383eeebabe9a74b92700dd4"
sha256 monterey: "ddcda32263a390b83bcc756bc1b8624ea10520bfd0c2a334e45146fbca2ac6e9"
sha256 big_sur: "046b3131ea293b5bfb305ac163b069b5dd4b1474a816b5dacb45d80a24fec7d2"
end

depends_on "cmake" => :build
Expand All @@ -32,9 +32,14 @@ class GzLaunch6 < Formula
depends_on "tinyxml2"

def install
rpaths = [
rpath,
rpath(source: lib/"gz/launch6", target: lib),
rpath(source: lib/"gz-launch-6/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 @@ -43,6 +48,21 @@ def install
end

test do
# test CLI executable
system lib/"gz/launch6/gz-launch"
# test plugins in subfolders
%w[joytotwist sim-factory sim simgui].each do |plugin|
p = lib/"gz-launch-6/plugins/libgz-launch-#{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
ENV["GZ_CONFIG_PATH"] = "#{opt_share}/gz"
system "gz", "launch", "--versions"
# check for Xcode frameworks in bottle
Expand Down
39 changes: 32 additions & 7 deletions Formula/gz-sim7.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ class GzSim7 < Formula
url "https://osrf-distributions.s3.amazonaws.com/gz-sim/releases/gz-sim-7.5.0.tar.bz2"
sha256 "e4a641bef1a747dd9a35c01beee3a1ac08f95bdaae06aa23b115e0b1a4ee42f8"
license "Apache-2.0"
revision 10
revision 11

head "https://github.com/gazebosim/gz-sim.git", branch: "gz-sim7"

bottle do
root_url "https://osrf-distributions.s3.amazonaws.com/bottles-simulation"
sha256 ventura: "3395622e43f32b5bb8de8682ad8bea440ad45ba3e20c8d7c326f74f8b832c34e"
sha256 monterey: "b840164058f7b1088222227820a42e72078a7e3f481ae8417bd8081d852d8029"
sha256 big_sur: "7677b7a0b8828ca7f3e1de697d2fb80eb7144f10c8fcd3913774503eab86b6d1"
sha256 ventura: "13bfba603836f7bea8ffdd0b8783b2792bd74274ec156ab3604db0afaf0a0d37"
sha256 monterey: "c0a30d465e613896b1bb2dc300790d121cb6b4da568cc013b0430d4f4c549712"
sha256 big_sur: "789e4a2d6016a0c4773d9cd571adf92182dc45875063aaf76a083047e0cf0d55"
end

depends_on "cmake" => :build
Expand Down Expand Up @@ -46,9 +46,15 @@ class GzSim7 < Formula
end

def install
rpaths = [
rpath,
rpath(source: lib/"gz-sim-7/plugins", target: lib),
rpath(source: lib/"gz-sim-7/plugins/gui", target: lib),
rpath(source: lib/"gz-sim-7/plugins/gui/GzSim", 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 @@ -57,10 +63,29 @@ def install
end

test do
# test some plugins in subfolders
plugin_info = lambda { |p|
# 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
}
%w[altimeter log physics sensors].each do |system|
plugin_info.call lib/"gz-sim-7/plugins/libgz-sim-#{system}-system.dylib"
end
["libAlignTool", "libEntityContextMenuPlugin", "libGzSceneManager", "GzSim/libEntityContextMenu"].each do |p|
plugin_info.call lib/"gz-sim-7/plugins/gui/#{p}.dylib"
end
# test gz sim CLI tool
ENV["GZ_CONFIG_PATH"] = "#{opt_share}/gz"
system Formula["ruby"].opt_bin/"ruby",
Formula["gz-tools2"].opt_bin/"gz",
system Formula["gz-tools2"].opt_bin/"gz",
"sim", "-s", "--iterations", "5", "-r", "-v", "4"
# build against API
(testpath/"test.cpp").write <<-EOS
#include <cstdint>
#include <gz/sim/Entity.hh>
Expand Down
31 changes: 25 additions & 6 deletions Formula/ogre2.3.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,19 @@ class Ogre23 < Formula
url "https://github.com/OGRECave/ogre-next/archive/refs/tags/v2.3.1.tar.gz"
sha256 "38dd0d5ba5759ee47c71552c5dacf44dad5fe61868025dcbd5ea6a6bdb6bc8e4"
license "MIT"
revision 1
revision 2

head "https://github.com/OGRECave/ogre-next.git", branch: "v2-3"

bottle do
root_url "https://osrf-distributions.s3.amazonaws.com/bottles-simulation"
sha256 cellar: :any, ventura: "ba3a53e121b7ca724ed6552cac5582ccef4f052e090a90e9cb77a7f8e68163c1"
sha256 cellar: :any, monterey: "c7bc82c7ffed7af79d74e7a9fc84c7c174869bbd797bfb8f818b55a05b36af86"
sha256 cellar: :any, big_sur: "d1a6802fc6866492073fa56800424c01e232820f3ab7b00031a1ec00115a73f4"
sha256 cellar: :any, catalina: "51d97c4d9a057983863425cce7df566fd2665ef81aa1bf7ac4600ecacd1c0252"
sha256 cellar: :any, ventura: "a99ca4c5adc6c3455d9df29aa00c944f3dddb2ff64c176cb37efc759b8bc1498"
sha256 cellar: :any, monterey: "58e4f7a6d4e1ae1a70b2f449801b4335deb378dc982f38f2bc3cfc6393a5e0b0"
sha256 cellar: :any, big_sur: "2cd52cc99ea96660c7a83e2c5458c900f0abd4af3fdd7b69117ad87b407d0a2a"
end

depends_on "cmake" => :build
depends_on "gz-plugin2" => :test
depends_on "pkg-config" => :test
depends_on "doxygen"
depends_on "freeimage"
Expand All @@ -27,11 +27,16 @@ class Ogre23 < Formula
depends_on "tbb"

def install
rpaths = [
rpath,
rpath(source: lib/"OGRE-2.3", target: lib),
rpath(source: lib/"OGRE-2.3/OGRE", target: lib),
]
cmake_args = [
"-DCMAKE_CXX_STANDARD=11",
"-DCMAKE_CXX_STANDARD_REQUIRED:BOOL=ON",
"-DCMAKE_CXX_EXTENSIONS:BOOL=ON",
"-DCMAKE_INSTALL_RPATH=#{rpath}",
"-DCMAKE_INSTALL_RPATH=#{rpaths.join(";")}",
"-DOGRE_BUILD_RENDERSYSTEM_GL3PLUS:BOOL=TRUE",
"-DOGRE_BUILD_RENDERSYSTEM_METAL:BOOL=TRUE",
"-DOGRE_BUILD_COMPONENT_HLMS:BOOL=TRUE",
Expand Down Expand Up @@ -98,6 +103,20 @@ def install
end

test do
# test plugins in subfolders
["libOgreMain", "libOgreOverlay", "libOgrePlanarReflections", "OGRE/RenderSystem_Metal"].each do |plugin|
p = lib/"OGRE-2.3/#{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 <Ogre.h>
int main()
Expand Down

0 comments on commit 9fb0d08

Please sign in to comment.