# Cxx and 0.7

**URL:** <https://discourse.julialang.org/t/cxx-and-0-7/18907>\
**Category:** General Usage\
**Tags:** cxx\
**Created:** [December 21, 2018, 5:57pm UTC](https://discourse.julialang.org/t/cxx-and-0-7/18907 "2018-12-21T17:57:33Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![GlenHenshaw](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/glenhenshaw/32/5269_2.png) [@GlenHenshaw](https://discourse.julialang.org/u/GlenHenshaw)\
**Post date:** [December 21, 2018, 5:57pm UTC](https://discourse.julialang.org/t/cxx-and-0-7/18907/1 "2018-12-21T17:57:33Z")

</div>

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:

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

---

<div class="post-metadata">

**Author:** ![Mason](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mason/32/2423_2.png) [@Mason](https://discourse.julialang.org/u/Mason)\
**Post date:** [December 21, 2018, 6:20pm UTC](https://discourse.julialang.org/t/cxx-and-0-7/18907/2 "2018-12-21T18:20:59Z")

</div>

Are you able to switch to using [CxxWrap](https://github.com/JuliaInterop/CxxWrap.jl) instead? My understanding is that it’s a bit less pleasant to use but more stable and works on 1.0

---

<div class="post-metadata">

**Author:** ![GlenHenshaw](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/glenhenshaw/32/5269_2.png) [@GlenHenshaw](https://discourse.julialang.org/u/GlenHenshaw)\
**Post date:** [December 21, 2018, 6:24pm UTC](https://discourse.julialang.org/t/cxx-and-0-7/18907/3 "2018-12-21T18:24:10Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![GlenHenshaw](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/glenhenshaw/32/5269_2.png) [@GlenHenshaw](https://discourse.julialang.org/u/GlenHenshaw)\
**Post date:** [December 21, 2018, 6:26pm UTC](https://discourse.julialang.org/t/cxx-and-0-7/18907/4 "2018-12-21T18:26:08Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Tero\_Frondelius](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tero_frondelius/32/7629_2.png) [@Tero\_Frondelius](https://discourse.julialang.org/u/Tero_Frondelius)\
**Post date:** [December 21, 2018, 8:16pm UTC](https://discourse.julialang.org/t/cxx-and-0-7/18907/5 "2018-12-21T20:16:26Z")

</div>

> [@GlenHenshaw](#):
>
> I’d love to hear from anyone who has successfully gotten Cxx working with either 0.7 or 1.0…

[Here is claimed to get it working.](https://discourse.julialang.org/t/passing-function-pointer-to-cxx/1159/6)

---

<div class="post-metadata">

**Author:** ![GlenHenshaw](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/glenhenshaw/32/5269_2.png) [@GlenHenshaw](https://discourse.julialang.org/u/GlenHenshaw)\
**Post date:** [December 21, 2018, 8:22pm UTC](https://discourse.julialang.org/t/cxx-and-0-7/18907/6 "2018-12-21T20:22:15Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![GlenHenshaw](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/glenhenshaw/32/5269_2.png) [@GlenHenshaw](https://discourse.julialang.org/u/GlenHenshaw)\
**Post date:** [December 21, 2018, 10:14pm UTC](https://discourse.julialang.org/t/cxx-and-0-7/18907/7 "2018-12-21T22:14:50Z")

</div>

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 ([GitHub - JuliaInterop/Cxx.jl: The Julia C++ Interface](https://github.com/Keno/Cxx.jl.git))  
Updating `~/.julia/environments/v0.7/Manifest.toml`  
[a0b5b9ef] + Cxx v0.2.0+ #master ([GitHub - JuliaInterop/Cxx.jl: The Julia C++ Interface](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](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

---

<div class="post-metadata">

**Author:** ![Gnimuc](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gnimuc/32/2194_2.png) [@Gnimuc](https://discourse.julialang.org/u/Gnimuc)\
**Post date:** [December 22, 2018, 2:34am UTC](https://discourse.julialang.org/t/cxx-and-0-7/18907/8 "2018-12-22T02:34:14Z")

</div>

|Julia1.0: | Cxx source build | Cxx binary build(download and unzip prebuild binaries) |  
|:—:|:—:|:—:|:—😑  
| Linux | ✅ master | ✅ [comment](https://github.com/Keno/Cxx.jl/issues/390#issuecomment-443914331) |  
| maxOS| ✅ [PR#400](https://github.com/Keno/Cxx.jl/pull/400) | ✅ [comment](https://github.com/Keno/Cxx.jl/issues/390#issuecomment-443914331) |  
| Windows| ❌ | ❌|

---

<div class="post-metadata">

**Author:** ![barche](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/barche/32/79_2.png) [@barche](https://discourse.julialang.org/u/barche)\
**Post date:** [December 22, 2018, 8:12am UTC](https://discourse.julialang.org/t/cxx-and-0-7/18907/9 "2018-12-22T08:12:32Z")

</div>

> [@GlenHenshaw](#):
>
> It’s a bit hard to tell, but the README seems to imply that CxxWrap doesn’t support 0.7.

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