From 5b7ec3fbfa8968fc6dc8fee96d676a000fee107f Mon Sep 17 00:00:00 2001 From: Lightech Date: Sat, 19 Nov 2022 02:10:23 -0500 Subject: [PATCH] Add some known Python executable script to fix hardcoded path, update documentation --- README.md | 19 +++++++++---------- build_deps.sh | 9 +++++---- fix_hardcoded_paths.sh | 6 +++++- 3 files changed, 19 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index b1b569f..a9aaf65 100644 --- a/README.md +++ b/README.md @@ -63,7 +63,6 @@ colcon build --merge-install \ -DBUILD_TESTING=NO \ -DTHIRDPARTY=FORCE \ -DCOMPILE_TOOLS=NO \ - -DFORCE_BUILD_VENDOR_PKG=ON \ -DBUILD_MEMORY_TOOLS=OFF \ -DRCL_LOGGING_IMPLEMENTATION=rcl_logging_noop ``` @@ -87,14 +86,12 @@ After my tons of failures, here is what went going on behind the above command: 4. `COMPILE_TOOLS=NO` for `Fast-DDS` to **NOT** compile the fast discovery server executable. - 5. `FORCE_BUILD_VENDOR_PKG=ON` is to build and use the `*_vendor` packages such as `libyaml_vendor`, again so that we do not have to install it to the system with Homebrew + 5. `BUILD_MEMORY_TOOLS=OFF` is for `foonathan_memory` to disable building `nodesize_db` program - 6. `BUILD_MEMORY_TOOLS=OFF` is for `foonathan_memory` to disable building `nodesize_db` program - - 7. `RCL_LOGGING_IMPLEMENTATION=rcl_logging_noop` is to select the logging backend for `rcl_logging`. + 6. `RCL_LOGGING_IMPLEMENTATION=rcl_logging_noop` is to select the logging backend for `rcl_logging`. Here, I am using `noop` one to avoid one more dependency `spdlog_vendor`. - 8. ROS2 depends significantly on dynamic linking. Do NOT add `BUILD_SHARED_LIBS=NO`, contrary to my other project [LLVM](https://github.com/light-tech/LLVM-On-iOS/) where building static libs is needed! + 7. ROS2 depends significantly on dynamic linking. Do NOT add `BUILD_SHARED_LIBS=NO`, contrary to my other project [LLVM](https://github.com/light-tech/LLVM-On-iOS/) where building static libs is needed! ## Build ROS2 with graphical tools for macOS @@ -126,10 +123,12 @@ In that case, you will need to install `x86_64` version of Python. * If you download the file from a browser, it will be put in quarantine so you need to `xattr -d com.apple.quarantine DOWNLOADED_FILE` before extraction. * To avoid that, you could open the terminal and do ```shell - curl -OL https://github.com/light-tech/ROS2-On-iOS/releases/download/humble-1.2/deps_macOS.tar.xz \ - -O https://github.com/light-tech/ROS2-On-iOS/releases/download/humble-1.2/ros2_macOS.tar.xz \ - -O https://github.com/light-tech/ROS2-On-iOS/releases/download/humble-1.2/rviz2_macOS.tar.xz \ - -O https://github.com/light-tech/ROS2-On-iOS/releases/download/humble-1.2/moveit2_macOS.tar.xz + baseUrl=https://github.com/light-tech/ROS2-On-iOS/releases/download/humble-1.4 + curl -OL $baseUrl/deps_macOS.tar.xz \ + -O $baseUrl/base_macOS.tar.xz \ + -O $baseUrl/rviz2_macOS.tar.xz \ + -O $baseUrl/moveit2_macOS.tar.xz \ + -O $baseUrl/tutorials_macOS.tar.xz ``` instead. diff --git a/build_deps.sh b/build_deps.sh index 42b3011..73fad36 100755 --- a/build_deps.sh +++ b/build_deps.sh @@ -21,11 +21,12 @@ mkdir -p $depsExtractPath # Location to install dependencies depsInstallPath=$scriptDir/ros2_$targetPlatform/deps -# Root for Python 3.11 to build Boost, change the match the platform such as -# pythonRoot=/Library/Frameworks/Python.framework/Versions/$pythonVersion/ -# if use official Python instead of Homebrew's version on GitHub Action pythonVersion=3.11 -pythonRoot=/Library/Frameworks/Python.framework/Versions/$pythonVersion/ #/usr/local/opt/python@$pythonVersion/Frameworks/Python.framework/Versions/$pythonVersion/ + +# Python path to build Boost, change the match the platform such as +# pythonRoot=/usr/local/opt/python@$pythonVersion/Frameworks/Python.framework/Versions/$pythonVersion/ +# if using Homebrew's Python instead of the official Python. +pythonRoot=/Library/Frameworks/Python.framework/Versions/$pythonVersion/ export PATH=$depsInstallPath/bin:$PATH export PKG_CONFIG=$depsInstallPath/bin/pkg-config diff --git a/fix_hardcoded_paths.sh b/fix_hardcoded_paths.sh index 35a618c..44d2952 100755 --- a/fix_hardcoded_paths.sh +++ b/fix_hardcoded_paths.sh @@ -38,6 +38,10 @@ fixHardCodedPythonEnvPath() { echo "Replacing $hardcodedPythonEnvPath -> $localPythonEnvPath" + # Python scripts + hardcodedFiles+=($(ls $installDir/base/bin)) + hardcodedFiles+=($installDir/moveit2/bin/xacro $installDir/moveit2/lib/controller_manager/spawner $installDir/moveit2/lib/controller_manager/unspawner) + for f in "${hardcodedFiles[@]}"; do confirm "In $f [y/n]? " && sed -i '' "s,$hardcodedPythonEnvPath,$localPythonEnvPath,g" $f done @@ -101,5 +105,5 @@ fixXcodeSDKPath echo "" echo "REMINDERS" -echo "You also need to fix the python3 path in $installDir/base/bin/ros2." +echo "You sometimes need to fix the python3 path in $installDir/base/bin/ros2." echo ""