I have a framework that uses a dylib file that is only compiled for armv7, armv7s and arm64. When I build it in Xcode, it compiles fine in both Debug and Release configurations. But when I try to get it to compile into the main app using Carthage, Carthage tries to build it twice - once using SDKROOT = iphoneos10.3 and again using SDKROOT = iphonesimulator10.3. This is even when I use the --platform ios flag. When it compiles for iphonesimulator10.3 it crashes, obviously.
Is there a way I can stop Carthage from building for the simulator?
Related
I have a project cordova with the MFP plugin & while compile or build on the simulator the Xcode project in Xcode ver 12.2 getting below error.
Building for iOS Simulator, but linking in dylib built for iOS, file '.../Frameworks/IBMMobileFirstPlatformFoundation.framework/IBMMobileFirstPlatformFoundation' for architecture arm64
Go to the Build Settings of the project, locate the VALID_ARCHS property of User-Defined, and add x86_64. As shown below.
I have updated Xcode to 12.0 in order to test React Native project on iOS 14.0.
When I build the project I'm getting the following error. I tried Excluding arm64 architecture from Debug, tried removing bitcode from debug.
in
~/ios/Pods/OpenSSL-Universal/ios/lib/libcrypto.a(cryptlib.o),
building for iOS Simulator, but linking in object file
(~/ios/Pods/OpenSSL-Universal/ios/lib/libcrypto.a(cryptlib.o))
built for iOS, file
'~/ios/Pods/OpenSSL-Universal/ios/lib/libcrypto.a'
for architecture arm64
Getting linker error in Xcode 12 when I am trying to build my large iOS app (hybrid, swift+objc). The application is building fine for real device, but It gives linker error when I am trying to run in Simulator directly with Debug configuration.
I have tried all possible solutions in other post here, but unfortunately it didn't work. Although the error in other post is different. I have checked Build for active architectures only to YES for Debug configs and NO for Release configs.
Other post error,
building for iOS Simulator, but linking in object file built for iOS, for architecture arm64
My error,
building for iOS Simulator, but linking in object file built for macOS, file for architecture x86_64
How can I resolve this issue? I need to run in both iOS real device and Simulator.
Wherever you got your library you should request the library that is compiled for iOS Simulator, not for macOS, although they have the same binary architectures that are returned via lipo -info <file>.
You can verify that your static (.a) or dynamic library (.dylib) is compiled for iOS Simulator using this command:
otool -l <path-to-library> | grep platform
The output means the following:
platform 7 - iOS Simulator
platform 6 - Mac Catalyst
platform 4 - watchOS
platform 2 - iOS
platform 1 - macOS
Here is the full definition of the enum for platform.
Try to add x86_64 in VALID_ARCHS in the User-defined section in Build Settings.
I have searched high and low but I am unable to archive an iOS app correctly. The app runs perfectly on the simulator and physical devices but I am not able to submit the app to the AppStore because the app is a Generic Xcode Archive instead of an iOS App.
What I have done:
Skip install is NO for the main project target
Skip install is YES for Static Library target
Alle Copy Headers are in Project
Installation Directory is /Applications
Target dependencies are empty
update I am not using Cocoapods
Update When I compile using terminal:
xcodebuild -destination generic/platform=iOS
I get the folling error
build/iosvr.build/Release-iphoneos/iosvr.build/Objects-normal/armv7/DistortionRenderer.o iosvr/DistortionRenderer.cpp normal armv7 c++ com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)
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.
You lose the libstdc++6.dylib in Link Binary With Libraries
Just add it like :