[LLVMdev] Transitioning build to cmake

Jeremy Huddleston Sequoia jeremyhu at apple.com
Wed Jul 24 10:11:39 PDT 2013


I recently took a stab at changing the MacPorts llvm-3.4 port from the configure-based build system to the cmake-based build system.

There are a couple of issues that I still haven't been able to work out yet and would like to know if these are just configuration issues on my side or bugs I should file at bugs.llvm.org:


1) libclang_rt

It looks like the cmake build is missing some runtime libraries.  How do I coerce it into building the right ones?

-./opt/local/libexec/llvm-3.4/lib/clang/3.4/lib/darwin/libclang_rt.10.4.a
 ./opt/local/libexec/llvm-3.4/lib/clang/3.4/lib/darwin/libclang_rt.asan_osx_dynamic.dylib
-./opt/local/libexec/llvm-3.4/lib/clang/3.4/lib/darwin/libclang_rt.cc_kext.a
-./opt/local/libexec/llvm-3.4/lib/clang/3.4/lib/darwin/libclang_rt.eprintf.a
-./opt/local/libexec/llvm-3.4/lib/clang/3.4/lib/darwin/libclang_rt.ios.a
-./opt/local/libexec/llvm-3.4/lib/clang/3.4/lib/darwin/libclang_rt.osx.a
-./opt/local/libexec/llvm-3.4/lib/clang/3.4/lib/darwin/libclang_rt.profile_ios.a
+./opt/local/libexec/llvm-3.4/lib/clang/3.4/lib/darwin/libclang_rt.i386.a
 ./opt/local/libexec/llvm-3.4/lib/clang/3.4/lib/darwin/libclang_rt.profile_osx.a
 ./opt/local/libexec/llvm-3.4/lib/clang/3.4/lib/darwin/libclang_rt.ubsan_osx.a
+./opt/local/libexec/llvm-3.4/lib/clang/3.4/lib/darwin/libclang_rt.x86_64.a


2) Universal

This looks like a bug in cmake.  I'm unable to build universal when setting CMAKE_OSX_ARCHITECTURES.  cmake errors out because it only set the -arch command line arguments at link time:

  ...
  Building C object
  CMakeFiles/cmTryCompileExec3905760613.dir/testCCompiler.c.o

  /usr/bin/clang -Os -o
  CMakeFiles/cmTryCompileExec3905760613.dir/testCCompiler.c.o -c
  /opt/local/var/macports/build/_Users_jeremy_src_macports_trunk_dports_lang_llvm-3.4/llvm-3.4/work/build/CMakeFiles/CMakeTmp/testCCompiler.c


  Linking C executable cmTryCompileExec3905760613

  /opt/local/bin/cmake -E cmake_link_script
  CMakeFiles/cmTryCompileExec3905760613.dir/link.txt --verbose=1

  /usr/bin/clang -Os -Wl,-search_paths_first -Wl,-headerpad_max_install_names
  -L/opt/local/lib -Wl,-headerpad_max_install_names -arch x86_64 -arch i386
  CMakeFiles/cmTryCompileExec3905760613.dir/testCCompiler.c.o -o
  cmTryCompileExec3905760613

  ld: warning: ignoring file
  CMakeFiles/cmTryCompileExec3905760613.dir/testCCompiler.c.o, file was built
  for unsupported file format ( 0xCF 0xFA 0xED 0xFE 0x07 0x00 0x00 0x01 0x03
  0x00 0x00 0x00 0x01 0x00 0x00 0x00 ) which is not the architecture being
  linked (i386): CMakeFiles/cmTryCompileExec3905760613.dir/testCCompiler.c.o

  Undefined symbols for architecture i386:
  ...


3) Shared library

The build fails if I try to build llvm using BUILD_SHARED_LIBS=ON ... the issue is that when the build tries to use the tools, dyld can't find libllvm-3.4svn.dylib because it's not yet installed.


4) Building clang using installed llvm

It looks like there is some support for building clang against an installed llvm by setting CLANG_PATH_TO_LLVM_BUILD.  This fails miserably in part because the installed llvm cmake files reference build time paths, but even after fixing that, there are tons of build failures.  I'm guessing this is still a work in progress, but if I should file bugs, please let me know.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4136 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130724/27d8e91c/attachment.bin>


More information about the llvm-dev mailing list