JuliaInterop / libcxxwrap-julia

C++ library for backing CxxWrap.jl
Other
84 stars 43 forks source link

Init Error on Precompilation - Ubuntu 20.04 #79

Closed NicoMandel closed 3 years ago

NicoMandel commented 3 years ago

Hi All

I am trying to use libcxxwrap-julia with CXXWrap to compile wrappers for OpenCV. After following the steps of compiling from source into ~/.julia_ws and creating an Overrides.toml file in .julia/artifacts/, I try to use Pkg.add("CxxWrap") and then using CxxWrap. The package then responds with the following output:

julia> using CxxWrap
[ Info: Precompiling CxxWrap [1f15a43c-97ca-5a2a-ae31-89f07a497df4]
ERROR: LoadError: InitError: could not load library "/home/nicolas/julia_ws/libcxxwrap-julia-build/lib/libcxxwrap_julia.so"
/opt/julia-1.5.3/bin/../lib/julia/libstdc++.so.6: version `GLIBCXX_3.4.26' not found (required by /home/nicolas/julia_ws/libcxxwrap-julia-build/lib/libcxxwrap_julia.so)
Stacktrace:
 [1] dlopen(::String, ::UInt32; throw_error::Bool) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.5/Libdl/src/Libdl.jl:109
 [2] dlopen(::String, ::UInt32) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.5/Libdl/src/Libdl.jl:109
 [3] macro expansion at /home/nicolas/.julia/packages/JLLWrappers/WnWcZ/src/products/library_generators.jl:63 [inlined]
 [4] __init__() at /home/nicolas/.julia/packages/libcxxwrap_julia_jll/3tMWk/src/wrappers/x86_64-linux-gnu-cxx11.jl:9
 [5] _include_from_serialized(::String, ::Array{Any,1}) at ./loading.jl:697
 [6] _require_search_from_serialized(::Base.PkgId, ::String) at ./loading.jl:782
 [7] _require(::Base.PkgId) at ./loading.jl:1007
 [8] require(::Base.PkgId) at ./loading.jl:928
 [9] require(::Module, ::Symbol) at ./loading.jl:923
 [10] include(::Function, ::Module, ::String) at ./Base.jl:380
 [11] include(::Module, ::String) at ./Base.jl:368
 [12] top-level scope at none:2
 [13] eval at ./boot.jl:331 [inlined]
 [14] eval(::Expr) at ./client.jl:467
 [15] top-level scope at ./none:3
during initialization of module libcxxwrap_julia_jll
in expression starting at /home/nicolas/.julia/packages/CxxWrap/OcN1Z/src/CxxWrap.jl:15
ERROR: Failed to precompile CxxWrap [1f15a43c-97ca-5a2a-ae31-89f07a497df4] to /home/nicolas/.julia/compiled/v1.5/CxxWrap/WGIJU_IhaYv.ji.
Stacktrace:
 [1] error(::String) at ./error.jl:33
 [2] compilecache(::Base.PkgId, ::String) at ./loading.jl:1305
 [3] _require(::Base.PkgId) at ./loading.jl:1030
 [4] require(::Base.PkgId) at ./loading.jl:928
 [5] require(::Module, ::Symbol) at ./loading.jl:923

System:

The output of strings /usr/lib/x86_64-linux-gnu/libstdc++.so.6 | grep GLIBC shows me that GLIBXX_3.4.26 is present. Any help would be greatly appreciated.

NicoMandel commented 3 years ago

Compilation commands:

-- The C compiler identification is GNU 9.3.0
-- The CXX compiler identification is GNU 9.3.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Adding path /opt/julia-1.5.3 to search path
-- THIS BRANCH
-- Julia_VERSION_STRING: 1.5.3
-- Julia_INCLUDE_DIRS:   /opt/julia-1.5.3/include/julia
-- Julia_LIBRARY_DIR:    /opt/julia-1.5.3/lib
-- Julia_LIBRARY:        /opt/julia-1.5.3/lib/libjulia.so
-- Found Julia: /opt/julia-1.5.3/lib/libjulia.so (found version "1.5.3") 
-- JlCxx version: v0.8.3
-- Performing Test COMPILER_HAS_HIDDEN_VISIBILITY
-- Performing Test COMPILER_HAS_HIDDEN_VISIBILITY - Success
-- Performing Test COMPILER_HAS_HIDDEN_INLINE_VISIBILITY
-- Performing Test COMPILER_HAS_HIDDEN_INLINE_VISIBILITY - Success
-- Performing Test COMPILER_HAS_DEPRECATED_ATTR
-- Performing Test COMPILER_HAS_DEPRECATED_ATTR - Success
-- Configuring done
-- Generating done
-- Build files have been written to: /home/nicolas/julia_ws/libcxxwrap-julia-build

And make commands:

cmake --build . --config Release
Scanning dependencies of target cxxwrap_julia
[  3%] Building CXX object CMakeFiles/cxxwrap_julia.dir/src/c_interface.cpp.o
[  6%] Building CXX object CMakeFiles/cxxwrap_julia.dir/src/jlcxx.cpp.o
[  9%] Building CXX object CMakeFiles/cxxwrap_julia.dir/src/functions.cpp.o
[ 12%] Linking CXX shared library lib/libcxxwrap_julia.so
[ 12%] Built target cxxwrap_julia
Scanning dependencies of target cxxwrap_julia_stl
[ 15%] Building CXX object CMakeFiles/cxxwrap_julia_stl.dir/src/stl.cpp.o
[ 18%] Linking CXX shared library lib/libcxxwrap_julia_stl.so
[ 18%] Built target cxxwrap_julia_stl
Scanning dependencies of target functions
[ 21%] Building CXX object examples/CMakeFiles/functions.dir/functions.cpp.o
[ 25%] Linking CXX shared library ../lib/libfunctions.so
[ 25%] Built target functions
Scanning dependencies of target parametric
[ 28%] Building CXX object examples/CMakeFiles/parametric.dir/parametric.cpp.o
[ 31%] Linking CXX shared library ../lib/libparametric.so
[ 31%] Built target parametric
Scanning dependencies of target hello
[ 34%] Building CXX object examples/CMakeFiles/hello.dir/hello.cpp.o
[ 37%] Linking CXX shared library ../lib/libhello.so
[ 37%] Built target hello
Scanning dependencies of target types
[ 40%] Building CXX object examples/CMakeFiles/types.dir/types.cpp.o
[ 43%] Linking CXX shared library ../lib/libtypes.so
[ 43%] Built target types
Scanning dependencies of target basic_types
[ 46%] Building CXX object examples/CMakeFiles/basic_types.dir/basic_types.cpp.o
[ 50%] Linking CXX shared library ../lib/libbasic_types.so
[ 50%] Built target basic_types
Scanning dependencies of target inheritance
[ 53%] Building CXX object examples/CMakeFiles/inheritance.dir/inheritance.cpp.o
[ 56%] Linking CXX shared library ../lib/libinheritance.so
[ 56%] Built target inheritance
Scanning dependencies of target extended
[ 59%] Building CXX object examples/CMakeFiles/extended.dir/extended.cpp.o
[ 62%] Linking CXX shared library ../lib/libextended.so
[ 62%] Built target extended
Scanning dependencies of target jlcxx_containers
[ 65%] Building CXX object examples/CMakeFiles/jlcxx_containers.dir/containers.cpp.o
[ 68%] Linking CXX shared library ../lib/libjlcxx_containers.so
[ 68%] Built target jlcxx_containers
Scanning dependencies of target except
[ 71%] Building CXX object examples/CMakeFiles/except.dir/except.cpp.o
[ 75%] Linking CXX shared library ../lib/libexcept.so
[ 75%] Built target except
Scanning dependencies of target pointer_modification
[ 78%] Building CXX object examples/CMakeFiles/pointer_modification.dir/pointer_modification.cpp.o
[ 81%] Linking CXX shared library ../lib/libpointer_modification.so
[ 81%] Built target pointer_modification
Scanning dependencies of target test_cxxwrap
[ 84%] Building CXX object test/CMakeFiles/test_cxxwrap.dir/test_cxxwrap.cpp.o
[ 87%] Linking CXX executable test_cxxwrap
[ 87%] Built target test_cxxwrap
Scanning dependencies of target test_type_init
[ 90%] Building CXX object test/CMakeFiles/test_type_init.dir/test_type_init.cpp.o
[ 93%] Linking CXX executable test_type_init
[ 93%] Built target test_type_init
Scanning dependencies of target test_module
[ 96%] Building CXX object test/CMakeFiles/test_module.dir/test_module.cpp.o
[100%] Linking CXX executable test_module
[100%] Built target test_module
findmyway commented 3 years ago

Hi @NicoMandel ,

Have you tried it with Julia@v1.6.0-rc1?

NicoMandel commented 3 years ago

Hi

no, I haven't. Is this recommended? Is there an option to switch to an older tag of ibcxxwrap-julia? I actually manually symlinked the so file in my julia directory to my system one and that seemed to work

findmyway commented 3 years ago

no, I haven't. Is this recommended?

I'm not sure. I just hit the same problem recently and I found it was fixed with Julia@v1.6.0-rc1

I actually manually symlinked the so file in my julia directory to my system one and that seemed to work

Yes, this is also a valid manual solution.

The related issue: https://github.com/JuliaLang/julia/issues/34276

barche commented 3 years ago

Going to close this, removing /opt/julia-1.5.3/bin/../lib/julia/libstdc++.so.6 or symlinking it is one valid solution, the other solution is to compile Julia from source.