https://kotlinlang.org logo
#multiplatform
Title
# multiplatform
c

Christian Sousa

04/06/2020, 4:00 PM
Hello guys, is there a way to combine both release and debug
.framework
into one single file? So I wouldn’t need to provide both versions, one for simulator and one for devices. I tried using the following script:
Copy code
# create folder where we place built frameworks
mkdir build
# create folder to store compiled framework for simulator
mkdir build/simulator
# copy compiled framework for simulator into our build folder
cp -r debugFramework/MyLib.framework build/simulator
# create folder to store compiled framework for simulator
mkdir build/devices
# copy compiled framework for simulator into our build folder
cp -r releaseFramework/MyLib.framework build/devices
# create folder to store compiled universal framework
mkdir build/universal
####################### Create universal framework #############################
# copy device framework into universal folder
cp -r build/devices/MyLib.framework build/universal/
# create framework binary compatible with simulators and devices, and replace binary in unviersal framework
lipo -create   build/simulator/MyLib.framework/MyLib   build/devices/MyLib.framework/MyLib   -output build/universal/MyLib.framework/MyLib
# copy simulator Swift public interface to universal framework
cp build/simulator/MyLib.framework/Modules/MyLib.swiftmodule/* build/universal/MyLib.framework/Modules/MyLib.swiftmodule
But it fails with:
fatal error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/lipo: build/simulator/MyLib.framework/MyLib and build/devices/MyLib.framework/MyLib have the same architectures (x86_64) and can't be in the same fat output file
Building universal frameworks
c

Christian Sousa

04/06/2020, 4:10 PM
Yeah, I saw that, but doesn’t it just generate a debug fat framework?
k

Kris Wong

04/06/2020, 4:43 PM
it generates whatever you would like it to
c

Christian Sousa

04/06/2020, 5:58 PM
using the following:
Copy code
iosArm64.binaries.getFramework("DEBUG"),
            iosX64.binaries.getFramework("DEBUG"),
            iosArm64.binaries.getFramework("RELEASE"),
            iosX64.binaries.getFramework("RELEASE")
gets me this:
Copy code
ERROR: This fat framework already has a binary for architecture `arm64` (debugFramework for target `ios`)
k

Kris Wong

04/06/2020, 6:12 PM
oh you are literally trying to put both debug and release for both archs into one framework
is that something you normally do on iOS?
c

Christian Sousa

04/06/2020, 6:13 PM
nevermind my last question, just realized that it’s just stupid trying to do something like that.
5 Views