Not able to build XERCESS 3.2.3 on MAC for arm64 configuration - xml-parsing

I am trying to build xerces 3.2.3 for ARM64 configuration on MAC 10.15 using XCODE 12.2 but it fails with error that **
This header is for x86 only
This is coming from Cupid.h
can Xerces-c 3.2,3 build on MAC for ARM64 configuration?

use aarch64
export MACOSX_DEPLOYMENT_TARGET=10.15
./configure CFLAGS="-arch arm64" CXXFLAGS="-arch arm64" --host aarch64

Related

Build C Library from makefile for ios and not macos

I have a makefile that builds some C files and if I run it on an M1 mac the resulting library has the architecture arm64 which I thought it what is necessary for them to compile with an Xcode project for iOS. I discovered I can run the command otool -l libf2c.a | grep platform which should tell me what it was compiled for and in my case it returns platform1 which indicates macOS. Based on this, I think I need a value of platform2 for iOS.
The reason this is an issue is because in Xcode I get the error ld: building for iOS, but linking in object file built for macOS, file '/Users/e.../close.o' for architecture arm64.
Based on what I have been researching it seems iOS and macOS have the same architecture (arm64) but are a different 'platform'? But, I am not sure how the platform is determined. Is there some setting in my makefile I need to specify the platform? I am assuming that if I am able to get the platform to be iOS then Xcode will cooperate and be able to build the library I have generated.
The preferred way to compile for iOS via command line would probably be to use the xcrun command. This will allow you to specify the correct SDK for the platform you actually want to run on. For example:
prompt$ xcrun --sdk iphoneos --toolchain iphoneos clang -c test.c -o test.o -arch arm64
prompt$ otool -v -l test.o | grep platform
platform IOS
TL;DR: change your compiler invocation from plain clang to xcrun --sdk iphoneos --toolchain iphoneos clang.

OpenSSL FIPS capable library for iOS arm64 architecture

I am successfully generating OpenSSL FIPS capable library for iOS armv7 architecture by referring Appendix E
from https://www.openssl.org/docs/fips/UserGuide-2.0.pdf
However for arm64 architecture with grater than iOS8 I am trying to build FIPS capable library by tweaking setenv-ios-11.sh setenv-darwin-i386.sh files and compiler but it is throwing below error.
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/
llvm-gcc: cannot execute: No such file or directory
How do I build the OpenSSL FIPS capable library for iOS arm64 architecture?
The problem is related to GCC path. So you need to link gcc to your path by below command.
Details: llvm-gcc-4.2: error
Fix the issue on iOS devices:
cd /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin
ln -s /usr/bin/llvm-gcc gcc-4.2

Xcodebuild cannot build framework library for simulator sdk

I'm having some issues when I try to build a framework using xcodebuild. My xcode version is 6.1.
This line works well:
xcodebuild -target Knot3DLib -configuration Release -sdk iphoneos
However it doesn't work:
xcodebuild -target Knot3DLib -configuration Release -sdk iphonesimulator
It says:
No architectures to compile for (ARCHS=i386 x86_64, VALID_ARCHS=arm64
armv7 armv7s).
I've no defined neither i386 nor x86_64 as archs in my project, so why does xcodebuild try to build i386? Here's my architecture build settings:
I can run the project from Xcode in both simulator and devices.
I've tried other similar questions but none of them worked for me.
The simulator is just that, a simulator. Xcode builds code that runs on a simulated environment on your computer. Your computer has an intel CPU and your phone has an ARM CPU. The compiler generates different code for these processors.
The error:
No architectures to compile for (ARCHS=i386 x86_64, VALID_ARCHS=arm64 armv7 armv7s).
Tells you that the architecture you are trying to compile for: ARCHS=i386 x86_64 is not in the list of VALID_ARCHS.
i386 and x86_64 are the architectures that intel CPUs use. If you are trying to build a framework with xcodebuild and you want to be able to link against the simulator sdk you need to add i386 and x86_64 to your list of VALID_ARCHS

No architectures to compile for (ARCHS=i386, VALID_ARCHS=arm64 armv7 armv7s)

Preface: I did look at similar questions and none of the answers seemed to fix my problem.
I am trying to build my xcode (version 5.1.1) project using:
xcodebuild clean build -sdk iphonesimulator7.0 -arch "armv7s" ONLY_ACTIVE_ARCH=NO,
when I run this I get: No architectures to compile for (ARCHS=armv7s, VALID_ARCHS=i386 x86_64) as an error. I tried the above command with all of the VALID_ARCHS (rm64 armv7 armv7s) as inputs. So I then tried running this command:
xcodebuild clean build -sdk iphonesimulator7.0 -arch "i386" ONLY_ACTIVE_ARCH=NO
and I then get No architectures to compile for (ARCHS=i386, VALID_ARCHS=arm64 armv7 armv7s) as an error. I tried running the above command with all the other VALID_ARCHS (i386 x86_64) and no luck with that either. I don't know why these architecture errors are occurring. I have cocoapods in my project, and the first answer in the link above didn't fix my issue.
You can override your default variables:
Try to use this:
xcodebuild clean build -sdk iphonesimulator7.0 -arch "i386" ONLY_ACTIVE_ARCH=NO VALID_ARCHS="i386 x86_64"
If you building for Simulator - always build for i386/x86_64.
Go to your project settings (not targets). Then open Build Settings and add a value to Valid architectures: i386

