Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

llvm-3.9.0_threads.patch breaks the build on FreeBSD #19769

Closed
ararslan opened this issue Dec 29, 2016 · 10 comments · Fixed by #19810
Closed

llvm-3.9.0_threads.patch breaks the build on FreeBSD #19769

ararslan opened this issue Dec 29, 2016 · 10 comments · Fixed by #19810
Labels
system:freebsd Affects only FreeBSD

Comments

@ararslan
Copy link
Member

ararslan commented Dec 29, 2016

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.

@tkelman tkelman added the system:freebsd Affects only FreeBSD label Dec 29, 2016
@tkelman
Copy link
Contributor

tkelman commented Dec 29, 2016

try taking this section out of the patch

@@ -39,6 +35,5 @@ endif( LLVM_USE_INTEL_JITEVENTS )
add_llvm_tool(lli
lli.cpp
- OrcLazyJIT.cpp
)
export_executable_symbols(lli)
(then distcleaning llvm)

@ararslan
Copy link
Member Author

ararslan commented Jan 1, 2017

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

@ararslan
Copy link
Member Author

ararslan commented Jan 1, 2017

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

@ararslan
Copy link
Member Author

ararslan commented Jan 1, 2017

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.

@tkelman
Copy link
Contributor

tkelman commented Jan 1, 2017

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

@ararslan
Copy link
Member Author

ararslan commented Jan 1, 2017

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.

@tkelman
Copy link
Contributor

tkelman commented Jan 2, 2017

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

@tkelman
Copy link
Contributor

tkelman commented Jan 2, 2017

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

cd $$(LLVM_SRC_DIR) && patch -p1 < $$(SRCDIR)/patches/$1.patch
and see if that fixes this issue.

@tkelman
Copy link
Contributor

tkelman commented Jan 2, 2017

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.

@ararslan
Copy link
Member Author

ararslan commented Jan 4, 2017

Thanks, Tony!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
system:freebsd Affects only FreeBSD
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants