Cxx and 0.7


#1

I’m trying to port some 0.6 code to 1.0 by way of 0.7, and I’m having trouble with the Cxx package.

Yes, I know Cxx is in an intermediate state. But this code is mission critical, so I don’t really have a choice but go forward with it.

My problem:

  • with the Julia 0.7 binary, I get a “JULIA_HOME” not defined error when adding Cxx. This appears to be a known problem. The suggested fix is to build Julia from source.

  • when built from source, the Cxx package adds and builds, but in use it reports that it can’t find random, name-mangled functions in the library I’m trying to call. The suggested fix is to build Julia with Clang.

  • when built from source with Clang, ]build Cxx halts with the following error:

    Error: Error building Cxx:
    │ WARNING: JULIA_HOME environment variable is renamed to JULIA_BINDIR
    │ g++ -D_GLIBCXX_USE_CXX11_ABI=1 -fno-rtti -DLIBRARY_EXPORTS -fPIC -O0 -g -std=c++11 -
    I/home/glen/Code/julia-0.7.0/usr/bin/…/…/src/support -I/home/glen/Code/julia-0.7.0/usr/bin/…/include -I/home/glen/Code/julia-0.7.0/usr/bin/…/…/deps/srccache/llvm-6.0.0/tools/clang/lib -I/home/glen/Code/julia-0.7.0/usr/bin/…/…/deps/llvm-6.0.0/tools/clang/lib -c …/src/bootstrap.cpp -o build/bootstrap.o
    │ Not building debug library because corresponding julia DEBUG library does not exist.
    │ To build, simply run the build again once the library at
    │ /libjulia-debug.so
    │ has been built.
    │ …/src/bootstrap.cpp:55:10: fatal error: clang/Sema/ScopeInfo.h: No such file or directory
    #include “clang/Sema/ScopeInfo.h”
    │ ^~~~~~~~~~~~~~~~~~~~~~~~
    │ compilation terminated.

Suggestions, please. I’m open to anything that will let me get this code working. I’m using a relatively stock Ubuntu 18.04 system. In all cases I’ve checked out the Cxx#master branch via Pkg.


#2

Are you able to switch to using CxxWrap instead? My understanding is that it’s a bit less pleasant to use but more stable and works on 1.0


#3

It’s a bit hard to tell, but the README seems to imply that CxxWrap doesn’t support 0.7.

It would be a lot more work.


#4

I’d love to hear from anyone who has successfully gotten Cxx working with either 0.7 or 1.0…


#5

Here is claimed to get it working.


#6

Interesting. That particular example works for me under 1.0.3 as well. I have not tried running my code under 1.0 because I need it to run under 0.7 first. I built 1.0.3 from source, but not using Clang.

I am now rebuilding 0.7.0 without Clang, to see whether the example works there as well. Updates as they happen.


#7

No joy. I built a fresh Julia 0.7.0 from source, including all the dependencies. I then get:

(v0.7) pkg> add Cxx#master
    Updating git-repo `https://github.com/Keno/Cxx.jl.git`

┌ Warning: project file for Cxx at /tmp/tmp9P4aqW is missing a version entry
└ @ Pkg.Types ~/Code/julia-0.7.0/usr/share/julia/stdlib/v0.7/Pkg/src/Types.jl:700
Resolving package versions…
Updating ~/.julia/environments/v0.7/Project.toml
[a0b5b9ef] + Cxx v0.2.0+ #master (https://github.com/Keno/Cxx.jl.git)
Updating ~/.julia/environments/v0.7/Manifest.toml
[a0b5b9ef] + Cxx v0.2.0+ #master (https://github.com/Keno/Cxx.jl.git)
Building Cxx → ~/.julia/packages/Cxx/81BGP/deps/build.log
┌ Error: Error building Cxx:
│ WARNING: JULIA_HOME environment variable is renamed to JULIA_BINDIR
│ mkdir src
│ curl -Lo src/cfe-6.0.0.src.tar.xz http://releases.llvm.org/6.0.0/cfe-6.0.0.src.tar.xz
│ Not building debug library because corresponding julia DEBUG library does not exist.
│ To build, simply run the build again once the library at
│ /libjulia-debug.so
│ has been built.
│ % Total % Received % Xferd Average Speed Time Time Time Current
│ Dload Upload Total Spent Left Speed
100 5307 0 5307 0 0 80409 0 --:–:-- --:–:-- --:–:-- 80409
│ mkdir -p src/clang-6.0.0
│ tar -C src/clang-6.0.0 --strip-components=1 -xf src/cfe-6.0.0.src.tar.xz
│ xz: (stdin): File format not recognized
│ tar: Child returned status 1
│ tar: Error is not recoverable: exiting now
│ BuildBootstrap.Makefile:103: recipe for target ‘src/clang-6.0.0’ failed
│ make: *** [src/clang-6.0.0] Error 2
│ [ Info: Building julia source build
│ ERROR: LoadError: failed process: Process(make -j12 -f BuildBootstrap.Makefile BASE_JULIA_BIN=/home/glen/Code/julia-0.7.0/usr/bin BASE_JULIA_SRC=/home/glen/Code/julia-0.7.0/usr/bin/../.., ProcessExited(2)) [2]
│ Stacktrace:
│ [1] error(::String, ::Base.Process, ::String, ::Int64, ::String) at ./error.jl:42
│ [2] pipeline_error at ./process.jl:712 [inlined]
│ [3] #run#509(::Bool, ::Function, ::Cmd) at ./process.jl:670
│ [4] run(::Cmd) at ./process.jl:668
│ [5] top-level scope at none:0
│ [6] include at ./boot.jl:317 [inlined]
│ [7] include_relative(::Module, ::String) at ./loading.jl:1038
│ [8] include(::Module, ::String) at ./sysimg.jl:29
│ [9] include(::String) at ./client.jl:398
│ [10] top-level scope at none:0
│ in expression starting at /home/glen/.julia/packages/Cxx/81BGP/deps/build.jl:54
│ writing path.jl file
│ Tuning for julia installation at /home/glen/Code/julia-0.7.0/usr/bin with sources possibly at /home/glen/Code/julia-0.7.0/usr/bin/…/…
└ @ Pkg.Operations ~/Code/julia-0.7.0/usr/share/julia/stdlib/v0.7/Pkg/src/Operations.jl:1068


#8
Julia1.0: Cxx source build Cxx binary build(download and unzip prebuild binaries)
Linux :white_check_mark: master :white_check_mark: comment
maxOS :white_check_mark: PR#400 :white_check_mark: comment
Windows :x: :x:

Current state of Cxx.jl?
#9

CxxWrap 0.7.4 supports Julia 0.7 and 1.0. Later versions only support Julia 1.0.