I have an iOS project that has iOS 6.0 as a deployment target. It builds fine both under Xcode and xcodebuilder (necessary for CI). However the client now wants the project to only be available for users who have iOS7+ installed.
No problem, I'll just increase the deployment target number right? Wrong!
Under Xcode the project continues to compile just fine. Under xcodebuild however, the project fails to compile with lots of errors like this:
Undefined symbols for architecture armv7:
"std::string::_Rep::_S_empty_rep_storage", referenced from: in drmNativeInterface
It's using Adobe Primetime
and drmNativeInterface
is part of that.
To help isolate the problem I've created a brand new, single-screen project and performed the following changes:
Added the drmNativeInterface
framework and the two Apple-supplied dependencies that are required for the project to build in Xcode, MediaPlayer
and AVFoundation
to "Link Binary with Libraries"
. The Primetime documentation lists other dependencies as well but it makes no difference if I add those - these are the only 2 that are needed for a successful build under Xcode.
Replaced the valid archs "arm64 armv7 armv7s"
with "armv6 armv7 armv7s"
(even though drmNativeInterface apparently contains i386, x86_64, armv7s and arm64 slices, even Xcode won't compile the project unless I switch arm64 for armv6).
Set "Build Active Architecture Only"
to NO for both configurations.
And finally, added "-lstdc++ -ObjC -all_load"
to "Other Linker Flags"
.
Other than those few steps above, the project is stock single-screen: no code has been added.
Xcode will compile it but xcodebuild will not. For xcodebuild to compile it I have to switch the deployment target to 6.0 which defeats the client's request.
The CI xcodebuild command contains a few params but here's the minimised command I'm using for this test project:
xcodebuild -project
"MyProject.xcodeproj"
-scheme"MyProject"
I've tried adding FRAMEWORK_SEARCH_PATHS
, HEADER_SEARCH_PATHS
and ALWAYS_SEARCH_USER_PATHS
params in case xcodebuild was simply unable to use the paths contained within the project file but that made no difference.
If I remove the drmNativeInterface
framework from the project - leaving the 2 Apple-based dependencies alone - the project compiles just fine for both Xcode and xcodebuild. But obviously this isn't a solution because I need that framework!
Does anyone have any idea what could be causing this or how to fix it?
**NB: **
There are a lot of questions on SO where projects will build in Xcode and not in xcodebuilder, but I couldn't find any where a project will build in xcodebuilder just fine for one deployment target and not for another.
Thanks in advance.
Linking the libstdc++ library (in this case, libstdc++6.dylib to be exact) fixed the problem.