How to build Boost-Libraries for iPhone

Can someone tell me, where to find a detailed guide, how to build the Boost-Libraries for using it on the iPhone-Device.
I've allready build the libs for Mac and can use them in my project (only on iPhone-Simulator). While building the project for iPhone-Device, XCode haunts me a warning: "file is not of required architecture" ond some other errors.
Please Help
Start a new project in Xcode using the iPhone Static Library project template.
Then import the source and headers, and compile it that way. The result should be an iPhone compatible static library
I started here:
http://lists.boost.org/boost-build/2009/02/21326.php
With most of Boost you probably don't need to actually compile it, just include the useful headers. In my case, I just did the compiler define in my own Xcode project.
Hey I have updated Pete Goodliffes script in my openFrameworks addon:
It currently has arm64, armv7, i386, x86_64
Boost 1.59.0 or previous
libc++ / std=c++11 -- Now optional release for libstdc++
Precompiled and Script to build yourself (so if you need libstdc++ quite easy to change)
Supports Xcode 7
[https://github.com/danoli3/ofxiOSBoost][1]
For boost libraries which have only headers files (.hpp) you can just set header search path from your project to them.
For boost libraries with sources you can build static libraries for both ios phone/simulator with next simple steps:
Download and unpack a boost release archive (from https://www.boost.org/users/download/) e.g.: https://boostorg.jfrog.io/artifactory/main/release/1.77.0/source/boost_1_77_0.tar.bz2
Run bootstrap.sh with needed libraries to build for instance 'context' (format =library1,library2,...):
./bootstrap.sh --with-libraries=context
Add toolsets with correct paths to installed SDKs to project-config.jam:
# IOS ARM64
using clang : iphoneos
: xcrun clang -arch arm64 -stdlib=libc++ -std=c++11 -miphoneos-version-min=12.0 -fvisibility-inlines-hidden -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk
;
# IOS x86_64
using clang : iphonesimulator
: xcrun clang -arch x86_64 -stdlib=libc++ -std=c++11 -miphoneos-version-min=12.0 -fvisibility-inlines-hidden -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk
;
Create and run build.sh script (where lib name is libboost_<name>.a):
lib=libboost_context.a
dir='stage/lib'
# Build arm64
./b2 -a -j4 toolset=clang-iphoneos binary-format=mach-o abi=aapcs link=static stage
mv $dir/$lib $dir/arm64_$lib
# Build x86_64
./b2 -a -j4 toolset=clang-iphonesimulator binary-format=mach-o abi=sysv link=static stage
mv $dir/$lib $dir/x86_64_$lib
# Make fat
lipo -create $dir/arm64_$lib $dir/x86_64_$lib -output $dir/$lib
Now you have next compiled static libraries in "/stage/lib" dir for boost context: arm64_libboost_context.a, x86_64_libboost_context.a and fat one libboost_context.a.
We use boost too. To simplify its inclusion into new applications I have created a Xcode project you can drop into your workspace to include boost. It is based on a Makefile so you need the Xcode commandline tools installed.
The project is here https://github.com/Cogosense/iOSBoostFramework.
Clone the project into your workspace, then click on Menu File->"Add Files to workspace". Select iOSBoostFramework/iOSBoostFramework.xcodeproj in the file finder and click add.
The Makefile in the iOSBoostFramework directory controls what is built and how it is built. There is support for Xcode workspace dependencies, bitcode generation, and only the target architectures selected by Xcode are built.
The following libraries are built test, thread, atomic, signals, filesystem, regex, program_options, system date_time, serialization, exception, locale, and random.
All the separate libraries and architectures are combined, the final build output is a FAT boost.framework Framework bundle which can be linked into the application.
The version of boost is specified in the Makefile (currently 1.64.0), it is downloaded, built for all active architectures and installed in the BUILT_PRODUCTS_DIR specified by xcode.
The previous answer helped me when I wanted to build boost for the arm simulator. When you have a Mac with M1 processor and want to use the simulator, you cannot use the arm64 build for the iPhone.
I added this to the project-config.jam:
# IOS Arm Simulator
using clang : iphonesimulatorarm64
: xcrun clang -arch arm64 -stdlib=libc++ -std=c++11 -miphoneos-version-min=10.0 -fvisibility-inlines-hidden -target arm64-apple-ios10.0-simulator -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk ;
Then pass toolset=clang-iphonesimulatorarm64 to the b2 command.

Resources