I have an Xcode Project, it is a Static Library Project. Now I need to make a Unity Plugin for Mac, so I have to convert my static library project to .bundle, I added a new Target in [macOS] -> [Bundle] (my Xcode version is 8.1) I named it as "AoneSDK". The source code from my static library had been compiled it "AoneSDK".
when I build "AoenSDK", the build failed. Error is
ld:framework not found OpenGLES for architecture x86_64
The "AoneSDK" is a bundle project , so it just supports Mac to build. And I am sure I didn't use OpenGELS.framework at all !!!
In short words your static library is not compiled for simulator (x86_64 architecture) try running on a device.
Open a terminal use lipo -info /path/to/your/library-file if it doesn't list x86_64 then this library is not compiled for simulatore find a fat library which is compiled for simulator (x86_64 architecture).
Related
Is there a way to convert a library that is built for macOS to a library that I can use in my iOS project. I'm getting an error in my app that follows:
/Users/edwardpizzurro/Desktop/LibreriasAlternativas/LibreriasAlternativas.xcodeproj Building for iOS, but the linked library 'libsndfile.a' was built for macOS.
In general, it's not possible and you have to rebuild your library specifying iOS architecture.
To get more info about your library, run
lipo -info libsndfile.a
It'll give you architectures like armv7 armv7s i386 x86_64 arm64. A default architecture for iOS is arm64, while for MacOS it's x86_64 (we are not speaking of new M1 hardware). So most probably for your libsndfile.a you'll get only x86_64.
This will mean you need to build libsndfile by yourself.
Here are releases of this lib, there's no arm64 here: https://github.com/libsndfile/libsndfile/releases
So you have to donwload the repo: https://github.com/libsndfile/libsndfile
And use smth like Autotools to build it for your desired architecture.
A rough example of what you'll have to do it here: Can't cross compile C library for arm (iOS)
While it's quite specific for each library.
I have a project in Unity3d that uses an iOS native plugin that I made in Xcode.
I use Unity3d v4.6.2 with Scripting Backend option in IL2CPP and Architecture option in "Universal"
Whem I run the project on my ipod5, it works but when I want to archive it, I have errors links with my library:
Undefined symbols for architecture arm64
with a warning that says
file was built for archive which is not the architecture being linked (arm64)
My library configuration is the following
http://imgur.com/AvbBYFo
and my list of iOS simulators is
http://imgur.com/XlSojzT
I try them all and none works
When I run the command
lipo -info mylib.a
I see the following information
input file mylib.a is not a fat file
Non-fat file: mylib.a is architecture: x86_64
I need my project to all the architecture, but do not know what else to configure.
Thanks for your help
I am building a framework first to use in my ios simulator. However I get this error when importing it into the main project:
file was built for arm64 which is not the architecture being linked
(x86_64)
Here is the build info of my framework:
UPDATE:
I created a universal framework using this technique: https://medium.com/#syshen/create-an-ios-universal-framework-148eb130a46c but I'm still getting the error
UPDATE: Results from running file on the binary:
hunterp$ file dinkle
dinkle: Mach-O universal binary with 2 architectures
dinkle (for architecture x86_64): Mach-O 64-bit dynamically linked shared library x86_64
dinkle (for architecture arm64): Mach-O 64-bit dynamically linked shared library
I was incorrectly copying the binary framework and using an old one from before I changed it into a universal.
To create framework and convert .h file into .a fat file. Compile your project with simulator target and device target ,after these two tasks you have to join to make universal file with shell.
I have a static library lipo'd for iOS and OS X with 5 architectures (x86_64, i386, armv7, armv7s, arm64).
The x86_64 architecture was built using the macosx SDK
The i386 architecture was built using the iphonesimulator SDK
The ARM architectures were built using the iphoneos SDK
When I try to link the resulting library in an example App it works when building for a device or for a 32-bit iOS simulator target. But when I try to build it for a 64-bit iOS simulator target I get a linker error:
ld: framework not found CoreServices for architecture x86_64
If I remove the x86_64 slice from the fat library it works for all devices and simulators.
I assume it's because the linker prefers the x86_64 architecture if it's there for the 64-bit simulator. But since it was compiled and linked for the macosx SDK it has the OS X dependencies somehow encoded.
I tried adding a second x68_64 slice for the iphonesimulator SDK but lipo won't let me. Also I tried to find a way to make the simulator use the i386 architecture even for 64-bit builds, but so far no luck.
If absolutely necessary I can create 2 binaries which would solve this but I would really prefer having them in one file. Is there a way to achieve this?
I solved it by only building it for the iOS device and simulator. The 64bit slice of the iOS Simulator SDK equally works for iOS and OS X targets, provided you don't need any other frameworks than what's shared between OS X and iOS (Foundation only in my case).
Project and Pods:
Build Settings ---> Link Frameworks Automatically change YES to NO, and rebuild static library ,it is work!
I had one problem during building application in the recent Xcode 5.1. Compilation fails with "Undefined symbols for architecture x86_64" error.
I build my project with Valid Architecture: armv7, armv7s and arm64. After switch to the newest environment (Xcode) I rebuild libzbar.a library in the same architecture ( I have done it based on solution found at: Linker Error in Xcode-5)
Maybe somebody also had same problem and finally he had solved it, please share with solution:)
I had the same problem and I solved that way:
Remove the reference of folder ZBarSDK from your project.
Download the version for armv7, arm7s and armv64 from this link .
Replace the older folder for the new, (Save a copy in case )
Add the new folder into your project.
Clean the project and Build.
Let me know if it works for you.
Recompile ZBar for iphone 6
Steps
Download the source code (you must have Mercurial for mac):
Open Terminal and run following commands
a. hg clone http://zbar.hg.sourceforge.net:8000/hgroot/zbar/zbar
b. cd zbar
c. hg checkout iPhoneSDK-1.3.1
d. open iphone/zbar.xcodeproj
In the xcode project edit the "libzbar" scheme and select Release in Build configuration
Go to Build Settings set following Architectures
a. Architectures - >Standard architectures(armv7,armv72,arm64)
b. Valid Architectures -> arm64,armv7 armv7s
Compile libzbar for device AND for simulator, here the configuration:
Find the compiled libzbar.a and go in the folder using Teminal.app,
In My Case : /Users/kappe/Library/Developer/Xcode/DerivedData/zbar-gyozyrpbqzvslmfoadhqkwskcesd/Build/Products
In this folder you you should have two sub folder Release-iphoneos and Release-iphonesimulator
using xcode command line tools build your universal lib:
lipo -create Release-iphoneos/libzbar.a Release-iphonesimulator/libzbar.a -o libzbar.a
Now you can use the libzbar.a created, both in device and simulator.
Ref: xcode 5.1 - Undefined symbols for architecture x86_64 (zbar)
Make sure your libzbar.a contains all the architectures you needed in your project. You may need following to build for device and simulator:
armv7 armv7s arm64 i386 x86_64
You can test this using following command:
xcrun -sdk iphoneos lipo -info libzbar.a
for me: xcode 6, iphone 6 works the fpauer's method!
the way:
Remove the reference of folder ZBarSDK from your project.
Download the version for armv7, arm7s and armv64 from this link .
Replace the older folder for the new, (Save a copy in case )
Add the new folder into your project.
Clean the project and Build.
I had same problem yesterday and I was finally able to build with 64-bit simulator.
After the link you tried, I replaced the library and all the header files. but it wasn't enough. Then I also unlink the libzbar.a from Link Binary With Libraries on Bulid Phases and re-add the library. Then it was working.
Let me know if it works for you.
I was on the ZBar train as well for quite a while dealing with these issues since they have not been updating the SDK. Luckily if your app only has to support iOS7 onwards (which most iOS users are on now!) there is now QR/Bar Code reading support in AVFoundation so you can build your own reader very easily. Check out this tutorial:
http://www.appcoda.com/qr-code-ios-programming-tutorial/
Then bask in the beauty that is a totally Apple supported QR Code reader!