Julia: llvm-3.9.0_threads.patch breaks the build on FreeBSD

Created on 30 Dec 2016  路  10Comments  路  Source: JuliaLang/julia

Our patched LLVM 3.7 built fine on FreeBSD, but it seems that LLVM 3.9 refuses to build on FreeBSD when llvm-3.9.0_threads.patch is applied. The following message is displayed, along with several other similar messages referencing other LLVM files:

CMake Error at cmake/modules/LLVMProcessSources.cmake:83 (message):
  Found unknown source file
  /usr/home/alex/repos/julia/deps/srccache/llvm-3.9.1/tools/lli/OrcLazyJIT.cpp


  Please update
  /usr/home/alex/repos/julia/deps/srccache/llvm-3.9.1/tools/lli/CMakeLists.txt

The build works fine if the application of this patch is commented out.

This is with CMake 3.7.1. I guess the patch was copied from Rust's fork of LLVM, so this issue may not be unique to Julia.

freebsd

Most helpful comment

It would be good to put together a Vagrantfile for the FreeBSD build at some point so it's easier to test against.

All 10 comments

For reference, the more complete log from building LLVM is here. I'll try your suggestion and see what happens. Thanks as always, Tony!

Looks like your suggestion plus the removal of this section got it building. 馃帀

I'm getting a ton of messages that say that libjulia.so contains undefined references to LLVM things. For example, here are the first few such messages:

/usr/home/alex/repos/julia/usr/lib/libjulia.so: undefined reference to `llvm::object::object_category()'
/usr/home/alex/repos/julia/usr/lib/libjulia.so: undefined reference to `llvm::ConstantExpr::getCompare(unsigned short, llvm::Constant*, llvm::Constant*, bool)'
/usr/home/alex/repos/julia/usr/lib/libjulia.so: undefined reference to `llvm::InsertValueInst::init(llvm::Value*, llvm::Value*, llvm::ArrayRef<unsigned int>, llvm::Twine const&)'
/usr/home/alex/repos/julia/usr/lib/libjulia.so: undefined reference to `llvm::ConstantInt::getSigned(llvm::Type*, long)'

For the full section of the log, see here. Though I should note that these messages occur even when this patch is not applied at all, which may indicate that they aren't related to this particular issue. I can open a separate issue for that if that would be better.

do the linker errors happen if you don't apply any of our patches to llvm at all?

Actually yes, they do. I guess those errors probably has more to do with LLVM 3.9 on FreeBSD in general than with our patches.

Edit: LLVM 3.9 is available from FreeBSD's pkg and ports though, so it's not like it's not supported.

It would be good to put together a Vagrantfile for the FreeBSD build at some point so it's easier to test against.

Ooh, I think I know why this is FreeBSD-specific. Apparently when patch behaves in a way that strictly conforms to POSIX, it doesn't remove empty files by default. GNU patch, which I think Apple might also use (?), does. First, if a file exists at deps/srccache/llvm-3.9.1/tools/lli/OrcLazyJIT.cpp, how big is it? Try adding -E to the patch call here https://github.com/JuliaLang/julia/blob/c38a5a3044ffd62c585225a201422f95fd18f6dc/deps/llvm.mk#L432 and see if that fixes this issue.

Scratch that, looks like busybox-based systems don't support patch -E so we shouldn't assume it's available. Try the commits I just added to #19810 (starting from distclean'ed llvm) which should hopefully make it unnecessary.

Thanks, Tony!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

TotalVerb picture TotalVerb  路  3Comments

iamed2 picture iamed2  路  3Comments

arshpreetsingh picture arshpreetsingh  路  3Comments

wilburtownsend picture wilburtownsend  路  3Comments

yurivish picture yurivish  路  3Comments