From 669c2f24428f184e2d29d85ce0eb25720efdc397 Mon Sep 17 00:00:00 2001 From: Ashesh Vashi Date: Thu, 30 Jul 2026 12:01:52 +0530 Subject: [PATCH] fix(pkg): resolve otool-classic's real path, bare name isn't on PATH pgadmin4-appbundle-build #115 (macos-arm64) failed even with the otool-classic fallback from 2d17e9e15: otool-classic output: .../build-functions.sh: line 260: otool-classic: command not found otool-classic only exists inside the active Xcode toolchain (/Applications/Xcode.app/.../XcodeDefault.xctoolchain/usr/bin/ otool-classic - the exact path visible in otool's own internal error message), not as a bare command on $PATH. The previous fallback never actually tested whether the real otool-classic binary can open the file - it just failed on a missing command. Resolve the real path via `xcrun -f otool-classic` (falling back to deriving it from `xcode-select -p` if xcrun's lookup is unavailable) and invoke that directly. Not yet verified against a real buildfarm run. --- pkg/mac/build-functions.sh | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/pkg/mac/build-functions.sh b/pkg/mac/build-functions.sh index 178912bd5..0803f0647 100644 --- a/pkg/mac/build-functions.sh +++ b/pkg/mac/build-functions.sh @@ -169,7 +169,7 @@ _build_docs() { } _fixup_imports() { - local TODO TODO_OLD TODO_PYTHON FW_RELPATH LIB LIB_BN OTOOL_OUTPUT + local TODO TODO_OLD TODO_PYTHON FW_RELPATH LIB LIB_BN OTOOL_OUTPUT OTOOL_CLASSIC echo "Fixing imports on the core appbundle..." pushd "$1" > /dev/null || exit @@ -256,8 +256,16 @@ _fixup_imports() { if ! OTOOL_OUTPUT=$(otool -L "${TODO_OBJ}" 2>&1); then echo "WARNING: otool -L failed on: ${TODO_OBJ}" echo "otool output: ${OTOOL_OUTPUT}" - echo "Retrying via otool-classic directly..." - if ! OTOOL_OUTPUT=$(otool-classic -L "${TODO_OBJ}" 2>&1); then + # otool-classic isn't on PATH - it only lives inside the + # active Xcode toolchain (confirmed by a prior failed + # attempt at calling the bare name: "command not found"). + # Resolve its real path the same way Xcode itself does. + OTOOL_CLASSIC=$(xcrun -f otool-classic 2>/dev/null) + if [ -z "${OTOOL_CLASSIC}" ]; then + OTOOL_CLASSIC="$(xcode-select -p)/Toolchains/XcodeDefault.xctoolchain/usr/bin/otool-classic" + fi + echo "Retrying via otool-classic directly (${OTOOL_CLASSIC})..." + if ! OTOOL_OUTPUT=$("${OTOOL_CLASSIC}" -L "${TODO_OBJ}" 2>&1); then echo "ERROR: otool-classic -L also failed on: ${TODO_OBJ}" echo "otool-classic output: ${OTOOL_OUTPUT}" echo "Raw bytes of the path (od -c):"