I need to add "-L/home/djia/Software/julia-9c76c3e89a/lib/julia -lLLVM-3.7.1" into the script cooked up based on julia-config output, and then it works. Should I file an issue on julia-config?
On Saturday, September 10, 2016 at 8:53:39 PM UTC+8, K leo wrote: > > julia-config.jl is hardly useful at all. I unpacked the Linux binary of > Julia (0.5) in ~/Software/julia-9c76c3e89a, and I set JULIA_DIR > accordingly. When I execute julia-config in the following way, I got all > kinds of "undefined reference to" error messages. > > > $JULIA_DIR/share/julia/julia-config.jl --cflags --ldflags --ldlibs | > xargs g++ test6.cpp > /usr/bin/ld: warning: libLLVM-3.7.1.so, needed by > /home/xxx/Software/julia-9c76c3e89a/lib/libjulia.so, not found (try using > -rpath or -rpath-link) > /home/xxx/Software/julia-9c76c3e89a/lib/libjulia.so: undefined reference > to `llvm::AttributeSet::hasAttribute(unsigned int, > llvm::Attribute::AttrKind) const' > /home/xxx/Software/julia-9c76c3e89a/lib/libjulia.so: undefined reference > to `llvm::LoopBase<llvm::BasicBlock, llvm::Loop>::getLoopLatch() const' > ......... > > If I only execute julia-config for flags, and I use these flags to cook up > g++ script, and the g++ script got me the same problems. > > > $JULIA_DIR/share/julia/julia-config.jl --cflags --ldflags --ldlibs > -DJULIA_ENABLE_THREADING=1 -fPIC > -DJULIA_INIT_DIR=\"/home/xxx/Software/julia-9c76c3e89a/lib\" > -I/home/xxx/Software/julia-9c76c3e89a/include/julia > -L/home/xxx/Software/julia-9c76c3e89a/lib > -Wl,-rpath,/home/xxx/Software/julia-9c76c3e89a/lib -ljulia > > The output for --ldflags is clearly incorrect or incomplete for my > installation on Ubuntu. The script that generally works for me is the > following, where some extra things have to be set. > > > g++ -o test -fPIC -I$JULIA_DIR/include/julia test6.cpp -L$JULIA_DIR/lib/ > -L$JULIA_DIR/lib/julia -lLLVM-3.7.1 -ljulia > $JULIA_DIR/lib/julia/libstdc++.so.6 > > > On Saturday, September 10, 2016 at 7:06:34 PM UTC+8, Yichao Yu wrote: >> >> >> >> On Sat, Sep 10, 2016 at 6:56 AM, K leo <cnbi...@gmail.com> wrote: >> >>> I tried to compile the code with the GC statements, but got a bunch of >>> error regarding jl_tls_states: >>> >> >> >> Use julia-config.jl to determine your compile flags. >> >> >>> >>> test6.cpp:(.text+0xd5): undefined reference to `jl_tls_states' >>> >>> The compile script is as follows: >>> g++ -o test -fPIC -I$JULIA_DIR/include/julia test6.cpp -L$JULIA_DIR/lib/ >>> -L$JULIA_DIR/lib/julia -lLLVM-3.7.1 -ljulia >>> $JULIA_DIR/lib/julia/libstdc++.so.6 >>> >>> Where is `jl_tls_states' defined? >>> >>> >>> On Saturday, September 10, 2016 at 5:20:02 PM UTC+8, Bart Janssens wrote: >>>> >>>> I just realise I made a typo, the rooting should be done using: (note >>>> the &) >>>> >>>> JL_GC_PUSH2(&a,&b); >>>> >>>> Op za 10 sep. 2016 02:36 schreef K leo <cnbi...@gmail.com>: >>>> >>>>> Bart, >>>>> >>>>> Can you explain what you mean by "need to be rooted"? The >>>>> jl_new_struct statement as Isaiah suggested works, why do we need the >>>>> additional statements as you suggested? >>>>> >>>>>> >>>> >>>> >>>> >>>>>> >>