2

In Xcode 10 while using new build system, if your xcconfig contains any conditional variable assignment, xcodebuild will generate an error saying "illegal instruction 4". For example:

FOO[sdk=macosx*] = buzz

After removing "[sdk=macosx*]", xcodebuild works as charm.

I went through the Xcode 10 build system patch notes, Apple wasn't saying anything about dropping support for conditional variable assignment. So this is supposed to be a bug in xcodebuild i guess?

By the way, the issue also has been seen in new build system in Xcode 9.4 (while since new build system is not default in Xcode 9.4, you have to manually setting the project setting.)

Kai
  • 155
  • 1
  • 7
  • Xcode 10 accepts from IDE the conditional assignment based on the sdk. As a workaround. see [this question's answers](https://stackoverflow.com/questions/51205221/how-can-i-use-the-legacy-build-system-with-xcode-10s-xcodebuild) for a way to still use the legacy/old build system in command-line. – MathPlayer Jun 12 '19 at 06:10

1 Answers1

0

According to this section in the official documentation, your configuration should work, so I would say it is definitely a bug in the build system.

You can consider one or both of the following workarounds:

  • Force the old build system in command-line, subject already addressed by this question's answers.
  • Build the variable dynamically. For example, the following configuration uses PLATFORM_NAME to export FOO as buzz when targeting a real device and bar when targeting a simulator:
FOO_iphoneos = buzz
FOO_iphonesimulator = bar
FOO = $(FOO_$(PLATFORM_NAME))
MathPlayer
  • 194
  • 3
  • 20