[libcxx-dev] how to build darwin runtimes as libcxx / libcxxabi as universal?

Ken Cunningham via libcxx-dev libcxx-dev at lists.llvm.org
Tue Apr 20 09:59:44 PDT 2021


Hello,

First of all apologies for the niche question. As part of our older systems support on MacPorts, I am attempting a universal runtimes build of libcxx and libcxxabi using gcc8 as the initial build compiler. Currently I am using the llvm-7.1.0 tree for this.

The clang bootstrap compiler is to be built as native arch, then I would like to use that clang to make the universal runtimes.

We use the following initially to make sure that gcc8 builds the bootstrap compiler in the native arch:

CMAKE_OSX_ARCHITECTURES=“x86_64”

This actually works just fine to generate libcxx/libcxxabi in the native arch, but try as I may, I cannot find a way to make libcxx and libcxxabi build as universal binaries using the bootstrap compiler.

I tried adding runtime targets:

-DLLVM_ENABLE_RUNTIME_TARGETS="i386-apple-darwin10;x86_64-apple-darwin10”

or just forcing the CXXFLAGS and CCFLAGS to include “-arch i386 -arch x86_64” but no luck.

I was wondering if first of all building the runtimes as universal is supported (I know it is in compiler-rt) and if so, is there an approach or runtimes configuration option I am meant to set for this?

Best,

Ken



Our current configure line looks like this, with a bunch of MacPorts’ standard cmake defaults in there:

cd "/opt/local/var/macports/build/_opt_myports_lang_libcxx/libcxx/work/build" && 

CXX=g++-8.0 CC=gcc-8.0 
cmake -G "CodeBlocks - Unix Makefiles” 
-DCMAKE_BUILD_TYPE=Release 
-DCMAKE_INSTALL_PREFIX="/opt/local” 
-DCMAKE_INSTALL_NAME_DIR="/opt/local/lib” 
-DCMAKE_SYSTEM_PREFIX_PATH="/opt/local;/usr” 
-DCMAKE_C_COMPILER_LAUNCHER=/opt/local/bin/ccache 
-DCMAKE_CXX_COMPILER_LAUNCHER=/opt/local/bin/ccache 
-DCMAKE_C_COMPILER="$CC” 
-DCMAKE_CXX_COMPILER="$CXX” 
-DCMAKE_OBJC_COMPILER="$CC” 
-DCMAKE_OBJCXX_COMPILER="$CXX” 
-DCMAKE_POLICY_DEFAULT_CMP0025=NEW 
-DCMAKE_POLICY_DEFAULT_CMP0060=NEW 
-DCMAKE_VERBOSE_MAKEFILE=ON 
-DCMAKE_COLOR_MAKEFILE=ON 
-DCMAKE_FIND_FRAMEWORK=LAST 
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON 
-DCMAKE_MAKE_PROGRAM=/usr/bin/make 
-DCMAKE_MODULE_PATH="/opt/local/share/cmake/Modules” 
-DCMAKE_PREFIX_PATH="/opt/local/share/cmake/Modules” 
-DCMAKE_BUILD_WITH_INSTALL_RPATH:BOOL=ON 
-DCMAKE_INSTALL_RPATH="/opt/local/lib"
-DPYTHON_EXECUTABLE=/opt/local/libexec/libcxx-bootstrap/bin/python2.7 
-DLIBXML2_LIBRARIES=IGNORE 
-DCMAKE_OSX_ARCHITECTURES="x86_64” 
-DCMAKE_OSX_DEPLOYMENT_TARGET="10.6” 
-DCMAKE_OSX_SYSROOT=“/“ 
-DLLVM_TARGETS_TO_BUILD="X86” 
-DLLVM_ENABLE_PROJECTS="clang” 
-DLLVM_ENABLE_RUNTIMES="libcxx;libcxxabi” 
/opt/local/var/macports/build/_opt_myports_lang_libcxx/libcxx/work/libcxx-7.1.0/llvm 

&& make install-cxx install-cxxabi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/libcxx-dev/attachments/20210420/41bebc93/attachment.html>


More information about the libcxx-dev mailing list