JuliaInterop / Cxx.jl

The Julia C++ Interface
Other
755 stars 107 forks source link

failed to precompile on julia 1.4.0 #464

Open zwwi opened 4 years ago

zwwi commented 4 years ago

I got an error LoadError: AssertionError: isdir(cxxclangdir) during precompiling; it works well on julia 1.3.1. The system is WSL2

htyeim commented 4 years ago

Failed on 1.4 also, but in my case (macOS 10.15), the error said:

ERROR: LoadError: LoadError: could not load library "/Users/user/.julia/packages/Cxx/1RaOv/src/../deps/usr/lib/libcxxffi"
dlopen(/Users/user/.julia/packages/Cxx/1RaOv/src/../deps/usr/lib/libcxxffi.dylib, 9): Symbol not found: __ZN4llvm11raw_ostream6handleEv
  Referenced from: /Users/user/.julia/packages/Cxx/1RaOv/src/../deps/usr/lib/libcxxffi.dylib
  Expected in: /Applications/Julia-1.4.app/Contents/Resources/julia/lib/julia/libLLVM.dylib
 in /Users/user/.julia/packages/Cxx/1RaOv/src/../deps/usr/lib/libcxxffi.dylib
Gnimuc commented 4 years ago

I need to upgrade https://github.com/Gnimuc/CxxBuilder and release new libcxxffi binaries for Julia-1.4. This may take a couple of days(depends on China's Internet download speed 😂), so currently, if you'd like to use Cxx.jl with Julia-1.4, I would recommend to build Julia from source and then do a source build(pkg> build Cxx) for Cxx.jl.

This will take longer than I expected.

drewrobson commented 4 years ago

Julia 1.4 uses LLVM_VER = 8.0.1, which has breaking changes relative to LLVM_VER = 6.0.1 used by Julia 1.3.

I think even source build won't work until Cxx.jl is updated to support the new LLVM version.

Here are the first lines of the Cxx build error on a source build of Julia 1.4:

┌ Error: Error building `Cxx`, showing the last 100 of log: 
│ /home/drew/julia_v1.4/usr/bin/../include/clang/AST/ExprCXX.h:171:7: note:   candidate expects 1 argument, 6 provided
│ /home/drew/julia_v1.4/usr/bin/../include/clang/AST/ExprCXX.h:171:7: note: candidate: ‘constexpr clang::CXXMemberCallExpr::CXXMemberCallExpr(clang::CXXMemberCallExpr&&)’
│ /home/drew/julia_v1.4/usr/bin/../include/clang/AST/ExprCXX.h:171:7: note:   candidate expects 1 argument, 6 provided
│ ../src/bootstrap.cpp: In function ‘void finish_clang_init(CxxInstance*, bool, const char*, size_t, time_t)’:
│ ../src/bootstrap.cpp:1610:59: error: ‘getNewMemBuffer’ is not a member of ‘llvm::MemoryBuffer’
│  1610 |     sm.overrideFileContents(MainFile, llvm::MemoryBuffer::getNewMemBuffer(0, fname));
│       |                                                           ^~~~~~~~~~~~~~~
Gnimuc commented 4 years ago

@drewrobson you're right. I just fixed that. Could you give #465 a try?

drewrobson commented 4 years ago

Thanks for your quick response! Now I'm getting a curl 404 error:

│ curl: (22) The requested URL returned error: 404 
│ make: *** [BuildBootstrap.Makefile:23: llvm_tars] Error 22
drewrobson commented 4 years ago

These are the broken urls:

http://releases.llvm.org/8.0.1/llvm-8.0.1.src.tar.xz
http://releases.llvm.org/8.0.1/cfe-8.0.1.src.tar.xz
http://releases.llvm.org/8.0.1/compiler-rt-8.0.1.src.tar.xz
http://releases.llvm.org/8.0.1/libcxx-8.0.1.src.tar.xz
http://releases.llvm.org/8.0.1/libcxxabi-8.0.1.src.tar.xz
http://releases.llvm.org/8.0.1/polly-8.0.1.src.tar.xz
http://releases.llvm.org/8.0.1/libunwind-8.0.1.src.tar.xz
http://releases.llvm.org/8.0.1/lld-8.0.1.src.tar.xz

These urls work fine if I replace 8.0.1 with 6.0.1. Looks like https://releases.llvm.org/6.0.1 contains source files but https://releases.llvm.org/8.0.1 redirects to GitHub. Perhaps for 8.0.1, the urls should look like this:

https://github.com/llvm/llvm-project/releases/download/llvmorg-8.0.1/llvm-8.0.1.src.tar.xz
Gnimuc commented 4 years ago

Yeah, I just noticed that. Now I'm trying to update those LLVM patches. ;)

Gnimuc commented 4 years ago

OK, now I need to upgrade bootstrap.cpp to LLVM8, which may beyond my abilities, so don't expect this can be fixed soon.

AmplitudeGravity commented 4 years ago

Failed on 1.4 also, but in my case (macOS 10.15), the error said:

ERROR: LoadError: LoadError: could not load library "/Users/user/.julia/packages/Cxx/1RaOv/src/../deps/usr/lib/libcxxffi"
dlopen(/Users/user/.julia/packages/Cxx/1RaOv/src/../deps/usr/lib/libcxxffi.dylib, 9): Symbol not found: __ZN4llvm11raw_ostream6handleEv
  Referenced from: /Users/user/.julia/packages/Cxx/1RaOv/src/../deps/usr/lib/libcxxffi.dylib
  Expected in: /Applications/Julia-1.4.app/Contents/Resources/julia/lib/julia/libLLVM.dylib
 in /Users/user/.julia/packages/Cxx/1RaOv/src/../deps/usr/lib/libcxxffi.dylib

I have similar errors even I use juliapro 1.0.5

Gnimuc commented 4 years ago

FYI, Cxx.jl(binary build) only works with Julia-v1.1.x~v1.3.x.

mdav2 commented 4 years ago

First off, great package you have here. However, is there a plan to resolve these issues for future versions of Julia? I am considering adding Cxx.jl as a dependency to a project, but I don't want to be permanently frozen at Julia 1.3 ...

htyeim commented 4 years ago

First off, great package you have here. However, is there a plan to resolve these issues for future versions of Julia? I am considering adding Cxx.jl as a dependency to a project, but I don't want to be permanently frozen at Julia 1.3 ...

I think it's a good time to rewrite the code in pure julia (:joy: what I have done with GPSTk)

henry2004y commented 4 years ago

Still failing on Julia 1.5.1. Looking forward to the working version!

kapple19 commented 3 years ago

Also failing on Julia 1.6

julia> using Cxx
[ Info: Precompiling Cxx [a0b5b9ef-44b7-5148-a2d1-f6db19f3c3d2]
ERROR: LoadError: LoadError: could not load library "C:\Users\user\.julia\packages\Cxx\1RaOv\src\..\deps\usr\bin\libcxxffi"