How do I restrict Nativescript to compile for x86_64 only? - nativescript

How do I restrict 'tns build ios' to compile for x86_64 only?
It currently attempts to build my app for both i386 and x86_64. (ARCHS and VALID_ARCHS).
This fails to link plugins that where compiled for x86_64 and arm64 only.

As of NativeScript v5.1.1 it supports 64 bit, so you can do things like target iOS 11.4 in your App_Resources/iOS/build.xcconfig file. Ex:
IPHONEOS_DEPLOYMENT_TARGET = 11.4;

Related

Build FFTW for Apple M1 and the older intel devices

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

CorePlot framework with universal build for Mac Apple Silicon

Is there a way to compile the CorePlot framework as a universal build including arm architectures ?
When I open the project on Xcode 12, I make sure I select Standard Architectures but it doesn't seem to be working. I've test it with the file command on terminal I only get 1 build for x86_64.
Is there a way to check what the $(ARCHS_STANDARD) variable value is ?
CorePlot framework:
https://github.com/core-plot/core-plot
Make sure you're using the code on the release-2.4 branch. Choose "Any Mac (Apple Silicon, Intel)" instead of "My Mac" from the Scheme menu at the top of the window before building the framework.
$ lipo -info (build folder)/CorePlot.framework/Versions/A/CorePlot
Architectures in the fat file: (build folder)/CorePlot.framework/Versions/A/CorePlot are:
x86_64 arm64

linking against dylib built for MacOSX file '/usr/lib/libSystem.B.dylib' for architecture i386

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

Xcode: Library is not build for x86_64 valid architecture

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

Xcode compile for Intel 32-64bit only

I'm trying to compile only for 32bit and 64bit. No matter what I choose in Xcode, I can either compile for 64bit or for 32bit, 64bit and ppc. I don't want ppc at all. Anyone has any idea how to compile for 32 & 64bit only?
Thanks!
In the Architectures setting for the project just set it explicitly to i386 and x86_64 rather than using the preset options.
To compile only for i386 and x86_64 (i.e. Intel) and not PPC, do the following:
Go to Project|Edit Project Settings
Select Build tab
In Architectures, do
not select any of the standard given
options such as Standard (32/64-bit
Universal) as these will always
throw in ppc. Select Other... and
add i386 and x86_64 manually.
In Valid Architectures, make it the same as Architectures (i.e. i386 and x86_64).
Compile. Test with lipo command in shell. (lipo -info test.app/Contents/MacOS/test) It should only say x86_64 i386 for architectures in file.
If that's not the case, then:
Go to Project|Edit Active Target "your app name" and do the same changes you did above, adding i386 and x86_64 manually.
Compile and test with lipo. It should say it's x86_64 i386 only.

Resources