which carthage: /usr/local/bin/carthagecarthage version: 0.30.1xcodebuild -version: Xcode 9.4.1Cartfile
github "Alamofire/Alamofire"
Expected outcome
Hello!
I would like to link AlamoFire statically in my project. I have looked into the several PRs which added support for static frameworks, as well as at the updated README (https://github.com/Carthage/Carthage#carthage-0300-or-higher) but this seem to tell me that the Carthage project needs to be setup to support being compiled as a static framework on _their_ side. Indeed, as soon as I do carthage update, the project is downloaded a compiled as a dynamic framework.
In my case I would like to statically integrate this project. It sounds like I should still rely on the "old way" (https://github.com/Carthage/Carthage/blob/master/Documentation/StaticFrameworks.md) but am I missing something?
Thanks!
No, you're correct. You have to change the Mach-O type to static library.
I suggest you fork Alamofire or:
$ carthage update --no-build
$ <run script to change Mach-O type here>
$ carthage build
Are there any drawbacks about using the "old way"?
I have found an acceptable workaround based on the "old way". This doesn't require editing the Checkout project files but just injects an xcconfig:
#!/bin/sh -e
xcconfig=$(mktemp /tmp/static.xcconfig.XXXXXX)
trap 'rm -f "$xcconfig"' INT TERM HUP EXIT
echo "MACH_O_TYPE = staticlib" >> $xcconfig
export XCODE_XCCONFIG_FILE="$xcconfig"
# --no-use-binaries otherwise we can't compile 'em as static frameworks
carthage build --no-use-binaries "$@"
Ah cool! 馃憤
Don't override LD.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Most helpful comment
I have found an acceptable workaround based on the "old way". This doesn't require editing the Checkout project files but just injects an xcconfig: