-
Notifications
You must be signed in to change notification settings - Fork 0
fix(services): disable macOS ollama agent and fix local-binaries linker #1279
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -4,6 +4,15 @@ | |||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| set -euo pipefail | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| # Ensure the linker can find clang_rt on macOS (Xcode clang version may differ | ||||||||||||||||||||||||||
| # from the version some Rust crates hard-code in their build scripts). | ||||||||||||||||||||||||||
| if [ "$(uname)" = "Darwin" ]; then | ||||||||||||||||||||||||||
| CLANG_LIB="$(echo /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/*/lib/darwin)" | ||||||||||||||||||||||||||
| if [ -d "$CLANG_LIB" ]; then | ||||||||||||||||||||||||||
|
Comment on lines
+10
to
+11
|
||||||||||||||||||||||||||
| CLANG_LIB="$(echo /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/*/lib/darwin)" | |
| if [ -d "$CLANG_LIB" ]; then | |
| # Use the active Xcode toolchain and pick the highest clang version's darwin lib dir. | |
| XCODE_PATH="$(xcode-select -p 2>/dev/null || true)" | |
| if [ -n "$XCODE_PATH" ]; then | |
| CLANG_LIB="$(ls -d "$XCODE_PATH"/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/*/lib/darwin 2>/dev/null | sort -V | tail -n 1 || true)" | |
| else | |
| CLANG_LIB="" | |
| fi | |
| if [ -n "${CLANG_LIB:-}" ] && [ -d "$CLANG_LIB" ]; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This implementation has a couple of robustness issues:
- Hardcoded Xcode Path: The path
/Applications/Xcode.appis hardcoded. It's better to usexcode-select -pto find the developer directory dynamically, as Xcode can be installed in other locations. - Unsafe Glob Expansion: The command
echo ...*...is not safe. If the*glob expands to multiple directories (e.g., multiple clang versions installed),$CLANG_LIBwill contain a space-separated string of paths, and theif [ -d "$CLANG_LIB" ]test will fail with a "too many arguments" error.
Here is a more robust implementation that addresses both points by using xcode-select and handling glob expansion with an array.
| CLANG_LIB="$(echo /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/*/lib/darwin)" | |
| if [ -d "$CLANG_LIB" ]; then | |
| export LIBRARY_PATH="${CLANG_LIB}${LIBRARY_PATH:+:$LIBRARY_PATH}" | |
| fi | |
| XCODE_DEV_PATH="$(xcode-select -p 2>/dev/null)" | |
| if [ -n "$XCODE_DEV_PATH" ]; then | |
| # Use an array to safely handle glob expansion and take the first result. | |
| CLANG_LIB_PATHS=("$XCODE_DEV_PATH"/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/*/lib/darwin) | |
| if [[ ${#CLANG_LIB_PATHS[@]} -gt 0 && -d "${CLANG_LIB_PATHS[0]}" ]]; then | |
| export LIBRARY_PATH="${CLANG_LIB_PATHS[0]}${LIBRARY_PATH:+:$LIBRARY_PATH}" | |
| fi | |
| fi |
Uh oh!
There was an error while loading. Please reload this page.