After compilation libquickfix.dylib, and link it in Xcode with my programm, error is:
ld: warning: ignoring file /Users/marekbaranowski/jmbSoftware/_NOM2/
QuickFIX/libquickfix.dylib, file was built for x86_64
which is not the architecture being linked (i386):
/Users/marekbaranowski/jmbSoftware/_NOM2/QuickFIX/libquickfix.dylib
How to change platform to i386, armv7 or both in one dylib?
Related
I have an M1 MacBook Air.
When building for a simulator in Xcode, I am seeing the following warnings and errors:
ld: warning: ignoring file /Users/kon/Library/Developer/Xcode/DerivedData/InvisibleComputersApp-hktlnhvaoskvxkcdhnahydmbodzw/Build/Products/Debug-iphonesimulator/GoogleSignIn.o, building for iOS Simulator-x86_64 but attempting to link with file built for unknown-arm64
ld: warning: ignoring file /Users/kon/Library/Developer/Xcode/DerivedData/InvisibleComputersApp-hktlnhvaoskvxkcdhnahydmbodzw/Build/Products/Debug-iphonesimulator/AppAuth.o, building for iOS Simulator-x86_64 but attempting to link with file built for unknown-arm64
ld: warning: ignoring file
/Users/kon/Library/Developer/Xcode/DerivedData/InvisibleComputersApp-hktlnhvaoskvxkcdhnahydmbodzw/Build/Products/Debug-iphonesimulator/GTMAppAuth.o, building for iOS Simulator-x86_64 but attempting to link with file built for unknown-arm64
ld: warning: ignoring file /Users/kon/Library/Developer/Xcode/DerivedData/InvisibleComputersApp-hktlnhvaoskvxkcdhnahydmbodzw/Build/Products/Debug-iphonesimulator/AppAuthCore.o, building for iOS Simulator-x86_64 but attempting to link with file built for unknown-arm64
ld: warning: ignoring file /Users/kon/Library/Developer/Xcode/DerivedData/InvisibleComputersApp-hktlnhvaoskvxkcdhnahydmbodzw/Build/Products/Debug-iphonesimulator/GTMSessionFetcherCore.o, building for iOS Simulator-x86_64 but attempting to link with file built for unknown-arm64
Undefined symbols for architecture x86_64:
"_OBJC_CLASS_$_GIDConfiguration", referenced from:
objc-class-ref in GlobalState.o
"_OBJC_CLASS_$_GIDSignIn", referenced from:
objc-class-ref in GoogleAuthService.o
objc-class-ref in GoogleRefreshTokenService.o
objc-class-ref in InvisibleComputersAppApp.o
"_OBJC_CLASS_$_GIDSignInButton", referenced from:
objc-class-ref in LoginView.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
This sounds to me like Xcode is somehow trying to build an x86 binary? Why is it even trying to do that, aren't the simulators arm based on the M1 Macs?
How can I
I spent 3 days on this issue beating my head against the wall. Today, I finally cracked it and understood the problem.
I am working on a highly modular project with ~100 frameworks. When migrating from the X86_64 (Intel) architecture to arm64 (M1) I was always getting this error:
Could not find module 'MyModule' for target 'x86_64-apple-ios-simulator'; found: arm64-apple-ios-simulator, at /my/path/
when building natively on M1.
The reason is that the simulator runs natively on M1 but the simulated app runs still under Intel. That's why the x86_64 architecture was built in the first place.
The two architectures are now beating each other as the simulator is arm64 while the simulated app is X86_64. Removing the arm64 architecture for the pods and project settings fixed the issue and I can build the project entirely on M1 now.
Here are screenshots from the ActivityMonitor. AchieveMe is the app running in the simulator.
To fix the problem for Cocoapods you can simply do:
target.build_configurations.each do |config|
config.build_settings['EXCLUDED_ARCHS[sdk=iphonesimulator*]'] = 'arm64'
end
I am using XcodeGen and there it can simply be added under debug configuration as:
YourSettings
...
configs:
Debug:
EXCLUDED_ARCHS[sdk=iphonesimulator*]: arm64
Best of luck, I hope it helps. I can sleep in peace now.
You can try opening Xcode with "Open using Rosetta" check ON.
Quit Xcode
Go to your Applications folder
Right click Xcode then select "Get Info"
Check "Open using Rosetta"
Open Xcode
If you have a dependency that does not support arm64, you can tell the build system to skip arm64 (this building x86_64) by adding "arm64" to the list of excluded architectures (EXCLUDED_ARCHS) in your targets' build settings.
I'm quite new to Xcode and Iphone development and ran into the following problem:
I opened a new project and added *.h and a *.a files (which I recived from a certain device vendor).
I get the following warning:
ld: warning: ignoring file /Users/udi/Desktop/Xcode/Xcode Projects/Scosche/libmyTrekSDK_armv7.a, missing required architecture i386 in file /Users/udi/Desktop/Xcode/Xcode Projects/Scosche/libmyTrekSDK_armv7.a (2 slices)
If I ignore the warning, and try to instanciate the class that is given to me in the header file, I get these errors:
ld: warning: ignoring file [Path/FileName.a], missing required architecture i386 in file [Path/FileName.a] (2 slices)
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_HRMonitor", referenced from:
objc-class-ref in ViewController.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see
invocation)
I've checked the Framework Search Pathes (as mantioned in many other posts) and it clear.
More info:
I'm Using Xcode 4.6.1
The files are currently located at project's root folder.
I'm using a Single View Application tamplate.
Appreciate any help
This warning means that you're trying to use library made for Device (ARM) with your Simulator (i386).
You can use this terminal command to create a universal library:
lipo -create lib_arm.a lib_i386.a -output lib_universal.a
More info about lipo command here.
Change your target's "Build Settings > Build Active Architectures Only" to "No"
This is doing the same thing as Dmitry Zhukov's answer but doing it thru Xcode instead of going around its back.
If you are working with a 3rd party code, keep in mind that some SDKs may not work on the simulator. The same build error I have encountered vanished, when I ran the project on the device.
So I have an iPhone static library that I am trying to build. I've got the script that was used in this question (http://stackoverflow.com/questions/3520977/build-fat-static-library-device-simulator-using-xcode-and-sdk-4), but the issue I've hit is that I'm seemingly still unable to successfully build the static library for the simulator. When I build in the static library project, I get the follow warnings:
warning: no rule to process file '$(PROJECT_DIR)/GDInAppStore/GDInAppStore.m' of type sourcecode.c.objc for architecture i386
warning: no rule to process file '$(PROJECT_DIR)/GDInAppStore/SKProduct+priceAsString.m' of type sourcecode.c.objc for architecture i386
warning: no rule to process file '$(PROJECT_DIR)/GDInAppStore/VerificationControllerPBK.m' of type sourcecode.c.objc for architecture i386
I believe this issue is causing the problem that is leading to the universal library I get from the build script causing this error in my other project
ld: warning: ignoring file /Users/abotkin/Projects/Static Libraries/GDInAppStore/libGDInAppStore.a, missing required architecture i386 in file
"_OBJC_CLASS_$_GDInAppStore", referenced from:
objc-class-ref in SubscribeNowInAppController.o
ld: symbol(s) not found for architecture i386
I'm using Xcode 4.3.2 and have set the flags in the static library Xcode project so that i386 is included in the Architecture and Valid Architectures. Any tips?
Make sure you are building for the simulator if you are compiling for i386. Basically, your arch parameter has to match your sdk parameter. i.e.
xcodebuild -project proj.xcodeproj -arch armv64 -sdk iphoneos8.1 build
and
xcodebuild -project proj.xcodeproj -arch i386 -sdk iphonesimulator8.1 build
I was able to do a workaround this issue by using Karl's iOS Universal Framework that he mentioned in the other topic here https://stackoverflow.com/a/5721978/497718
That said, if anyone could point me into what I may have been doing wrong in using the script in that same topic, I'd love to learn how to do it the right way.
With Xcode 6, Apple has added iOS framework support to their build tools.
Using Apple's framework target for all new projects, as it is less hacky and is supported by Apple themselves.
I'm at a lost at this point. :(
The application is work fine iPhoneSimulator.
But when I try to build on Device(iphone4.3.1)(XCode4),
I get the following error:
When I choose Standard(armv6 armv7) to build:
ld: warning: ignoring file /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.3.sdk/usr/lib/libxml2.dylib, file was built for unsupported file format which is not the architecture being linked (armv6)
ld: warning: ignoring file /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.3.sdk/usr/lib/libxml2.2.dylib, file was built for unsupported file format which is not the architecture being linked (armv6)
ld: warning: ignoring file /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.3.sdk/usr/lib/libz.1.2.3.dylib, file was built for unsupported file format which is not the architecture being linked (armv6)
ld: warning: ignoring file /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.3.sdk/Developer/Library/PrivateFrameworks/DTMessageQueueing.framework/DTMessageQueueing, file was built for unsupported file format which is not the architecture being linked (armv6)
ld: warning: ignoring file /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.3.sdk/Developer/Library/PrivateFrameworks/UIAutomation.framework/UIAutomation, file was built for unsupported file format which is not the architecture being linked (armv6)
ld: warning: ignoring file /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.3.sdk/usr/lib/libSystem.dylib, file was built for unsupported file format which is not the architecture being linked (armv6)
ld: in /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.3.sdk/usr/lib/libobjc.A.dylib, file was built for unsupported file format which is not the architecture being linked (armv6) for architecture armv6
When I choose Optimized(armv7) to build:
ld: warning: ignoring file /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.3.sdk/usr/lib/libxml2.dylib, file was built for unsupported file format which is not the architecture being linked (armv7)
ld: warning: ignoring file /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.3.sdk/usr/lib/libz.1.2.3.dylib, file was built for unsupported file format which is not the architecture being linked (armv7)
ld: warning: ignoring file /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.3.sdk/Developer/Library/PrivateFrameworks/DTMessageQueueing.framework/DTMessageQueueing, file was built for unsupported file format which is not the architecture being linked (armv7)
ld: warning: ignoring file /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.3.sdk/Developer/Library/PrivateFrameworks/UIAutomation.framework/UIAutomation, file was built for unsupported file format which is not the architecture being linked (armv7)
ld: warning: ignoring file /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.3.sdk/usr/lib/libxml2.2.dylib, file was built for unsupported file format which is not the architecture being linked (armv7)
ld: warning: ignoring file /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.3.sdk/usr/lib/libSystem.dylib, file was built for unsupported file format which is not the architecture being linked (armv7)
ld: in /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.3.sdk/usr/lib/libobjc.A.dylib, file was built for unsupported file format which is not the architecture being linked (armv7) for architecture armv7
collect2: ld returned 1 exit status
Command /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/llvm-gcc-4.2 failed with exit code 1
Can anyone please provide any pointers on how to resolve this issues.
How can I resolve the unsupported file format which is not the architecture being linked (armv6) for architecture armv6 errors.
Any help would be greatly appreciated.
Thank you!!!
Remove the libraries mentioned and re-add them using the '+' button in 'Link Binary with Libraries' section of your target's Build Phases tab.
I was able to resolve a similar problem but check/adding entries to Search Path segment of the Build Settings for the app.
The Framework Search Paths item contains old references to 4.3 SDK paths that were probably correct before I upgrade to SDK 5.0.
Whether necessary or not, I added entries under Debug for IOS Simulator 5.0 and Any IOS SDK that distinguished between the path through iPhoneSimulator.Platform and iPhoneOS.Platform directories.
i get this error when i am trying to use my compiled static library in my iphone aplication. I have no frigging idea what's wrong.
ld: warning: ignoring file /Users/rw/Library/Developer/Xcode/DerivedData/MSTicketingSaaS-gkznscznevvifjesoapzgwycbces/Build/Products/Debug-iphoneos/libMylib.a, file was built for archive which is not the architecture being linked (armv6)
Undefined symbols for architecture armv6:
"_OBJC_CLASS_$_AppData", referenced from:
It worked before upgrading to Xcode 4.0.2
I added the i386 architecture and now it compiles for the simulator but NOT for the device.
Check with lipo which is the architecture your lib has been built for:
lipo -info <path_to_lib>
If it does not contain "arm6" then you should go back to the library project and build it for the proper architecture. If this does not help, please, give more detail about the structure of your project(s).