I have legacy code that relies on pointers being 32-bit
and want to use xCodeBuild
to build that code from command line
. This doesn't work for some reason. Here's the command I use:
xcodebuild -configuration Debug -arch i386 -workspace MyProject.xcworkspace -scheme MyLib
here's the output I get
[BEROR]No architectures to compile for (ONLY_ACTIVE_ARCH=YES, active arch=x86_64, VALID_ARCHS=i386).
Clearly it's trying to build x86_64
code and failing miserably since I only enabled i386
from VALID_ARCHS
in xCode project settings.
Is there a way to make it understand I don't want a 64-bit
library?
The "build active architecture only" setting causes everything except the current Mac's architecture to be ignored (and the current one is of course valid), hiding the problem. Instead, you should look up a row or two in the settings, and change the "Architectures" setting to "Standard".
If a project includes VALID_ARCHS, the setting is displayed in the User-Defined section of the Build Settings editor.
xcodebuild is a command-line tool that offers the ability to build and test your Xcode projects.
You have to set the ONLY_ACTIVE_ARCH
to NO
if you want xcodebuild
to use the ARCHS
parameters. By passing these parameters, you can force the proper architecture.
xcodebuild ARCHS=i386 ONLY_ACTIVE_ARCH=NO -configuration Debug -workspace MyProject.xcworkspace -scheme MyLib
See this reference for details.
xcodebuild ONLY_ACTIVE_ARCH
xcodebuild ONLY_ACTIVE_ARCH... //or Build Settings -> Build Active Architecture Only -> ONLY_ACTIVE_ARCH
YES
- build binary with a single architecture for a connected device
NO
- build binary for a specific -arch
(valid architectures
aka VALID_ARCHS
) if it was specified or for all the architectures in other cases
The recommendation is to use Yes
for Debug(it save a build time) and No for Release build.
Note: it is safety to run on simulator
To check the version use lipo -info
[About]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With