build : fix libtool call in build-xcframework.sh (#19605)
Run libtool via xcrun like strip and dsymutil, to have proper tool resolution. Signed-off-by: Adrien Gallouët <angt@huggingface.co>
This commit is contained in:
parent
dbb023336b
commit
91ea5d67f2
|
|
@ -43,11 +43,6 @@ COMMON_CMAKE_ARGS=(
|
||||||
-DGGML_OPENMP=${GGML_OPENMP}
|
-DGGML_OPENMP=${GGML_OPENMP}
|
||||||
)
|
)
|
||||||
|
|
||||||
XCODE_VERSION=$(xcodebuild -version 2>/dev/null | head -n1 | awk '{ print $2 }')
|
|
||||||
MAJOR_VERSION=$(echo $XCODE_VERSION | cut -d. -f1)
|
|
||||||
MINOR_VERSION=$(echo $XCODE_VERSION | cut -d. -f2)
|
|
||||||
echo "Detected Xcode version: $XCODE_VERSION"
|
|
||||||
|
|
||||||
check_required_tool() {
|
check_required_tool() {
|
||||||
local tool=$1
|
local tool=$1
|
||||||
local install_message=$2
|
local install_message=$2
|
||||||
|
|
@ -60,9 +55,12 @@ check_required_tool() {
|
||||||
}
|
}
|
||||||
echo "Checking for required tools..."
|
echo "Checking for required tools..."
|
||||||
check_required_tool "cmake" "Please install CMake 3.28.0 or later (brew install cmake)"
|
check_required_tool "cmake" "Please install CMake 3.28.0 or later (brew install cmake)"
|
||||||
check_required_tool "xcodebuild" "Please install Xcode and Xcode Command Line Tools (xcode-select --install)"
|
check_required_tool "xcrun" "Please install Xcode and Xcode Command Line Tools (xcode-select --install)"
|
||||||
check_required_tool "libtool" "Please install libtool which should be available with Xcode Command Line Tools (CLT). Make sure Xcode CLT is installed (xcode-select --install)"
|
|
||||||
check_required_tool "dsymutil" "Please install Xcode and Xcode Command Line Tools (xcode-select --install)"
|
XCODE_VERSION=$(xcrun xcodebuild -version 2>/dev/null | head -n1 | awk '{ print $2 }')
|
||||||
|
MAJOR_VERSION=$(echo $XCODE_VERSION | cut -d. -f1)
|
||||||
|
MINOR_VERSION=$(echo $XCODE_VERSION | cut -d. -f2)
|
||||||
|
echo "Detected Xcode version: $XCODE_VERSION"
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
|
|
@ -260,7 +258,7 @@ combine_static_libraries() {
|
||||||
|
|
||||||
# Since we have multiple architectures libtool will find object files that do not
|
# Since we have multiple architectures libtool will find object files that do not
|
||||||
# match the target architecture. We suppress these warnings.
|
# match the target architecture. We suppress these warnings.
|
||||||
libtool -static -o "${temp_dir}/combined.a" "${libs[@]}" 2> /dev/null
|
xcrun libtool -static -o "${temp_dir}/combined.a" "${libs[@]}" 2> /dev/null
|
||||||
|
|
||||||
# Determine SDK, architectures, and install_name based on platform and simulator flag.
|
# Determine SDK, architectures, and install_name based on platform and simulator flag.
|
||||||
local sdk=""
|
local sdk=""
|
||||||
|
|
@ -333,7 +331,7 @@ combine_static_libraries() {
|
||||||
|
|
||||||
# Platform-specific post-processing for device builds
|
# Platform-specific post-processing for device builds
|
||||||
if [[ "$is_simulator" == "false" ]]; then
|
if [[ "$is_simulator" == "false" ]]; then
|
||||||
if command -v xcrun vtool &>/dev/null; then
|
if xcrun -f vtool &>/dev/null; then
|
||||||
case "$platform" in
|
case "$platform" in
|
||||||
"ios")
|
"ios")
|
||||||
echo "Marking binary as a framework binary for iOS..."
|
echo "Marking binary as a framework binary for iOS..."
|
||||||
|
|
@ -528,7 +526,7 @@ combine_static_libraries "build-tvos-device" "Release-appletvos" "tvos" "false"
|
||||||
|
|
||||||
# Create XCFramework with correct debug symbols paths
|
# Create XCFramework with correct debug symbols paths
|
||||||
echo "Creating XCFramework..."
|
echo "Creating XCFramework..."
|
||||||
xcodebuild -create-xcframework \
|
xcrun xcodebuild -create-xcframework \
|
||||||
-framework $(pwd)/build-ios-sim/framework/llama.framework \
|
-framework $(pwd)/build-ios-sim/framework/llama.framework \
|
||||||
-debug-symbols $(pwd)/build-ios-sim/dSYMs/llama.dSYM \
|
-debug-symbols $(pwd)/build-ios-sim/dSYMs/llama.dSYM \
|
||||||
-framework $(pwd)/build-ios-device/framework/llama.framework \
|
-framework $(pwd)/build-ios-device/framework/llama.framework \
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue