I already posted in StackOverflow but I got no answer. So I'm gonna try here.
I'm using Flutter and I've been trying to build .ipa through Gitlab CI and GitLab Runner that will be running on my MacOS machine. But I hit a dead end with this error
Error (Xcode): Building for 'iOS', but linking in dylib (/Library/Developer/CommandLineTools/SDKs/MacOSX14.0.sdk/usr/lib/libobjc.A.tbd) built for 'macOS macCatalyst zippered(macOS/Catalyst)'
Error (Xcode): Linker command failed with exit code 1 (use -v to see invocation)
Encountered error while archiving for device.
This error unfortunately cannot be reproduced locally, when I ran this code. The build will be successful and produced IPA file normally.
flutter build ipa --release --obfuscate --split-debug-info=build/ios/ipa/debug_symbols --build-number=${CI_JOB_ID:0:8} --export-options-plist ./ios/export.plist
which make it incredibly difficult to debug. I tried searching Google and all it shown are result of people trying to build iOS simulator. Their solution was excluding architecture arm64
which obviously wouldn't work in this case. And I already excluding i386
and armv7
architecture. and somehow my Gitlab CI still tried to build with MacOS library instead.
I'm not sure if this is one of the causes. But I noticed that every time my GitLab Runner CI reach a new stage. This command is automatically declared :
declare -x SDKROOT="/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk"
Maybe it's related? I honestly don't know what to do now.