Skip to content

Commit

Permalink
fix: support rviz2 for humble on macos
Browse files Browse the repository at this point in the history
original patch: ros2/rviz@0ef2b56
  • Loading branch information
stevalkr committed Dec 2, 2024
1 parent 518d764 commit ff9048a
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 4 deletions.
39 changes: 36 additions & 3 deletions distros/humble/overrides.nix
Original file line number Diff line number Diff line change
Expand Up @@ -143,12 +143,45 @@ in with lib; {
'';
});

# This is a newer version than the build system tries to download,
# cleaned definition to fix build for macOS on ARM64 since v1.12.9
rviz-ogre-vendor = (patchVendorUrl rosSuper.rviz-ogre-vendor {
url = "https://github.com/OGRECave/ogre/archive/v1.12.1.zip";
sha256 = "1iv6k0dwdzg5nnzw2mcgcl663q4f7p2kj7nhs8afnsikrzxxgsi4";
}).overrideAttrs ({ ... }: {
originalUrl = "https://github.com/OGRECave/ogre/archive/v1.12.1.zip";
url = "https://github.com/OGRECave/ogre/archive/v1.12.10.zip";
hash = "sha256-lZDLywgShlWeWah7oTnyKBTqzN505LJKbQbgXRfJXlk=";
}).overrideAttrs ({
propagatedBuildInputs ? [], nativeBuildInputs ? [], patches ? [], prePatch ? "", postPatch ? "", ...
}: {
# Prevent replacing $out/opt/.. with $out/var/empty/..
dontFixCmake = true;
propagatedBuildInputs = propagatedBuildInputs ++ [ self.pugixml self.glew ];
nativeBuildInputs = nativeBuildInputs ++ lib.optionals self.stdenv.isDarwin [
self.darwin.apple_sdk.frameworks.Foundation
self.darwin.apple_sdk.frameworks.AppKit
];
patches = patches ++ [
# Fix build failures on macOS + Apple Silicon
(self.fetchpatch {
url = "https://github.com/ros2/rviz/commit/0ef2b56373b98b5536f0f817c11dc2b5549f391d.patch";
hash = "sha256-tS8UGHih29T8AKCe+/ZEEEYDKNyY3bZRR/0nhiWaXlU=";
stripLen = 2;
extraPrefix = "";
postFetch = ''
substituteInPlace $downloadedFile \
--replace-fail '@@ -191,7 +195,7 @@' '@@ -188,7 +192,7 @@' \
--replace-fail 'relocatable.patch' 'fix-arm64.diff' \
--replace-fail 'C4267.patch' 'relocatable.patch'
'';
})
];
prePatch = prePatch + ''
echo -n > fix-arm64.diff
'';
postPatch = postPatch + ''
substituteInPlace CMakeLists.txt \
--replace-fail 'ogre-v1.12.1' 'ogre-v1.12.10' \
--replace-fail 'URL_MD5 cdbea4006d223c173e0a93864111b936' "URL_MD5 c1b870955efddf539385094e9034e7f7"
'';
});

shared-queues-vendor = patchVendorUrl (patchVendorUrl rosSuper.shared-queues-vendor {
Expand Down
2 changes: 1 addition & 1 deletion distros/ros2-overlay.nix
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ rosSelf: rosSuper: with rosSelf.lib; {
}: {
dontWrapQtApps = false;
nativeBuildInputs = nativeBuildInputs ++ [ self.qt5.wrapQtAppsHook ];
qtWrapperArgs = qtWrapperArgs ++ [
qtWrapperArgs = qtWrapperArgs ++ optionals self.stdenv.isLinux [
# Use X11 by default in RViz2.
# https://github.com/ros-visualization/rviz/issues/1442
"--set-default QT_QPA_PLATFORM xcb"
Expand Down

0 comments on commit ff9048a

Please sign in to comment.