# Trouble creating a module from CxxWrap'ped code

**URL:** https://discourse.julialang.org/t/trouble-creating-a-module-from-cxxwrapped-code/28770
**Category:** General Usage
**Tags:** cxx, cxxwrap
**Created:** [September 14, 2019, 10:44pm UTC](https://discourse.julialang.org/t/trouble-creating-a-module-from-cxxwrapped-code/28770 "2019-09-14T22:44:30Z")
**Posts on this page:** 19
**Page:** 1

<div class="post-metadata">

### Author: ![atombear](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/atombear/32/8488_2.png) [@atombear](https://discourse.julialang.org/u/atombear)
#### Post date: [September 14, 2019, 10:44pm UTC](https://discourse.julialang.org/t/trouble-creating-a-module-from-cxxwrapped-code/28770/1 "2019-09-14T22:44:30Z")

</div>

I am totally baffled by this.

I have been wrapping a c++ simulations package using cxxwrap learning plenty of c++, and generally getting everything to work.

I prepared tests in the canonical way, and saw that I could run each `test_*.jl` file as a script, successfully.

I ran into a serious problem when I was trying to package everything. I generated a Project.toml, `add`ed dependencies in the `]` repl, and then when I tried to use the package in this fashion, it was broken. Enums I had previously wrapped were coming back as `Tuple{Core.Compiler.UseRef,Nothing}`. That is to say, when I was using the code NOT as a standalone package, but by using `dev .`, everything worked. When I tried to make it a real package, write a proper `Project.toml`, and import the code using `activate .`, Enums are no longer represented as anything recognizable.

Any help would be greatly appreciated!

---

<div class="post-metadata">

### Author: ![jstrube](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jstrube/32/525_2.png) [@jstrube](https://discourse.julialang.org/u/jstrube)
#### Post date: [September 14, 2019, 10:50pm UTC](https://discourse.julialang.org/t/trouble-creating-a-module-from-cxxwrapped-code/28770/2 "2019-09-14T22:50:38Z")

</div>

Not sure if this is related, but there is a new branch in cxxwrap to address issues with enums. Can you try the type\_overhaul branch?

Maybe your dev environment uses a different version of Cxxwrap than the package you’re creating? Just speculating here…

---

<div class="post-metadata">

### Author: ![atombear](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/atombear/32/8488_2.png) [@atombear](https://discourse.julialang.org/u/atombear)
#### Post date: [September 15, 2019, 1:43am UTC](https://discourse.julialang.org/t/trouble-creating-a-module-from-cxxwrapped-code/28770/3 "2019-09-15T01:43:02Z")

</div>

i cloned it and tried to incorporate it with `dev .` and i get the following error:  
`/CxxWrap.jl/deps/deps.jl not found, CxxWrap did not build properly`

---

<div class="post-metadata">

### Author: ![jstrube](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jstrube/32/525_2.png) [@jstrube](https://discourse.julialang.org/u/jstrube)
#### Post date: [September 19, 2019, 3:25am UTC](https://discourse.julialang.org/t/trouble-creating-a-module-from-cxxwrapped-code/28770/4 "2019-09-19T03:25:12Z")

</div>

Do you need do dev it?  
If you do

```julia
add CxxWrap#type_overhaul
build CxxWrap
test CxxWrap

```

Does it work then?

---

<div class="post-metadata">

### Author: ![atombear](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/atombear/32/8488_2.png) [@atombear](https://discourse.julialang.org/u/atombear)
#### Post date: [September 19, 2019, 2:36pm UTC](https://discourse.julialang.org/t/trouble-creating-a-module-from-cxxwrapped-code/28770/5 "2019-09-19T14:36:56Z")

</div>

i did not know this was possible - thank you! however i tried it and was confronted with the following:

```julia

Building CxxWrap → `~/.julia/packages/CxxWrap/m6fg0/deps/build.log`
┌ Error: Error building `CxxWrap`:
│ [Info: Downloading [https://github.com/JuliaInterop/libcxxwrap-julia/releases/download/v0.5.3/libcxxwrap-julia-1.0.v0.5.3.x86_64-linux-gnu-gcc7-cxx11.tar.gz](https://github.com/JuliaInterop/libcxxwrap-julia/releases/download/v0.5.3/libcxxwrap-julia-1.0.v0.5.3.x86_64-linux-gnu-gcc7-cxx11.tar.gz) to /home/alexander/.julia/packages/CxxWrap/m6fg0/deps/usr/downloads/libcxxwrap-julia-1.0.v0.5.3.x86_64-linux-gnu-gcc7-cxx11.tar.gz...
│ ERROR: LoadError: LibraryProduct(nothing, ["libcxxwrap_julia_stl"], :libcxxwrap_julia_stl, "Prefix(/home/alexander/.julia/packages/CxxWrap/m6fg0/deps/usr)") is not satisfied, cannot generate deps.jl!
│ Stacktrace:
│ [1] error(::String) at ./error.jl:33
│ [2] #write_deps_file#152(::Bool, ::Function, ::String, ::Array{Product,1}) at /home/alexander/.julia/packages/BinaryProvider/TcAwt/src/Products.jl:414
│ [3] write_deps_file(::String, ::Array{Product,1}) at /home/alexander/.julia/packages/BinaryProvider/TcAwt/src/Products.jl:395
│ [4] top-level scope at none:0
│ [5] include at ./boot.jl:326 [inlined]
│ [6] include_relative(::Module, ::String) at ./loading.jl:1038
│ [7] include(::Module, ::String) at ./sysimg.jl:29
│ [8] include(::String) at ./client.jl:403
│ [9] top-level scope at none:0
│ in expression starting at /home/alexander/.julia/packages/CxxWrap/m6fg0/deps/build.jl:55
[07:34:49] ######################################################################## 100.0%

```

---

<div class="post-metadata">

### Author: ![jstrube](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jstrube/32/525_2.png) [@jstrube](https://discourse.julialang.org/u/jstrube)
#### Post date: [September 19, 2019, 2:52pm UTC](https://discourse.julialang.org/t/trouble-creating-a-module-from-cxxwrapped-code/28770/6 "2019-09-19T14:52:34Z")

</div>

Ah. Right. Not sure if that’s what you’re seeing, but CxxWrap needs another library to build, and that’s also on a type\_overhaul branch…  
Sorry for the incomplete instructions, I know how annoying that is.  
Can you build the libcxxwrap library and then follow this post? [https://github.com/JuliaInterop/CxxWrap.jl/issues/146#issuecomment-519438616](https://github.com/JuliaInterop/CxxWrap.jl/issues/146#issuecomment-519438616)

You’ll need to clone the repo, add a parent folder JuliaInterop and then call the libraries build.jl from the parent folder of that.  
Hope that makes sense…

---

<div class="post-metadata">

### Author: ![atombear](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/atombear/32/8488_2.png) [@atombear](https://discourse.julialang.org/u/atombear)
#### Post date: [September 22, 2019, 1:32pm UTC](https://discourse.julialang.org/t/trouble-creating-a-module-from-cxxwrapped-code/28770/7 "2019-09-22T13:32:48Z")

</div>

I have a few questions it turns out.

1. I clone `libcxxwrap-julia`, checkout `type_overhaul` locally, `mkdir build`, `cd build`, `cmake ../`, `make`, seemingly successfully. I see a number of the shared objects i expect i need.

2. I clone `CxxWrap` and checkout `type_overhaul`.

3. I’m not sure how to package the resulting `libcxxwrap-julia` into a tarball, or how to change build.jl accordingly.

4. I tried to circumvent this by running `build .` in CxxWrap in the standard way, and then replacing the shared objects in `deps/usr/lib` with those created by `make`ing `libcxxwrap-julia`. doing that however yields the following error in testing:

signal (11): Segmentation fault  
in expression starting at /home/alexander/CxxWrap.jl/src/StdLib.jl:15  
unknown function (ip: 0xffffffffffffffff)  
Allocations: 5700824 (Pool: 5699645; Big: 1179); GC: 12  
ERROR: LoadError: LoadError: Failed to precompile CxxWrap [1f15a43c-97ca-5a2a-ae31-89f07a497df4] to /home/alexander/.julia/compiled/v1.1/CxxWrap/WGIJU.ji.  
Stacktrace:  
[1] error(::String) at ./error.jl:33  
[2] compilecache(::Base.PkgId, ::String) at ./loading.jl:1197  
[3] \_require(::Base.PkgId) at ./loading.jl:960  
[4] require(::Base.PkgId) at ./loading.jl:858  
[5] require(::Module, ::Symbol) at ./loading.jl:853  
[6] include at ./boot.jl:326 [inlined]  
[7] include\_relative(::Module, ::String) at ./loading.jl:1038  
[8] include(::Module, ::String) at ./sysimg.jl:29  
[9] include(::String) at ./client.jl:403  
[10] top-level scope at none:0  
[11] include at ./boot.jl:326 [inlined]  
[12] include\_relative(::Module, ::String) at ./loading.jl:1038  
[13] include(::Module, ::String) at ./sysimg.jl:29  
[14] include(::String) at ./client.jl:403  
[15] top-level scope at none:0

---

<div class="post-metadata">

### Author: ![jstrube](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jstrube/32/525_2.png) [@jstrube](https://discourse.julialang.org/u/jstrube)
#### Post date: [September 22, 2019, 5:48pm UTC](https://discourse.julialang.org/t/trouble-creating-a-module-from-cxxwrapped-code/28770/8 "2019-09-22T17:48:41Z")

</div>

Try the following:

1. 

```julia
mkdir JuliaInterop
cd JuliaInterop
git clone https://github.com/JuliaInterop/libcxxwrap-julia.git
cd libcxxwrap-julia
git checkout type_overhaul
cd ../..
julia JuliaInterop/libcxxwrap-julia/.ci/build_tarballs.jl

```

This builds the tarballs in the directory `products`.
2. Either checkout the `type_overhaul` branch of CxxWrap in the julia package manager and set the envvar as explained in the CxxWrap issue, or do what you did and `dev` the CxxWrap package, checkout the `type_overhaul` branch, and edit the `deps/build.jl` file to point to your local file for the libcxxwrap tar ball that you just built, instead of the one on the web. Just use the absolute path. You’ll need to specify the checksum, which you can get with `sha256sum <filename>`.
3. After modifying the build file (or specifying the envvar) you should be able to just `] build CxxWrap`.

---

<div class="post-metadata">

### Author: ![atombear](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/atombear/32/8488_2.png) [@atombear](https://discourse.julialang.org/u/atombear)
#### Post date: [September 22, 2019, 7:47pm UTC](https://discourse.julialang.org/t/trouble-creating-a-module-from-cxxwrapped-code/28770/9 "2019-09-22T19:47:06Z")

</div>

I get stopped by this:

```julia

if VERSION >= v"1.1"
    exit()
end

```

i will comment that out and see how it goes…

---

<div class="post-metadata">

### Author: ![jstrube](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jstrube/32/525_2.png) [@jstrube](https://discourse.julialang.org/u/jstrube)
#### Post date: [September 22, 2019, 8:34pm UTC](https://discourse.julialang.org/t/trouble-creating-a-module-from-cxxwrapped-code/28770/10 "2019-09-22T20:34:44Z")

</div>

Yes, I saw that, too. @barche, is that really intended? What’s the reason for putting that there? Seems to work fine without this.

---

<div class="post-metadata">

### Author: ![atombear](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/atombear/32/8488_2.png) [@atombear](https://discourse.julialang.org/u/atombear)
#### Post date: [September 22, 2019, 10:14pm UTC](https://discourse.julialang.org/t/trouble-creating-a-module-from-cxxwrapped-code/28770/11 "2019-09-22T22:14:02Z")

</div>

i don’t mean to keep posting stack traces, but…

```julia

[ Info: Building for x86_64-linux-gnu-gcc7-cxx11, x86_64-linux-gnu-gcc8-cxx11, x86_64-w64-mingw32-gcc7-cxx11, x86_64-w64-mingw32-gcc8-cxx11, i686-w64-mingw32-gcc7-cxx11, i686-w64-mingw32-gcc8-cxx11, x86_64-apple-darwin14
At line 288, ABORTED (Operation not permitted)!
At line 1171, ABORTED (Success)!
ERROR: LoadError: Build for libcxxwrap-julia-1.0 on x86_64-linux-gnu-gcc7-cxx11 did not complete successfully

Stacktrace:
 [1] error(::String) at ./error.jl:33
 [2] #build#184(::Bool, ::Bool, ::Bool, ::Bool, ::Bool, ::Array{String,1}, ::Bool, ::Function, ::BinaryBuilder.UserNSRunner, ::String, ::Array{LibraryProduct,1}, ::String, ::Linux, ::Prefix) at /home/alexander/.julia/packages/BinaryBuilder/vkHhH/src/AutoBuild.jl:565
 [3] (::getfield(BinaryBuilder, Symbol("#kw##build")))(::NamedTuple{(:verbose, :ignore_manifests, :debug),Tuple{Bool,Array{String,1},Bool}}, ::typeof(build), ::BinaryBuilder.UserNSRunner, ::String, ::Array{LibraryProduct,1}, ::String, ::Linux, ::Prefix) at ./none:0
 [4] (::getfield(BinaryBuilder, Symbol("##173#179")){Bool,Base.Iterators.Pairs{Symbol,Bool,Tuple{Symbol},NamedTuple{(:debug,),Tuple{Bool}}},String,String,VersionNumber,String,Array{Platform,1},getfield(Main, Symbol("##3#4")),Array{String,1}})(::String) at /home/alexander/.julia/packages/BinaryBuilder/vkHhH/src/AutoBuild.jl:391
 [5] mktempdir(::getfield(BinaryBuilder, Symbol("##173#179")){Bool,Base.Iterators.Pairs{Symbol,Bool,Tuple{Symbol},NamedTuple{(:debug,),Tuple{Bool}}},String,String,VersionNumber,String,Array{Platform,1},getfield(Main, Symbol("##3#4")),Array{String,1}}, ::String) at ./file.jl:581
 [6] mktempdir at ./file.jl:579 [inlined]
 [7] #autobuild#171(::Bool, ::Base.Iterators.Pairs{Symbol,Bool,Tuple{Symbol},NamedTuple{(:debug,),Tuple{Bool}}}, ::Function, ::String, ::String, ::VersionNumber, ::Array{String,1}, ::String, ::Array{Platform,1}, ::getfield(Main, Symbol("##3#4")), ::Array{String,1}) at /home/alexander/.julia/packages/BinaryBuilder/vkHhH/src/AutoBuild.jl:279
 [8] (::getfield(BinaryBuilder, Symbol("#kw##autobuild")))(::NamedTuple{(:verbose, :debug),Tuple{Bool,Bool}}, ::typeof(autobuild), ::String, ::String, ::VersionNumber, ::Array{String,1}, ::String, ::Array{Platform,1}, ::getfield(Main, Symbol("##3#4")), ::Array{String,1}) at ./none:0
 [9] #build_tarballs#160(::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}, ::Function, ::Array{String,1}, ::String, ::VersionNumber, ::Array{String,1}, ::String, ::Array{Platform,1}, ::getfield(Main, Symbol("##3#4")), ::Array{String,1}) at /home/alexander/.julia/packages/BinaryBuilder/vkHhH/src/AutoBuild.jl:117
 [10] build_tarballs(::Array{String,1}, ::String, ::VersionNumber, ::Array{String,1}, ::String, ::Array{Platform,1}, ::Function, ::Array{String,1}) at /home/alexander/.julia/packages/BinaryBuilder/vkHhH/src/AutoBuild.jl:21
 [11] top-level scope at none:0
 [12] include at ./boot.jl:326 [inlined]
 [13] include_relative(::Module, ::String) at ./loading.jl:1038
 [14] include(::Module, ::String) at ./sysimg.jl:29
 [15] exec_options(::Base.JLOptions) at ./client.jl:267
 [16] _start() at ./client.jl:436
in expression starting at /home/alexander/JuliaInterop/libcxxwrap-julia/.ci/build_tarballs.jl:65

```

---

<div class="post-metadata">

### Author: ![jstrube](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jstrube/32/525_2.png) [@jstrube](https://discourse.julialang.org/u/jstrube)
#### Post date: [September 23, 2019, 12:39am UTC](https://discourse.julialang.org/t/trouble-creating-a-module-from-cxxwrapped-code/28770/12 "2019-09-23T00:39:02Z")

</div>

Hmm. That’s not something I’ve seen before.  
Looks like BinaryBuilder doesn’t work on your system, but I’m speculating.

cc’ing @barche for insight.  
Which architecture do you need? Maybe start by commenting out all of the ones you don’t need…

Another idea would be to fork the repo and use travis to build your tarballs…

---

<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: [September 23, 2019, 9:35am UTC](https://discourse.julialang.org/t/trouble-creating-a-module-from-cxxwrapped-code/28770/13 "2019-09-23T09:35:10Z")

</div>

> [@jstrube](#):
>
> Yes, I saw that, too. @barche, is that really intended? What’s the reason for putting that there? Seems to work fine without this.

It is because Julia itself is a binary dependency for libcxxwrap-julia. To get Julia in a BinaryBuilder-compatible way, it is downloaded from [Releases · JuliaPackaging/JuliaBuilder · GitHub](https://github.com/JuliaPackaging/JuliaBuilder/releases), but this only has the 1.0 version. So to run the `build_tarballs.jl` script locally you must indeed remove this version check.

**edit:** I just realized this made the tests for julia \> 1.0 fail, so it is removed from the source. But regardless of the Julia used to execute the `build_tarballs.jl`, it will always build against Julia 1.0.

> [@jstrube](#):
>
> Hmm. That’s not something I’ve seen before.  
> Looks like BinaryBuilder doesn’t work on your system, but I’m speculating.

Yes, the last trace looks like a permission problem starting the container, normally it should ask for a sudo password. CC’ing @staticfloat for this.

Regarding a custom build of CxxWrap: it is easier to just build it directly using standard CMake commands, and then set `ENV["JLCXX_DIR"]` to the CMake build directory before doing `Pkg.build("CxxWrap")`. I recommend using the `type_overhaul` branch for new work, this should be close to release now (just a few more failing tests on Travis and a fix for Julia 1.3 to go).

---

<div class="post-metadata">

### Author: ![staticfloat](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/staticfloat/32/34_2.png) [@staticfloat](https://discourse.julialang.org/u/staticfloat)
#### Post date: [September 24, 2019, 7:36am UTC](https://discourse.julialang.org/t/trouble-creating-a-module-from-cxxwrapped-code/28770/14 "2019-09-24T07:36:42Z")

</div>

Yep, looks like BinaryBuilder is freaking out. Your error points to [line 288](https://github.com/JuliaPackaging/Yggdrasil/blob/master/0_RootFS/Rootfs/bundled/utils/sandbox.c#L288) within the User Namespace sandbox, so my best guess is that you’re on a system that doesn’t have the User Namespace patches to the kernel (Arch Linux is one example that does not have this). This is strange however, as BB should be auto-detecting that this fails and attempting to use `sudo` to get around it, as Barche mentioned. The only case in which this wouldn’t happen would be if you were to run it with the environment variable `BINARYBUILDER_RUNNER=unprivileged`, but I’m assuming you don’t have that defined.

Could you print out the value of `BinaryBuilder.versioninfo()`?

---

<div class="post-metadata">

### Author: ![atombear](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/atombear/32/8488_2.png) [@atombear](https://discourse.julialang.org/u/atombear)
#### Post date: [September 30, 2019, 3:54pm UTC](https://discourse.julialang.org/t/trouble-creating-a-module-from-cxxwrapped-code/28770/15 "2019-09-30T15:54:19Z")

</div>

Ok, so another day another traceback

what i did:

1. `cd ~/JuliaInterop/libcxxwrap-julia/`

2. `git checkout type_overhaul`

3. `mkdir build`

4. `cd build`

5. `cmake ../`

6. `make`

7. `cd ~/CxxWrap.jl/`

8. `git checkout type_overhaul`

9. `julia`

10. `ENV["JLCXX_DIR"]="/home/alexander/JuliaInterop/libcxxwrap-julia/build"`

11. `]`

12. `activate .`

13. `build`

then from the package i want to use this in:

1. `]`

2. `activate .`

3. `dev ~/CxxWrap.jl/`

4. `test`

```julia
julia: /home/alexander/JuliaInterop/libcxxwrap-julia/src/jlcxx.cpp:46: jlcxx::cxxint_t jlcxx::Module::store_pointer(void*): Assertion `ptr != nullptr' failed.

signal (6): Aborted
in expression starting at /home/alexander/pairinteraction_fork/pairinteraction/PairInteraction.jl/src/PairInteraction.jl:10
__libc_signal_restore_set at /build/glibc-OTsEL5/glibc-2.27/signal/../sysdeps/unix/sysv/linux/nptl-signals.h:80 [inlined]
raise at /build/glibc-OTsEL5/glibc-2.27/signal/../sysdeps/unix/sysv/linux/raise.c:48
abort at /build/glibc-OTsEL5/glibc-2.27/stdlib/abort.c:79
__assert_fail_base at /build/glibc-OTsEL5/glibc-2.27/assert/assert.c:92
__assert_fail at /build/glibc-OTsEL5/glibc-2.27/assert/assert.c:101
_ZN5jlcxx6Module13store_pointerEPv at /home/alexander/CxxWrap.jl/deps/../../JuliaInterop/libcxxwrap-julia/build/lib/libcxxwrap_julia.so (unknown line)
_ZN5jlcxx19FunctionWrapperBase19set_pointer_indicesEv at /home/alexander/CxxWrap.jl/deps/../../JuliaInterop/libcxxwrap-julia/build/lib/libcxxwrap_julia.so (unknown line)
_ZN5jlcxx6Module17add_type_internalI18MatrixElementCacheNS_13ParameterListIJEEE14_jl_datatype_tEENS_11TypeWrapperIT_EERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPT1_ at /home/alexander/pairinteraction_fork/pairinteraction/build/pairinteraction/libpireal.so (unknown line)
define_julia_module at /home/alexander/pairinteraction_fork/pairinteraction/build/pairinteraction/libpireal.so (unknown line)
register_julia_module at /home/alexander/CxxWrap.jl/deps/../../JuliaInterop/libcxxwrap-julia/build/lib/libcxxwrap_julia.so (unknown line)
register_julia_module at /home/alexander/CxxWrap.jl/src/CxxWrap.jl:278 [inlined]
readmodule at /home/alexander/CxxWrap.jl/src/CxxWrap.jl:564
wrapmodule at /home/alexander/CxxWrap.jl/src/CxxWrap.jl:570
jl_fptr_trampoline at /buildworker/worker/package_linux64/build/src/gf.c:1864
jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2219
do_call at /buildworker/worker/package_linux64/build/src/interpreter.c:323
eval_value at /buildworker/worker/package_linux64/build/src/interpreter.c:411
eval_stmt_value at /buildworker/worker/package_linux64/build/src/interpreter.c:362 [inlined]
eval_body at /buildworker/worker/package_linux64/build/src/interpreter.c:773
jl_interpret_toplevel_thunk_callback at /buildworker/worker/package_linux64/build/src/interpreter.c:885
unknown function (ip: 0xfffffffffffffffe)
unknown function (ip: 0x7fa423fc271f)
unknown function (ip: (nil))
jl_interpret_toplevel_thunk at /buildworker/worker/package_linux64/build/src/interpreter.c:894
jl_toplevel_eval_flex at /buildworker/worker/package_linux64/build/src/toplevel.c:764
jl_eval_module_expr at /buildworker/worker/package_linux64/build/src/toplevel.c:179
jl_toplevel_eval_flex at /buildworker/worker/package_linux64/build/src/toplevel.c:614
jl_parse_eval_all at /buildworker/worker/package_linux64/build/src/ast.c:883
jl_load at /buildworker/worker/package_linux64/build/src/toplevel.c:826
include at ./boot.jl:326 [inlined]
include_relative at ./loading.jl:1038
include at ./sysimg.jl:29
jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2219
do_call at /buildworker/worker/package_linux64/build/src/interpreter.c:323
eval_value at /buildworker/worker/package_linux64/build/src/interpreter.c:411
eval_stmt_value at /buildworker/worker/package_linux64/build/src/interpreter.c:362 [inlined]
eval_body at /buildworker/worker/package_linux64/build/src/interpreter.c:773
eval_body at /buildworker/worker/package_linux64/build/src/interpreter.c:689
jl_interpret_toplevel_thunk_callback at /buildworker/worker/package_linux64/build/src/interpreter.c:885
unknown function (ip: 0xfffffffffffffffe)
unknown function (ip: 0x7fa441c460df)
unknown function (ip: 0x2)
jl_interpret_toplevel_thunk at /buildworker/worker/package_linux64/build/src/interpreter.c:894
jl_toplevel_eval_flex at /buildworker/worker/package_linux64/build/src/toplevel.c:764
jl_toplevel_eval_in at /buildworker/worker/package_linux64/build/src/toplevel.c:793
eval at ./boot.jl:328 [inlined]
eval at ./client.jl:404
jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2219
top-level scope at ./none:3
jl_fptr_trampoline at /buildworker/worker/package_linux64/build/src/gf.c:1864
jl_toplevel_eval_flex at /buildworker/worker/package_linux64/build/src/toplevel.c:758
jl_toplevel_eval_in at /buildworker/worker/package_linux64/build/src/toplevel.c:793
eval at ./boot.jl:328
jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2219
exec_options at ./client.jl:243
_start at ./client.jl:436
jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2219
jl_apply at /buildworker/worker/package_linux64/build/ui/../src/julia.h:1571 [inlined]
true_main at /buildworker/worker/package_linux64/build/ui/repl.c:96
main at /buildworker/worker/package_linux64/build/ui/repl.c:217
__libc_start_main at /build/glibc-OTsEL5/glibc-2.27/csu/../csu/libc-start.c:310
_start at /opt/julia-1.1.0/bin/julia (unknown line)
Allocations: 2829107 (Pool: 2828595; Big: 512); GC: 4

```

---

<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: [October 2, 2019, 8:24pm UTC](https://discourse.julialang.org/t/trouble-creating-a-module-from-cxxwrapped-code/28770/16 "2019-10-02T20:24:01Z")

</div>

Hi,

All of these steps look correct to me, is the C++ code for your `libpireal.so` available somewhere?

---

<div class="post-metadata">

### Author: ![atombear](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/atombear/32/8488_2.png) [@atombear](https://discourse.julialang.org/u/atombear)
#### Post date: [October 3, 2019, 4:08pm UTC](https://discourse.julialang.org/t/trouble-creating-a-module-from-cxxwrapped-code/28770/17 "2019-10-03T16:08:39Z")

</div>

though i suspect the problem is in cxxwrap on its own, i would appreciate any help!

[https://github.com/pairinteraction/pairinteraction/pull/100](https://github.com/pairinteraction/pairinteraction/pull/100)

---

<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: [October 6, 2019, 9:32pm UTC](https://discourse.julialang.org/t/trouble-creating-a-module-from-cxxwrapped-code/28770/18 "2019-10-06T21:32:20Z")

</div>

I started looking at this, but it would pay off I think to lookl at current CxxWrap master with libxxwrap-julia 0.6.2, since this contains support for std::vector, so you should now be able to simplify many methods to e.g.:

```nohighlight
.method("precalculateElectricMomentum", &MatrixElementCache::precalculateElectricMomentum)

```

---

<div class="post-metadata">

### Author: ![atombear](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/atombear/32/8488_2.png) [@atombear](https://discourse.julialang.org/u/atombear)
#### Post date: [October 7, 2019, 5:07am UTC](https://discourse.julialang.org/t/trouble-creating-a-module-from-cxxwrapped-code/28770/19 "2019-10-07T05:07:23Z")

</div>

thank you for informing me! that is very helpful indeed!
