Skip to content
This repository was archived by the owner on Oct 4, 2025. It is now read-only.

Conversation

@Gnimuc
Copy link
Member

@Gnimuc Gnimuc commented Mar 25, 2020

Misc. update for LLVM 8.

Now the package can be built successfully, but I got these errors when using the package:

julia> using Cxx
58
BuiltinType 0x7f8de2802fc0 'unsigned long'
/Cxx.cpp:1:1: error: 'data' following the 'template' keyword does not refer to a template
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/string:1242:23: note: declared as a non-template here
    const value_type* data() const _NOEXCEPT  {return _VSTD::__to_raw_pointer(__get_pointer());}
                      ^
/Cxx.cpp:1:1: error: 'size' following the 'template' keyword does not refer to a template
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/string:946:41: note: declared as a non-template here
    _LIBCPP_INLINE_VISIBILITY size_type size() const _NOEXCEPT

Hi @Keno, could you give it a review?

@Gnimuc Gnimuc requested a review from Keno March 26, 2020 10:16
@innerlee
Copy link

innerlee commented Apr 10, 2020

I'm having precompiling error on 1.4.

julia> using Cxx
[ Info: Precompiling Cxx [a0b5b9ef-44b7-5148-a2d1-f6db19f3c3d2]
ERROR: LoadError: LoadError: AssertionError: isdir(cxxclangdir)
Stacktrace:
 [1] collectClangHeaders!(::Array{Tuple{String,Int32},1}) at /home/lizz/.julia/packages/Cxx/7Ms5P/src/initialization.jl:
380
 [2] collectAllHeaders!(::Array{Tuple{String,Int32},1}, ::Bool) at /home/lizz/.julia/packages/Cxx/7Ms5P/src/initializati
on.jl:390
 [3] collectAllHeaders(::Bool) at /home/lizz/.julia/packages/Cxx/7Ms5P/src/initialization.jl:393
 [4] top-level scope at /home/lizz/.julia/packages/Cxx/7Ms5P/src/initialization.jl:423
 [5] include(::Module, ::String) at ./Base.jl:377
 [6] include(::String) at /home/lizz/.julia/packages/Cxx/7Ms5P/src/Cxx.jl:144
 [7] top-level scope at /home/lizz/.julia/packages/Cxx/7Ms5P/src/Cxx.jl:170
 [8] include(::Module, ::String) at ./Base.jl:377
 [9] top-level scope at none:2
 [10] eval at ./boot.jl:331 [inlined]
 [11] eval(::Expr) at ./client.jl:449
 [12] top-level scope at ./none:3
in expression starting at /home/lizz/.julia/packages/Cxx/7Ms5P/src/initialization.jl:423
in expression starting at /home/lizz/.julia/packages/Cxx/7Ms5P/src/Cxx.jl:170
ERROR: Failed to precompile Cxx [a0b5b9ef-44b7-5148-a2d1-f6db19f3c3d2] to /home/lizz/.julia/compiled/v1.4/Cxx/ESGkI_BmH2
D.ji.
Stacktrace:
 [1] error(::String) at ./error.jl:33
 [2] compilecache(::Base.PkgId, ::String) at ./loading.jl:1272
 [3] _require(::Base.PkgId) at ./loading.jl:1029
 [4] require(::Base.PkgId) at ./loading.jl:927
 [5] require(::Module, ::Symbol) at ./loading.jl:922

The build step is okay.

image

@Gnimuc
Copy link
Member Author

Gnimuc commented Apr 10, 2020

@innerlee it looks like Cxx failed to detect your system-headers. You could try to print some of those variables around the error site to see why it cannot do that.

@innerlee
Copy link

Could you give some instructions on how to do it? I'm not very familiar with cpp

@Gnimuc
Copy link
Member Author

Gnimuc commented Apr 10, 2020

The following error occurred in the Julia side, if you're working in REPL, simply typing 1+Ctrl+Q will bring you to the first error site. ;)

julia> using Cxx
[ Info: Precompiling Cxx [a0b5b9ef-44b7-5148-a2d1-f6db19f3c3d2]
ERROR: LoadError: LoadError: AssertionError: isdir(cxxclangdir)
Stacktrace:
 [1] collectClangHeaders!(::Array{Tuple{String,Int32},1}) at /home/lizz/.julia/packages/Cxx/7Ms5P/src/initialization.jl:
380
 [2] collectAllHeaders!(::Array{Tuple{String,Int32},1}, ::Bool) at /home/lizz/.julia/packages/Cxx/7Ms5P/src/initializati
on.jl:390
 [3] collectAllHeaders(::Bool) at /home/lizz/.julia/packages/Cxx/7Ms5P/src/initialization.jl:393
 [4] top-level scope at /home/lizz/.julia/packages/Cxx/7Ms5P/src/initialization.jl:423
 [5] include(::Module, ::String) at ./Base.jl:377

@innerlee
Copy link

Thanks! Like magic haha. I'm around somewhere like

The 3rd error site:

        if JLOptions().use_compiled_modules != 0
            if (0 == ccall(:jl_generating_output, Cint, ())) || (JLOptions().incremental != 0)
                # spawn off a new incremental pre-compile task for recursive `require` calls
                # or if the require search declared it was pre-compiled before (and therefore is e$
                cachefile = compilecache(pkg, path)                              <------------------- THIS LINE
                if isa(cachefile, Exception)
                    if precompilableerror(cachefile)
                        verbosity = isinteractive() ? CoreLogging.Info : CoreLogging.Debug
                        @logmsg verbosity "Skipping precompilation since __precompile__(false). Im$
                    else
                        @warn "The call to compilecache failed to create a usable precompiled cach$
                    end
                    # fall-through to loading the file locally
                else
                    m = _require_from_serialized(cachefile)
                    if isa(m, Exception)
                        @warn "The call to compilecache failed to create a usable precompiled cach$
                    else
                        return
                    end
                end
            end
        end

Which variable should I print then? I tried to put some println before that line, but nothing got printed.

@Gnimuc
Copy link
Member Author

Gnimuc commented Apr 10, 2020

Could you run this and check what you got?
joinpath(get(ENV, "BASE_JULIA_BIN", Sys.BINDIR), "..", "lib", "clang", llvmver, "include") |> isdir

If the ans is no, please check the path.jl generated in the dir: Cxx/deps/, it might be wrong.

BTW, Cxx is still not fully functional with this PR. I'm trying to get a clue how to fix those underlying Clang-related errors, but making nearly no progress, so I would recommend using Julia 1.3.x for now if you'd like to use Cxx.jl.

@innerlee
Copy link

Okay, I will wait for this pr then. I was trying to play with some basic cpp codes, and using this cxx repl as a live notebook. Anyway, printing debug is always a choice for me :D

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants