Skip to content

Commit

Permalink
Add some known Python executable script to fix hardcoded path, update…
Browse files Browse the repository at this point in the history
… documentation
  • Loading branch information
light-tech committed Nov 19, 2022
1 parent 0517530 commit 5b7ec3f
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 15 deletions.
19 changes: 9 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
```
Expand All @@ -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

Expand Down Expand Up @@ -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.

Expand Down
9 changes: 5 additions & 4 deletions build_deps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 5 additions & 1 deletion fix_hardcoded_paths.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 ""

0 comments on commit 5b7ec3f

Please sign in to comment.