Open jstrube opened 8 years ago
Try
icxx"""UTIL::CellIDDecoder<$(T)>{$(collection.coll)};"""
Thanks for the suggestion. Now that I see it, I think this syntax had been suggested to me in a different context. Unfortunately, this gives me a segfault, similar to the one when I instantiate a named variable and return that:
signal (11): Segmentation fault
while loading /home/jstrube/.julia/v0.5/LCIO/examples/testLCIOCxx.jl, in expression starting on line 33
unknown function (ip: 0x7fb27bfc435d)
unknown function (ip: 0x7fb27bfc46d8)
unknown function (ip: 0x7fb0703919b5)
unknown function (ip: 0x7fb07039188c)
unknown function (ip: 0x7fb07039186f)
unknown function (ip: 0x7fb07039185c)
cxxstr_impl at /home/jstrube/.julia/v0.5/Cxx/src/cxxstr.jl:343
getCellIDDecoder at /home/jstrube/.julia/v0.5/LCIO/src/CaloHit.jl:30
unknown function (ip: 0x7fb070391632)
jl_call_method_internal at /home/jstrube/Workdir/julia-head/src/julia_internal.h:175
testReader at /home/jstrube/.julia/v0.5/LCIO/examples/testLCIOCxx.jl:22
unknown function (ip: 0x7fb070382842)
jl_call_method_internal at /home/jstrube/Workdir/julia-head/src/julia_internal.h:175
do_call at /home/jstrube/Workdir/julia-head/src/interpreter.c:66
eval at /home/jstrube/Workdir/julia-head/src/interpreter.c:190
eval_body at /home/jstrube/Workdir/julia-head/src/interpreter.c:465
jl_toplevel_eval_flex at /home/jstrube/Workdir/julia-head/src/toplevel.c:554
jl_parse_eval_all at /home/jstrube/Workdir/julia-head/src/ast.c:708
jl_load at /home/jstrube/Workdir/julia-head/src/toplevel.c:598
jl_load_ at /home/jstrube/Workdir/julia-head/src/toplevel.c:607
include_from_node1 at ./loading.jl:426
unknown function (ip: 0x7fb278f8e82b)
jl_call_method_internal at /home/jstrube/Workdir/julia-head/src/julia_internal.h:175
process_options at ./client.jl:266
_start at ./client.jl:322
unknown function (ip: 0x7fb278fb65c8)
jl_call_method_internal at /home/jstrube/Workdir/julia-head/src/julia_internal.h:175
jl_apply at /home/jstrube/Workdir/julia-head/ui/../src/julia.h:1394
main at /home/jstrube/Workdir/julia-head/ui/repl.c:232
unknown function (ip: 0x7fb27e12882f)
unknown function (ip: 0x401348)
Allocations: 3611264 (Pool: 3610309; Big: 955); GC: 4
Segmentation fault (core dumped)
gdb says this:
Thread 1 "julia-debug" received signal SIGSEGV, Segmentation fault.
0x00007ffff4b2e35e in std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_assign(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) ()
from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
(gdb) bt
#0 0x00007ffff4b2e35e in std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_assign(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) ()
from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#1 0x00007ffff4b2e6d9 in std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::operator=(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) ()
from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#2 0x00007ffde8d14d86 in ?? ()
#3 0x00007ffdf650bf90 in ?? ()
#4 0x00007ffdf6b293c0 in ?? ()
#5 0x00007fffffffbec0 in ?? ()
#6 0x000000000000000e in ?? ()
#7 0x6e4544496c6c6543 in ?? ()
#8 0x0000676e69646f63 in ?? ()
#9 0x00007fffffffbf10 in ?? ()
#10 0x00007fffffffbee8 in ?? ()
#11 0x0000000000000000 in ?? ()
julia> versioninfo() Julia Version 0.5.0-dev+5260 Commit f8d67f7* (2016-07-10 01:41 UTC) DEBUG build Platform Info: System: Linux (x86_64-linux-gnu) CPU: Intel(R) Core(TM) i7-6700 CPU @ 3.40GHz WORD_SIZE: 64 BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NOAFFINITY Haswell) LAPACK: libopenblas64 LIBM: libopenlibm LLVM: libLLVM-3.7.1 (ORCJIT, sandybridge)
That could just be a regular segfault in the C++ library, unrelated to anything Cxx is doing. I'm a little surprised though that things are working at all, because that backtrace has ABI tags in it, which Cxx (with clang < 3.9) is usually unhappy about.
This is Ubuntu 16.04.
OK, will try on another installation, have gcc5 and 6 on a CentOS7 installation at work. I might also try with 3.9-pre later.
Segfault also on the other machine
Program received signal SIGSEGV, Segmentation fault.
0x00007ffff4ca3fc0 in std::string::assign(std::string const&) () from /lib64/libstdc++.so.6
Missing separate debuginfos, use: debuginfo-install glibc-2.17-105.el7.x86_64 keyutils-libs-1.5.8-3.el7.x86_64 krb5-libs-1.13.2-10.el7.x86_64 libcom_err-1.42.13.wc4-7.el7.x86_64 libgcc-4.8.5-4.el7.x86_64 libgfortran-4.8.5-4.el7.x86_64 libquadmath-4.8.5-4.el7.x86_64 libselinux-2.2.2-6.el7.x86_64 libstdc++-4.8.5-4.el7.x86_64 pcre-8.32-15.el7.x86_64 xz-libs-5.1.2-12alpha.el7.x86_64 zlib-1.2.7-15.el7.x86_64
(gdb) where
#0 0x00007ffff4ca3fc0 in std::string::assign(std::string const&) () from /lib64/libstdc++.so.6
#1 0x00007ffdb8585298 in ?? ()
#2 0x00007ffdf053f890 in ?? ()
#3 0x0be940153beadeb3 in ?? ()
#4 0x000000000b677fb8 in ?? ()
#5 0x000000000000001d in ?? ()
#6 0x00007ffff4eed3f8 in std::string::_Rep::_S_empty_rep_storage () from /lib64/libstdc++.so.6
julia> versioninfo()
Julia Version 0.5.0-dev+4297
Commit 3bed78c (2016-05-24 15:35 UTC)
Platform Info:
System: Linux (x86_64-redhat-linux)
CPU: Intel(R) Xeon(R) CPU E5-2660 v3 @ 2.60GHz
WORD_SIZE: 64
BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY Haswell)
LAPACK: libopenblas64_
LIBM: libopenlibm
LLVM: libLLVM-3.7.1 (ORCJIT, haswell)
Tried again on a new SuSE Tumbleweed install. Segfault here as well. The trace does end at the stdlib, butif that's really the culprit, it's a widespread problem, not just a single tag. I don't have the expertise to report this upstream in a way that would help fix this.
julia> versioninfo()
Julia Version 0.5.0-dev+5472
Commit 622d0c7 (2016-07-17 05:44 UTC)
DEBUG build
Platform Info:
System: Linux (x86_64-suse-linux)
CPU: Intel(R) Core(TM) i7-6700 CPU @ 3.40GHz
WORD_SIZE: 64
BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY Haswell)
LAPACK: libopenblas64_
LIBM: libopenlibm
LLVM: libLLVM-3.9.0svn (ORCJIT, skylake)
Segfault:
signal (11): Segmentation fault
while loading /home/jstrube/.julia/v0.5/LCIO/examples/testLCIOCxx.jl, in expression starting on line 33
cxxstr_impl at /home/jstrube/.julia/v0.5/Cxx/src/cxxstr.jl:343
getCellIDDecoder at /home/jstrube/.julia/v0.5/LCIO/src/CaloHit.jl:30
jl_call_method_internal at /home/jstrube/Workdir/julia-dev/src/julia_internal.h:177
jl_apply_generic at /home/jstrube/Workdir/julia-dev/src/gf.c:2027
testReader at /home/jstrube/.julia/v0.5/LCIO/examples/testLCIOCxx.jl:22
jl_call_method_internal at /home/jstrube/Workdir/julia-dev/src/julia_internal.h:177
jl_apply_generic at /home/jstrube/Workdir/julia-dev/src/gf.c:2027
do_call at /home/jstrube/Workdir/julia-dev/src/interpreter.c:66
eval at /home/jstrube/Workdir/julia-dev/src/interpreter.c:190
eval_body at /home/jstrube/Workdir/julia-dev/src/interpreter.c:462
jl_toplevel_eval_body at /home/jstrube/Workdir/julia-dev/src/interpreter.c:438
jl_toplevel_eval_flex at /home/jstrube/Workdir/julia-dev/src/toplevel.c:552
jl_parse_eval_all at /home/jstrube/Workdir/julia-dev/src/ast.c:717
jl_load at /home/jstrube/Workdir/julia-dev/src/toplevel.c:596
jl_load_ at /home/jstrube/Workdir/julia-dev/src/toplevel.c:605
include_from_node1 at ./loading.jl:426
jl_call_method_internal at /home/jstrube/Workdir/julia-dev/src/julia_internal.h:177
jl_apply_generic at /home/jstrube/Workdir/julia-dev/src/gf.c:2027
process_options at ./client.jl:262
_start at ./client.jl:318
jl_call_method_internal at /home/jstrube/Workdir/julia-dev/src/julia_internal.h:177
jl_apply_generic at /home/jstrube/Workdir/julia-dev/src/gf.c:2027
jl_apply at /home/jstrube/Workdir/julia-dev/ui/../src/julia.h:1394
true_main at /home/jstrube/Workdir/julia-dev/ui/repl.c:112
main at /home/jstrube/Workdir/julia-dev/ui/repl.c:232
unknown function (ip: 0x401458)
Allocations: 4348083 (Pool: 4347043; Big: 1040); GC: 5
GDB info:
Thread 1 "julia-debug" received signal SIGSEGV, Segmentation fault.
std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_assign (this=this@entry=0x7fffffffbb38,
__str=<error reading variable: Cannot access memory at address 0x8>)
at /usr/src/debug/gcc-6.1.1-r236988/obj-x86_64-suse-linux/x86_64-suse-linux/libstdc++-v3/include/bits/basic_string.tcc:259
259 /usr/src/debug/gcc-6.1.1-r236988/obj-x86_64-suse-linux/x86_64-suse-linux/libstdc++-v3/include/bits/basic_string.tcc: No such file or directory.
(gdb) where
#0 std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_assign (this=this@entry=0x7fffffffbb38,
__str=<error reading variable: Cannot access memory at address 0x8>)
at /usr/src/debug/gcc-6.1.1-r236988/obj-x86_64-suse-linux/x86_64-suse-linux/libstdc++-v3/include/bits/basic_string.tcc:259
#1 0x00007ffff44eb6e9 in std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::assign (__str=..., this=0x7fffffffbb38)
at /usr/src/debug/gcc-6.1.1-r236988/obj-x86_64-suse-linux/x86_64-suse-linux/libstdc++-v3/include/bits/basic_string.h:1181
#2 std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::operator= (this=0x7fffffffbb38, __str=...)
at /usr/src/debug/gcc-6.1.1-r236988/obj-x86_64-suse-linux/x86_64-suse-linux/libstdc++-v3/include/bits/basic_string.h:581
#3 0x00007ffde5943c16 in ?? ()
#4 0x0000000000000015 in ?? ()
#5 0x00007ffff7fc5c40 in ?? ()
#6 0x00007ffdf31a4910 in ?? ()
#7 0x00007fffffffbb48 in ?? ()
#8 0x0000000000000000 in ?? ()
This is still an issue with the latest version of Cxx. Trying to use this line to instantiate the class
CellIDDecoder(t::LCCollection{T}) where {T} = icxx"UTIL::CellIDDecoder<$(T)>{$(t.coll)};"
Leads to this error message:
In file included from /Cxx.cpp:1:
/home/jstrube/.julia/dev/LCIO_Cxx/src/LCIO_Cxx.jl:159:1: error: call to deleted constructor of 'UTIL::CellIDDecoder<EVENT::SimCalorimeterHit *>'
UTIL::CellIDDecoder<__juliatype26>{__juliavar2};
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/jstrube/.julia/dev/LCIO/deps/usr/include/UTIL/CellIDDecoder.h:33:5: note: 'CellIDDecoder' has been explicitly marked deleted here
CellIDDecoder(const CellIDDecoder& ) = delete ;
^
In file included from /Cxx.cpp:1:
/home/jstrube/.julia/dev/LCIO_Cxx/src/LCIO_Cxx.jl:159:1: error: call to deleted constructor of 'UTIL::CellIDDecoder<EVENT::SimCalorimeterHit *>'
UTIL::CellIDDecoder<__juliatype28>{__juliavar2};
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/jstrube/.julia/dev/LCIO/deps/usr/include/UTIL/CellIDDecoder.h:33:5: note: 'CellIDDecoder' has been explicitly marked deleted here
CellIDDecoder(const CellIDDecoder& ) = delete ;
^
In file included from /Cxx.cpp:1:
/home/jstrube/.julia/dev/LCIO_Cxx/src/LCIO_Cxx.jl:159:1: error: call to deleted constructor of 'UTIL::CellIDDecoder<EVENT::SimCalorimeterHit *>'
UTIL::CellIDDecoder<__juliatype30>{__juliavar2};
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/jstrube/.julia/dev/LCIO/deps/usr/include/UTIL/CellIDDecoder.h:33:5: note: 'CellIDDecoder' has been explicitly marked deleted here
CellIDDecoder(const CellIDDecoder& ) = delete ;
^
ERROR: LoadError: A failure occured while parsing the function body
Stacktrace:
[1] error(::String) at ./error.jl:33
[2] ParseFunctionStatementBody at /home/jstrube/.julia/packages/Cxx/7d2lG/src/cxxstr.jl:243 [inlined]
[3] #CreateFunctionWithBody#53(::Array{Any,1}, ::Symbol, ::Int64, ::Int64, ::Bool, ::typeof(Cxx.CxxCore.CreateFunctionWithBody), ::Cxx.CxxCore.ClangCompiler, ::String, ::Type, ::Vararg{Type,N} where N) at /home/jstrube/.julia/packages/Cxx/7d2lG/src/cxxstr.jl:357
[4] (::getfield(Cxx.CxxCore, Symbol("#kw##CreateFunctionWithBody")))(::NamedTuple{(:filename, :line, :col, :disable_ac),Tuple{Symbol,Int64,Int64,Bool}}, ::typeof(Cxx.CxxCore.CreateFunctionWithBody), ::Cxx.CxxCore.ClangCompiler, ::String, ::Type, ::Vararg{Type,N} where N) at ./none:0
[5] #s37#70 at /home/jstrube/.julia/packages/Cxx/7d2lG/src/cxxstr.jl:707 [inlined]
[6] #s37#70(::Any, ::Any, ::Any, ::Any) at ./none:0
[7] (::Core.GeneratedFunctionStub)(::Any, ::Vararg{Any,N} where N) at ./boot.jl:524
[8] CellIDDecoder(::LCIO_Cxx.LCCollection{Cxx.CxxCore.CppPtr{Cxx.CxxCore.CxxQualType{Cxx.CxxCore.CppBaseType{Symbol("EVENT::SimCalorimeterHit")},(false, false, false)},(false, false, false)}}) at /home/jstrube/.julia/dev/LCIO_Cxx/src/LCIO_Cxx.jl:159
[9] (::getfield(Main, Symbol("##5#6")))(::Cxx.CxxCore.CppPtr{Cxx.CxxCore.CxxQualType{Cxx.CxxCore.CppBaseType{Symbol("IO::LCReader")},(false, false, false)},(false, false, false)}) at /home/jstrube/.julia/dev/LCIO_Cxx/test/runtests.jl:48
[10] open(::getfield(Main, Symbol("##5#6")), ::String) at /home/jstrube/.julia/dev/LCIO_Cxx/src/LCIO_Cxx.jl:74
[11] top-level scope at /home/jstrube/.julia/dev/LCIO_Cxx/test/runtests.jl:34
[12] include at ./boot.jl:328 [inlined]
[13] include_relative(::Module, ::String) at ./loading.jl:1094
[14] include(::Module, ::String) at ./Base.jl:31
[15] include(::String) at ./client.jl:431
[16] top-level scope at none:5
in expression starting at /home/jstrube/.julia/dev/LCIO_Cxx/test/runtests.jl:34
ERROR: Package LCIO_Cxx errored during testing
I'm trying to instantiate the class CellIDDecoder, but I'm failing miserably. Instantiating a template class is part of the Cxx test suite, which passes, so I don't know why this is so hard. I've tried basically every incantation of
icxx
,cxxt
,@cxxnew
,cxx
I could think of, without success.Somehow, the string interpolation doesn't work.
icxx"""UTIL::CellIDDecoder<$(T)>($(collection.coll));"""
gives meRunning the code through cxx"" (and instantiating a named variable, rather than an unnamed one) works, but I don't get a return type, obviously.
Breaking the icxx"" into two pieces:
results in
Instantiating a named variable like so,
icxx"""UTIL::CellIDDecoder<$(T)> x($(collection.coll));"""
and returning that results in a segfault that I haven't been able to trace down further (I tried with julia-debug --inline=no and gdb).