<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Thank you, that script is indeed a helpful template. I will use that approach for now.<div class=""><br class=""></div><div class="">Best,</div><div class=""><br class=""></div><div class="">Ken</div><div class=""><br class=""></div><div class=""><br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On Apr 22, 2021, at 3:48 PM, Petr Hosek <<a href="mailto:phosek@google.com" class="">phosek@google.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><div class="">This is currently not supported. We only support building universal binaries in the compiler-rt build.</div><div class=""><br class=""></div><div class="">I'd like to introduce support for building universal binaries for other runtimes as well, but I don't know yet what's the right strategy.</div><div class=""><br class=""></div><div class="">The way compiler-rt approaches the problem is by creating a separate target for each supported system and architecture and then combining the output artifacts. This is all done within a single CMake build.<br class=""></div><div class=""><br class=""></div><div class="">In the runtimes build, we use a separate CMake build for each target. You could build all other runtimes for different targets using that approach and then combine the output together. That's the approach that Apple uses in <a href="https://github.com/llvm/llvm-project/blob/main/libcxx/utils/ci/apple-install-libcxx.sh" class="">https://github.com/llvm/llvm-project/blob/main/libcxx/utils/ci/apple-install-libcxx.sh</a></div><div class=""><br class=""></div><div class="">We could implement universal binary support in the runtimes, combining output artifacts with llvm-lipo. What I don't know is how to fit the compiler-rt build into that model. I can see two ways forward:</div><div class=""><br class=""></div><div class="">1. We implement the same approach that compiler-rt uses in other runtimes, that is we implement support for building libc++, libc++abi and libunwind for multiple targets within a single CMake build. In the runtimes build, we then use a single target for the "universal build".</div><div class="">2. We implement universal binary support in the runtimes build and we stop using the existing support in the compiler-rt build when targeting Apple platforms.</div><div class=""><br class=""></div><div class="">I'm leaning towards #2 which seems like a better long term strategy but I'd like to hear from Chris who has already looked into this problem in the past. Have I missed anything? Is there another approach that you'd prefer?</div><br class=""><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Apr 20, 2021 at 9:59 AM Ken Cunningham via libcxx-dev <<a href="mailto:libcxx-dev@lists.llvm.org" class="">libcxx-dev@lists.llvm.org</a>> wrote:<br class=""></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="overflow-wrap: break-word;" class=""><div class="">Hello,</div><div class=""><br class=""></div><div class="">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.</div><div class=""><br class=""></div><div class="">The clang bootstrap compiler is to be built as native arch, then I would like to use that clang to make the universal runtimes.</div><div class=""><br class=""></div><div class="">We use the following initially to make sure that gcc8 builds the bootstrap compiler in the native arch:</div><div class=""><br class=""></div><div class=""><font face="Menlo" class=""><span style="font-size:11px" class="">CMAKE_OSX_ARCHITECTURES=“x86_64”</span></font></div><div class=""><br class=""></div><div class="">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.</div><div class=""><br class=""></div><div class="">I tried adding runtime targets:</div><div class=""><br class=""></div><div class=""><div style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo" class=""><span style="font-variant-ligatures:no-common-ligatures" class="">-DLLVM_ENABLE_RUNTIME_TARGETS="i386-apple-darwin10;x86_64-apple-darwin10”</span></div></div><div style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo" class=""><span style="font-variant-ligatures:no-common-ligatures" class=""><br class=""></span></div><div style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo" class=""><span style="font-variant-ligatures:no-common-ligatures" class=""><span style="font-family:Helvetica;font-size:12px" class="">or just forcing the CXXFLAGS and CCFLAGS to include “-arch i386 -arch x86_64” but no luck.</span></span></div><div class=""><br class=""></div><div class="">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?</div><div class=""><br class=""></div><div class="">Best,</div><div class=""><br class=""></div><div class="">Ken</div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">Our current configure line looks like this, with a bunch of MacPorts’ standard cmake defaults in there:</div><div class=""><br class=""></div><div class=""><div style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo" class=""><span style="font-variant-ligatures:no-common-ligatures" class="">cd "/opt/local/var/macports/build/_opt_myports_lang_libcxx/libcxx/work/build" && </span></div><div style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo" class=""><span style="font-variant-ligatures:no-common-ligatures" class=""><br class=""></span></div><div style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo" class=""><span style="font-variant-ligatures:no-common-ligatures" class="">CXX=g++-8.0 CC=gcc-8.0 </span></div><div style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo" class=""><span style="font-variant-ligatures:no-common-ligatures" class="">cmake -G "CodeBlocks - Unix Makefiles” </span></div><div style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo" class=""><span style="font-variant-ligatures:no-common-ligatures" class="">-DCMAKE_BUILD_TYPE=Release </span></div><div style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo" class=""><span style="font-variant-ligatures:no-common-ligatures" class="">-DCMAKE_INSTALL_PREFIX="/opt/local” </span></div><div style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo" class=""><span style="font-variant-ligatures:no-common-ligatures" class="">-DCMAKE_INSTALL_NAME_DIR="/opt/local/lib” </span></div><div style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo" class=""><span style="font-variant-ligatures:no-common-ligatures" class="">-DCMAKE_SYSTEM_PREFIX_PATH="/opt/local;/usr” </span></div><div style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo" class=""><span style="font-variant-ligatures:no-common-ligatures" class="">-DCMAKE_C_COMPILER_LAUNCHER=/opt/local/bin/ccache </span></div><div style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo" class=""><span style="font-variant-ligatures:no-common-ligatures" class="">-DCMAKE_CXX_COMPILER_LAUNCHER=/opt/local/bin/ccache </span></div><div style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo" class=""><span style="font-variant-ligatures:no-common-ligatures" class="">-DCMAKE_C_COMPILER="$CC” </span></div><div style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo" class=""><span style="font-variant-ligatures:no-common-ligatures" class="">-DCMAKE_CXX_COMPILER="$CXX” </span></div><div style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo" class=""><span style="font-variant-ligatures:no-common-ligatures" class="">-DCMAKE_OBJC_COMPILER="$CC” </span></div><div style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo" class=""><span style="font-variant-ligatures:no-common-ligatures" class="">-DCMAKE_OBJCXX_COMPILER="$CXX” </span></div><div style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo" class=""><span style="font-variant-ligatures:no-common-ligatures" class="">-DCMAKE_POLICY_DEFAULT_CMP0025=NEW </span></div><div style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo" class=""><span style="font-variant-ligatures:no-common-ligatures" class="">-DCMAKE_POLICY_DEFAULT_CMP0060=NEW </span></div><div style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo" class=""><span style="font-variant-ligatures:no-common-ligatures" class="">-DCMAKE_VERBOSE_MAKEFILE=ON </span></div><div style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo" class=""><span style="font-variant-ligatures:no-common-ligatures" class="">-DCMAKE_COLOR_MAKEFILE=ON </span></div><div style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo" class=""><span style="font-variant-ligatures:no-common-ligatures" class="">-DCMAKE_FIND_FRAMEWORK=LAST </span></div><div style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo" class=""><span style="font-variant-ligatures:no-common-ligatures" class="">-DCMAKE_EXPORT_COMPILE_COMMANDS=ON </span></div><div style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo" class=""><span style="font-variant-ligatures:no-common-ligatures" class="">-DCMAKE_MAKE_PROGRAM=/usr/bin/make </span></div><div style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo" class=""><span style="font-variant-ligatures:no-common-ligatures" class="">-DCMAKE_MODULE_PATH="/opt/local/share/cmake/Modules” </span></div><div style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo" class=""><span style="font-variant-ligatures:no-common-ligatures" class="">-DCMAKE_PREFIX_PATH="/opt/local/share/cmake/Modules” </span></div><div style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo" class=""><span style="font-variant-ligatures:no-common-ligatures" class="">-DCMAKE_BUILD_WITH_INSTALL_RPATH:BOOL=ON </span></div><div style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo" class=""><span style="font-variant-ligatures:no-common-ligatures" class="">-DCMAKE_INSTALL_RPATH="/opt/local/lib"</span></div><div style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo" class=""><span style="font-variant-ligatures:no-common-ligatures" class="">-DPYTHON_EXECUTABLE=/opt/local/libexec/libcxx-bootstrap/bin/python2.7 </span></div><div style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo" class=""><span style="font-variant-ligatures:no-common-ligatures" class="">-DLIBXML2_LIBRARIES=IGNORE </span></div><div style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo" class=""><span style="font-variant-ligatures:no-common-ligatures" class=""><div style="margin:0px;font-stretch:normal;line-height:normal" class=""><span style="font-variant-ligatures:no-common-ligatures" class="">-DCMAKE_OSX_ARCHITECTURES="x86_64” </span></div><div style="margin:0px;font-stretch:normal;line-height:normal" class=""><span style="font-variant-ligatures:no-common-ligatures" class="">-DCMAKE_OSX_DEPLOYMENT_TARGET="10.6” </span></div><div style="margin:0px;font-stretch:normal;line-height:normal" class=""><span style="font-variant-ligatures:no-common-ligatures" class="">-DCMAKE_OSX_SYSROOT=“/“ </span></div><div class="">-DLLVM_TARGETS_TO_BUILD="X86” </div></span></div><div style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo" class=""><span style="font-variant-ligatures:no-common-ligatures" class="">-DLLVM_ENABLE_PROJECTS="clang” </span></div><div style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo" class=""><span style="font-variant-ligatures:no-common-ligatures" class="">-DLLVM_ENABLE_RUNTIMES="libcxx;libcxxabi” </span></div><div style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo" class="">/opt/local/var/macports/build/_opt_myports_lang_libcxx/libcxx/work/libcxx-7.1.0/llvm </div></div><div style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo" class=""><br class=""></div><div style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo" class="">&& make install-cxx install-cxxabi</div></div>_______________________________________________<br class="">
libcxx-dev mailing list<br class="">
<a href="mailto:libcxx-dev@lists.llvm.org" target="_blank" class="">libcxx-dev@lists.llvm.org</a><br class="">
<a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/libcxx-dev" rel="noreferrer" target="_blank" class="">https://lists.llvm.org/cgi-bin/mailman/listinfo/libcxx-dev</a><br class="">
</blockquote></div></div>
</div></blockquote></div><br class=""></div></body></html>