Please help me with issue I break my neck with..
I work with Xcode 4.5.* and I try to build a library with Build Settings:
Architectures: 32-bit Intel
Valid Architectures: *i386 & x86_64*
But after checking the library details with lipo command I see that the actual library is built only for i386
Now I know this works in Xcode <=4.3 - the library is built for both architectures
Thanks
Roman
Related
I built FFTW on my Apple m1 computer. When I run lipo -info libfftw3.a (which is located in .libs/libfftw3.a). It says it is of architecture ARM64.
In my Xcode I set the build target to 10.11, for backward compatibility.
Now when I add the FFTW library into my Xcode project, it complains:
The linked library 'libfftw3.a' is missing one or more architectures
required by this target: x86_64.
How can I solve this? Do I need to build the library in an Intel device and create a universal library with these two libraries together (using lipo) or what's the right way to solve this?
You can configure it also with this line and it will build x86_64 & arm64 binary.
./configure CFLAGS="-arch arm64 -arch x86_64 -mmacosx-version-min=11.0"
In order to build a static library for both Intel and Apple silicon archictures, I need to build FFTW for both arch individually and then make an universal library. Here is how I do it.
Go to FFTW root folder
Build for Intel arch
./configure --prefix=/path/to/build/folder/lib-intel CFLAGS="-arch x86_64 -mmacosx-version-min=10.11”
make
make install
Build for arm64
./configure --prefix=/path/to/build/folder/lib-arm64 CFLAGS="-mmacosx-version-min=10.11”
make
make install
Make an universal build
lipo -create path/to/build/folder/lib-intel/libfftw3.a path/to/build/folder/lib-intel/libfftw3.a -output libfftw3_universal.a
Include libfftw3_universal.a in the Xcode project
I recently switched my development MacBook from a classic MacBook (32 bit) to a MacBook Air (64 bit). I am trying to open a project that was made on my old MacBook (32 bit) running XCode 4.
The project is a PhoneGap application made in PhoneGap 1.7.0.
My new MacBook Air (64 bit) is running XCode 5.
I imported my developer profiles from my old MacBook to my new MacBook Air. But when I try to run it, I get the following error message.
I have tried changing the my architecture in the build settings to armv7 but still no luck :(
Does anyone know why I'm getting this error and how to fix it?
Thanks
OK so as it turns out, XCode 5 changes the default architecture to armv7 when my application does not support armv7. I am running Cordova 1.7.0 and that version does not have support for armv7 architecture.
Fix architecture issue:
Removed ALL architectures from Build Settings -->
Valid Architecture
Added armv6 to Build Settings --> Valid Architecture
Fix libSystem.B.dylib issue:
Removed /usr/lib/libSystem.B.dylib from Build Settings --> Linking --> Other Linker Flags
Also removed -weak_library from Build Settings --> Linking --> Other Linker Flags
Xcode 5 asks you to build your libraries for the simulator (1) and for iOS (2). You can then merge (3) these into a fat binary which you then link to your main project. I use the same flags as Xcode is using to build your main project (as seen in your screendump).
Expressed in common gnu toolchain variables I do:
1. Building a library for the simulator
CC=clang
IPHONEOS_DEPLOYMENT_TARGET=7.0
PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:$PATH"
CFLAGS="-arch i386 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.0.sdk -mios-simulator-version-min=7.0"
2. Building a library for iOS
CC=clang
IPHONEOS_DEPLOYMENT_TARGET=7.0
PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:$PATH"
CFLAGS="-arch armv7 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk -miphoneos-version-min=7.0"
3. Merging to a fat binary
Choose either of .a or .dylib depending on what you use:
lipo -create "your armv7 lib".a "your simulator lib".a -output "your lib".a
lipo -create "your armv7 lib".dylib "your simulator lib".dylib -output "your lib".dylib
I try to use the library libstk.a (from The Synthesis ToolKit in C++ (STK))in a XCode 4.5.1 application project to build for Standard(32/64 bit Intel) architectures.
I just drop the file libstk.a and stk.h into my project.
First I made the library of stk-4.4.4 following the instructions given in the doc of stk (./configure with --with-core and --enable-debug) and then make in the src directory. It gives the libstk.a file without errors.
In the xcode project, no syntax error, but link errors : undefined symbol for architecture x86_64 for different methods (maybe all) + the same for i386
It looks like libstk.a was not build for i386 or x86_64.
I used command lines to make the library and i am not familiar with this. How can I ensure that the library will be build for i386 and i86_64 archs ? Do I have to do something different to include the library in my project than just drop it in the files list ? I need help !
Use -arch i386 or -arch x86_64 gcc option..
Can you build an OSX program supporting i386, x86_64 and PPC at the same time?
If you use Xcode, you don't have to use lipo, just list those architectures in the Architectures [ARCHS] build setting. Of course, you can't use Xcode 4, as it does not support ppc.
The answer would seem to be yes, you combine them all with the lipo tool.
I have some dylibs to load from python with ctypes. I can load libbass.dylib without problem, but I can't load the self-compiled libmp3lame.dylib. Here is the error I get.
OSError: dlopen(libmp3lame.dylib, 6):
no suitable image found. Did find:
libmp3lame.dylib: mach-o, but wrong
architecture
Then, I inspect the file type of those libs. Here is the result of libbass.dylib:
libbass.dylib: Mach-O universal binary with 2 architectures
libbass.dylib (for architecture i386): Mach-O dynamically linked shared library i386
libbass.dylib (for architecture ppc): Mach-O dynamically linked shared library ppc
And here is the self-compiled one:
libmp3lame.dylib: Mach-O 64-bit dynamically linked shared library x86_64
I did compile the lame library with the install instructions:
./configure
make
make install
I'm new to mac system, here comes the problem: how to build the libmp3lame.dylib so that it supports different architecture I want?
Thanks.
Just run:
CFLAGS="-arch i386 -arch x86_64 -arch pcc" ./configure
For further information, see http://developer.apple.com/library/mac/#technotes/tn2005/tn2137.html