Skip to content

Commit e927b56

Browse files
ericmigiclaude
authored andcommitted
Build separate speex library for iOS Simulator
The iOS simulator and device targets were both linking against the same libspeex.a (built for iphoneos, platform=2). Xcode 24's linker treats platform mismatches as errors, breaking simulator builds. - Build script now builds for iphoneos, iphonesimulator, and macOS separately using explicit -sdk flags - Gradle config points iosArm64 at lib/ios/ and iosX64/iosSimulatorArm64 at lib/ios-simulator/ - Prebuilt .a files included for all three platforms Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent a47881a commit e927b56

5 files changed

Lines changed: 29 additions & 5 deletions

File tree

library/build.gradle.kts

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,16 +56,27 @@ kotlin {
5656
}
5757
}
5858
}
59+
iosArm64 {
60+
val root = project.rootDir
61+
compilations.getByName("main") {
62+
cinterops {
63+
val speex by creating {
64+
extraOpts("-libraryPath", "${root}/speex/lib/ios")
65+
compilerOpts.add("-I${root}/speex/include")
66+
compilerOpts.add("-I${root}/speex/source/include")
67+
}
68+
}
69+
}
70+
}
5971
listOf(
6072
iosX64(),
61-
iosArm64(),
6273
iosSimulatorArm64()
6374
).forEach {
6475
val root = project.rootDir
6576
it.compilations.getByName("main") {
6677
cinterops {
6778
val speex by creating {
68-
extraOpts("-libraryPath", "${root}/speex/lib/ios")
79+
extraOpts("-libraryPath", "${root}/speex/lib/ios-simulator")
6980
compilerOpts.add("-I${root}/speex/include")
7081
compilerOpts.add("-I${root}/speex/source/include")
7182
}

speex/build-ios.sh

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,19 @@
11
#!/usr/bin/env sh
2-
xcodebuild -alltargets
2+
set -e
3+
4+
# Build iOS device
5+
xcodebuild -target speex -sdk iphoneos -configuration Release
6+
7+
# Build iOS simulator
8+
xcodebuild -target speex -sdk iphonesimulator -configuration Release
9+
10+
# Build macOS
11+
xcodebuild -target speex-macos -configuration Release
12+
313
mkdir -p lib/ios
14+
mkdir -p lib/ios-simulator
415
mkdir -p lib/macos
5-
mv build/Release-iphoneos/libspeex.a lib/ios/libspeex.a
6-
mv build/Release/libspeex-macos.a lib/macos/libspeex.a
16+
17+
cp build/Release-iphoneos/libspeex.a lib/ios/libspeex.a
18+
cp build/Release-iphonesimulator/libspeex.a lib/ios-simulator/libspeex.a
19+
cp build/Release/libspeex-macos.a lib/macos/libspeex.a

speex/lib/ios-simulator/libspeex.a

810 KB
Binary file not shown.

speex/lib/ios/libspeex.a

400 KB
Binary file not shown.

speex/lib/macos/libspeex.a

813 KB
Binary file not shown.

0 commit comments

Comments
 (0)