Problems in building Xerces library as a universal binary on Mac

328 Views Asked by At

I am trying to compile xerces 3.1.1 and 3.2.3 with XCode 12.3 to make universal library for both Intel and M1.

I am running the following for configuring step:

./configure CFLAGS="-arch x86_64 -arch arm64" CXXFLAGS="-arch x86_64 -arch arm64"

I am getting the following output:

checking build system type... x86_64-apple-darwin19.6.0
checking host system type... x86_64-apple-darwin19.6.0
checking whether make supports nested variables... yes
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... config/install-sh -c -d
checking for gawk... no
checking for mawk... no
checking for nawk... no
checking for awk... awk
checking whether make sets $(MAKE)... yes
checking whether UID '502' is supported by ustar format... yes
checking whether GID '20' is supported by ustar format... yes
checking how to create a ustar tar archive... gnutar
checking whether to enable maintainer-specific portions of Makefiles... no
checking whether to use rpath... yes
checking for g++... g++
checking whether the C++ compiler works... no
configure: error: in `/Users/prj/3rd Party/Apache/xerces-c-src_3_2_3':
configure: error: C++ compiler cannot create executables
See `config.log' for more details

I want to therefore know if Xerces 3.1.1 or 3.2.3 can be built for both intel and M1 chip, i.e. essentially as a universal binary in Mac.

Thanks,

1

There are 1 best solutions below

0
On

I would advise you to use CMake to build Xerces instead of the configure script and add the following variable on your cmake command:

CMAKE_OSX_ARCHITECTURES=arm64;x86_64