3 build issues... * When using CXX=clang++, fails to build can not be found stdarg.h. It has been fixed in upstream. https://github.com/llvm-mirror/compiler-rt/commit/6606c7b50cbb4ec7eab4ecbebbbaaa049734bbd3 * When using gcc, got error: 'stoull' is not a member of 'std', build will fail. Maybe, gcc issue. https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=193528 Add -D_GLIBCXX_USE_C99 to CXXFLAGS, build was successful. * Fails to link. Change -DLLVM_LINK_LLVM_DYLIB=ON to -DBUILD_SHARED_LIBS=ON, link was successful.
Created attachment 428804 [details] Log, fatal error: 'stdarg.h' file not found
Created attachment 428806 [details] Log, error: 'stoull' is not a member of 'std'
Created attachment 428808 [details] Log, link error
Created attachment 428810 [details, diff] sample patch for llvm-3.8.0.ebuild
Created attachment 428812 [details, diff] files/llvm-3.8-compiler-rt-fbsd.patch
Thanks for the work here! The first 2 fixes look good to go, as they are compile-time only and freebsd-specific, but I am more worried about the linking problem I switched from BUILD_SHARED_LIBS to the newer option as lldb does not compile with it (maybe now in trunk, but 3.8 does not), and upstream explicitely recommends against it (http://llvm.org/releases/3.8.0/docs/CMake.html#frequently-used-cmake-variables): "BUILD_SHARED_LIBS is only recommended for use by LLVM developers. If you want to build LLVM as a shared library, you should use the LLVM_BUILD_LLVM_DYLIB option." And the resulting libs organization is a bit different between these flags. If possible, it would be much better to fix the link error itself, as it works fine on Linux (if that gets too complicated, we can switch back the flag for freebsd of course)
Hmm, rechecking the build log, all link-time failures relate to cxx11 ABI calls. Maybe playing with the _GLIBCXX_USE_CXX11_ABI flag could help here (https://gcc.gnu.org/onlinedocs/libstdc++/manual/using_dual_abi.html)?
Created attachment 428982 [details] build log, CMAKE_ARGS= -DLLVM_LINK_LLVM_DYLIB=ON on vanilla FreeBSD 10.3-RC3 (In reply to Bernard Cafarelli from comment #6) > Thanks for the work here! > > The first 2 fixes look good to go, as they are compile-time only and > freebsd-specific, but I am more worried about the linking problem > > I switched from BUILD_SHARED_LIBS to the newer option as lldb does not > compile with it (maybe now in trunk, but 3.8 does not), and upstream > explicitely recommends against it > (http://llvm.org/releases/3.8.0/docs/CMake.html#frequently-used-cmake- > variables): > "BUILD_SHARED_LIBS is only recommended for use by LLVM developers. If you > want to build LLVM as a shared library, you should use the > LLVM_BUILD_LLVM_DYLIB option." > And the resulting libs organization is a bit different between these flags. > > If possible, it would be much better to fix the link error itself, as it > works fine on Linux (if that gets too complicated, we can switch back the > flag for freebsd of course) Thanks for review. I have installed vanilla FreeBSD for link issue to investigate whether FreeBSD issue or Gentoo/FreeBSD-specific issues. I was tested by adding CMAKE_ARGS= -DLLVM_LINK_LLVM_DYLIB=ON to Makefile of ports on vanilla FreeBSD 10.3-RC3. And it failed to link. I think that -DLLVM_LINK_LLVM_DYLIB=ON does not work correctly on FreeBSD...... # cc --version FreeBSD clang version 3.4.1 (tags/RELEASE_34/dot1-final 208032) 20140512 Target: x86_64-unknown-freebsd10.3 Thread model: posix # c++ --version FreeBSD clang version 3.4.1 (tags/RELEASE_34/dot1-final 208032) 20140512 Target: x86_64-unknown-freebsd10.3 Thread model: posix Makefile) https://svnweb.freebsd.org/ports/head/devel/llvm38/Makefile?revision=411371&view=markup FreeBSD ports seems to disable the shared library. I'll update patch. https://svnweb.freebsd.org/ports?view=revision&revision=407336
Created attachment 428984 [details, diff] sample patch for llvm-3.8.0.ebuild
We could go without shared library indeed, though mgorny changed back to shared libraries build in 3.8.0-r1 (good to know we are not the only ones where lldb fails to build), so this could end with a workaround. So -D_GLIBCXX_USE_CXX11_ABI (enabled or disabled) did not have any effect?
commit 12280fd5851883571f9e0f0ec44432d2bd17e187 (HEAD -> master, origin/master, origin/HEAD) Author: Yuta Satoh <nigoro.dev@gmail.com> AuthorDate: Sat Jun 18 14:44:10 2016 +0900 Commit: Patrice Clement <monsieurp@gentoo.org> CommitDate: Thu Jun 23 15:26:09 2016 +0000 sys-devel/llvm: Fix build fails on Gentoo/FreeBSD. Gentoo-Bug: https://bugs.gentoo.org/578064 Closes: https://github.com/gentoo/gentoo/pull/1693 Signed-off-by: Patrice Clement <monsieurp@gentoo.org> sys-devel/llvm/files/clang-3.8-compiler-rt-fbsd.patch | 20 ++++++++++++++++++++ sys-devel/llvm/llvm-3.8.0-r2.ebuild | 7 +++++++ 2 files changed, 27 insertions(+) create mode 100644 sys-devel/llvm/files/clang-3.8-compiler-rt-fbsd.patch