Cxx.jl icon indicating copy to clipboard operation
Cxx.jl copied to clipboard

failed to precompile on julia 1.4.0

Open zwwi opened this issue 4 years ago • 14 comments

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

zwwi avatar Mar 22 '20 10:03 zwwi

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

htyeim avatar Mar 23 '20 08:03 htyeim

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.

Gnimuc avatar Mar 23 '20 11:03 Gnimuc

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));
│       |                                                           ^~~~~~~~~~~~~~~

drewrobson avatar Mar 25 '20 09:03 drewrobson

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

Gnimuc avatar Mar 25 '20 09:03 Gnimuc

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 avatar Mar 25 '20 10:03 drewrobson

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

drewrobson avatar Mar 25 '20 10:03 drewrobson

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

Gnimuc avatar Mar 25 '20 10:03 Gnimuc

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

Gnimuc avatar Mar 25 '20 12:03 Gnimuc

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

AmplitudeGravity avatar Apr 30 '20 20:04 AmplitudeGravity

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

Gnimuc avatar May 01 '20 03:05 Gnimuc

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 ...

mdav2 avatar May 18 '20 17:05 mdav2

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)

htyeim avatar May 19 '20 13:05 htyeim

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

henry2004y avatar Sep 03 '20 19:09 henry2004y

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"

kapple19 avatar Mar 26 '21 07:03 kapple19