Compiled through, but execution got core dump. Any idea?
$ julia
_
_ _ _(_)_ | Documentation: https://docs.julialang.org
(_) | (_) (_) |
_ _ _| |_ __ _ | Type "?" for help, "]?" for Pkg help.
| | | | | | |/ _` | |
| | |_| | | | (_| | | Version 1.0.3 (2018-12-18)
_/ |\__'_|_|_|\__'_| | Official https://julialang.org/ release
|__/ |
julia> using PackageCompiler
julia> build_executable(
"hello.jl")
Julia program file:
"/home/user/tmp/Test/hello.jl"
C program file:
"/home/user/.julia/packages/PackageCompiler/jBqfm/examples/program.c"
Build directory:
"/home/user/tmp/Test/builddir"
All done
$ ./hello
signal (11): Segmentation fault
in expression starting at no file:0
unknown function (ip: 0xffffffffffffffff)
main at ./hello (unknown line)
__libc_start_main at /usr/lib/libc.so.6 (unknown line)
_start at ./hello (unknown line)
Allocations: 3278 (Pool: 3266; Big: 12); GC: 0
Segmentation fault (core dumped)
Can you give more info about your system? ( linux version , gcc version ? )
On clean docker julia environment this example working for me:
docker run -it julia:1.0.3 bash
apt-get update && apt-get install -y build-essential
julia -e 'using Pkg;Pkg.REPLMode.pkgstr("add UnicodePlots;precompile");using UnicodePlots'
julia -e 'using Pkg;Pkg.REPLMode.pkgstr("add PackageCompiler;precompile");using PackageCompiler'
cd $(julia -e 'print(abspath(joinpath(dirname(Base.find_package("PackageCompiler")), "../examples")))')
time julia -e 'using PackageCompiler; build_executable("hello.jl")'
cd builddir
./hello
log
...
root@324cbdd7a971:/# cd $(julia -e 'print(abspath(joinpath(dirname(Base.find_package("PackageCompiler")), "../examples")))')
root@324cbdd7a971:~/.julia/packages/PackageCompiler/jBqfm/examples# time julia -e 'using PackageCompiler; build_executable("hello.jl")'
Julia program file:
"/root/.julia/packages/PackageCompiler/jBqfm/examples/hello.jl"
C program file:
"/root/.julia/packages/PackageCompiler/jBqfm/examples/program.c"
Build directory:
"/root/.julia/packages/PackageCompiler/jBqfm/examples/builddir"
All done
real 3m30.106s
user 3m26.387s
sys 0m2.911s
root@324cbdd7a971:~/.julia/packages/PackageCompiler/jBqfm/examples# cd builddir
root@324cbdd7a971:~/.julia/packages/PackageCompiler/jBqfm/examples/builddir# ./hello
hello, world
sin(0.0) = 0.0
ββββββββββββββββββββββββββββββββββββββββββ
1 ββ β β β β β β β‘ β β β β β ’β‘β β β β β β β β β β β β β β β β β β β β β β β β β β β
ββ β β β β β’ β β β β β β β β β’β β β β β β β β β β β β β β β β β β β β β β β β β β
ββ β β β β’ β β β β β β β β β β β ³β‘β β β β β β β β β β β β β β β β β β β β β β β β
ββ β β β’ β β β β β β β β β β β β β ±β‘β β β β β β β β β β β β β β β β β β β β β β β
ββ β β’ β β β β β β β β β β β β β β β ³β‘β β β β β β β β β β β β β β β β β β β β β β
ββ β’β β β β β β β β β β β β β β β β β’£β β β β β β β β β β β β β β β β β β β β β β
ββ β‘β β β β β β β β β β β β β β β β β β’β β β β β β β β β β β β β β β β β β β β β
ββ Όβ €β €β €β €β €β €β €β €β €β €β €β €β €β €β €β €β €β €β ¬β’¦β €β €β €β €β €β €β €β €β €β €β €β €β €β €β €β €β €β €β’€β
ββ β β β β β β β β β β β β β β β β β β β β β‘β β β β β β β β β β β β β β β β β’β β
ββ β β β β β β β β β β β β β β β β β β β β β β‘β β β β β β β β β β β β β β β β‘β β
ββ β β β β β β β β β β β β β β β β β β β β β β ±β‘β β β β β β β β β β β β β β‘β β β
ββ β β β β β β β β β β β β β β β β β β β β β β β ±β‘β β β β β β β β β β β β‘β β β β
ββ β β β β β β β β β β β β β β β β β β β β β β β β ±β‘β β β β β β β β β β‘β β β β β
ββ β β β β β β β β β β β β β β β β β β β β β β β β β β’β β β β β β β’ β β β β β β β
-1 ββ β β β β β β β β β β β β β β β β β β β β β β β β β β β β’β£β£β£β β β β β β β β β
ββββββββββββββββββββββββββββββββββββββββββ
0 100
root@324cbdd7a971:~/.julia/packages/PackageCompiler/jBqfm/examples/builddir#
It looks like youβre supplying a potentially different hello.jl
than ships with PackageCompiler. Can we see the source/an MWE of whatβs in that file, if it differs from the default one?
1 Like
maybe after upgrading julia - creating a clean state is very important
remove: PackageCompiler , UnicodePlots
pkg> gc
see :
opened 09:06PM - 05 Oct 18 UTC
closed 03:49AM - 16 Oct 18 UTC
If I run `test PackageCompiler` locally in Julia 1.0.1, I get
```julia
Launc⦠hing new julia process to run commands...
signal (11): Segmentation fault
in expression starting at no file:0
jl_array_ptr_ref at /buildworker/worker/package_linux64/build/src/julia.h:786 [inlined]
jl_has_call_ambiguities at /buildworker/worker/package_linux64/build/src/gf.c:2000
jl_mt_assoc_by_type at /buildworker/worker/package_linux64/build/src/gf.c:1095
jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2153
reinit_stdio at ./libuv.jl:120
__init__ at ./sysimg.jl:470
jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2184
jl_apply at /buildworker/worker/package_linux64/build/src/julia.h:1537 [inlined]
jl_module_run_initializer at /buildworker/worker/package_linux64/build/src/toplevel.c:90
_julia_init at /buildworker/worker/package_linux64/build/src/init.c:813
julia_init__threading at /buildworker/worker/package_linux64/build/src/task.c:302
main at /buildworker/worker/package_linux64/build/ui/repl.c:227
__libc_start_main at /build/glibc-OTsEL5/glibc-2.27/csu/../csu/libc-start.c:310
_start at /opt/julia-1.0.1/bin/julia (unknown line)
Allocations: 2646 (Pool: 2637; Big: 9); GC: 0
```
Tests pass on 1.0.0. Can anybody reproduce this?
Thanks to all for the comments.
My Linux and gcc versions are:
$ gcc --version
gcc (GCC) 8.2.1 20181127
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
$ uname -a
Linux manjaro 4.19.13-1-MANJARO #1 SMP PREEMPT Sat Dec 29 15:43:56 UTC 2018 x86_64 GNU/Linux
I copied the hello.jl from PackageCompiler:
module Hello
using UnicodePlots
Base.@ccallable function julia_main(ARGS::Vector{String})::Cint
println("hello, world")
@show sin(0.0)
println(lineplot(1:100, sin.(range(0, stop=2Ο, length=100))))
return 0
end
end
The packages of PackageCompiler and UnicodePlots were added yesterday under the same julia version. I just did a gc under pkg and recompiled hello.jl.
Actually, when I first run hello, I got a message saying hello.so not found:
$ ./hello
ERROR: could not load library "/home/user/Software/julia-1.0.3/bin/hello.so"
/home/user/Software/julia-1.0.3/bin/hello.so: cannot open shared object file: No such file or directory
So then I copied hello.so from builddir into /home/user/Software/julia-1.0.3/bin/
, then when I ran hello, I got a core dump. Is there something wrong with my setting?
$ ./hello
signal (11): Segmentation fault
in expression starting at no file:0
unknown function (ip: 0xffffffffffffffff)
main at ./hello (unknown line)
__libc_start_main at /usr/lib/libc.so.6 (unknown line)
_start at ./hello (unknown line)
Allocations: 3278 (Pool: 3266; Big: 12); GC: 0
Segmentation fault (core dumped)
it is working on buildir
? ( no copy β¦ )
my directory :
/builddir$ ls
hello libcholmod.so libgfortran.so.4 libjulia.so libmbedcrypto.so.0 libmbedx509.so.2.6.0 libopenlibm.so.2 libssh2.so
hello.a libcolamd.so libgit2.so libjulia.so.1 libmbedcrypto.so.2.6.0 libmpfr.so libopenlibm.so.2.5 libssh2.so.1
hello.so libcurl.so libgit2.so.0.27.2 libjulia.so.1.0 libmbedtls.so libmpfr.so.6 libpcre2-8.so libssh2.so.1.0.1
libamd.so libcurl.so.4 libgit2.so.27 libLLVM-6.0.0.so libmbedtls.so.10 libmpfr.so.6.0.1 libpcre2-8.so.0 libstdc++.so.6
libcamd.so libcurl.so.4.5.0 libgmp.so libLLVM-6.0.so libmbedtls.so.2.6.0 libopenblas64_.so libpcre2-8.so.0.6.0 libsuitesparseconfig.so
libccalltest.so libdSFMT.so libgmp.so.10 libLLVM.so libmbedx509.so libopenblas64_.so.0 libquadmath.so.0 libsuitesparse_wrapper.so
libccolamd.so libgcc_s.so.1 libgmp.so.10.3.2 libmbedcrypto.so libmbedx509.so.0 libopenlibm.so libspqr.so libumfpack.so
Yes, I run hello under buiddir, but itβs not taking the hello.so there for some reason, and complains about the lack of hello.so under /home/user/Software/julia-1.0.3/bin/
.
My builddir also has a full bunch of files:
builddir]$ ls
hello libdSFMT.so libLLVM-6.0.0.so libmpfr.so libspqr.so
hello.a libgcc_s.so.1 libLLVM-6.0.so libmpfr.so.6 libssh2.so
hello.so libgfortran.so.4 libLLVM.so libmpfr.so.6.0.1 libssh2.so.1
libamd.so libgit2.so libmbedcrypto.so libopenblas64_.so libssh2.so.1.0.1
libcamd.so libgit2.so.0.27.2 libmbedcrypto.so.0 libopenblas64_.so.0 libstdc++.so.6
libccalltest.so libgit2.so.27 libmbedcrypto.so.2.6.0 libopenlibm.so libsuitesparseconfig.so
libccolamd.so libgmp.so libmbedtls.so libopenlibm.so.2 libsuitesparse_wrapper.so
libcholmod.so libgmp.so.10 libmbedtls.so.10 libopenlibm.so.2.5 libumfpack.so
libcolamd.so libgmp.so.10.3.2 libmbedtls.so.2.6.0 libpcre2-8.so
libcurl.so libjulia.so libmbedx509.so libpcre2-8.so.0
libcurl.so.4 libjulia.so.1 libmbedx509.so.0 libpcre2-8.so.0.6.0
libcurl.so.4.5.0 libjulia.so.1.0 libmbedx509.so.2.6.0 libquadmath.so.0
Can you share the βldd hello
β output ?
my log.
root@9cff0dc03a96:~/.julia/packages/PackageCompiler/jBqfm/examples/builddir# ldd hello
linux-vdso.so.1 (0x00007ffc653b8000)
hello.so => /root/.julia/packages/PackageCompiler/jBqfm/examples/builddir/./hello.so (0x00007fe9fe770000)
libjulia.so.1 => /usr/local/julia/lib/libjulia.so.1 (0x00007fe9fdffd000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fe9fdc5e000)
libLLVM-6.0.so => /usr/local/julia/lib/julia/libLLVM-6.0.so (0x00007fe9fafc2000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fe9fadbe000)
librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007fe9fabb6000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fe9fa999000)
libstdc++.so.6 => /usr/local/julia/lib/julia/libstdc++.so.6 (0x00007fe9fa61b000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fe9fa317000)
libgcc_s.so.1 => /usr/local/julia/lib/julia/libgcc_s.so.1 (0x00007fe9fa0ff000)
/lib64/ld-linux-x86-64.so.2 (0x00007fea06898000)
root@9cff0dc03a96:~/.julia/packages/PackageCompiler/jBqfm/examples/builddir#
builddir]$ ldd hello
linux-vdso.so.1 (0x00007ffc217da000)
hello.so => /home/user/tmp/Test/builddir/./hello.so (0x00007f9241079000)
libjulia.so.1 => /home/user/Software/julia-1.0.3/lib/libjulia.so.1 (0x00007f9240906000)
libc.so.6 => /usr/lib/libc.so.6 (0x00007f924070d000)
libLLVM-6.0.so => /home/user/Software/julia-1.0.3/lib/julia/libLLVM-6.0.so (0x00007f923da71000)
libdl.so.2 => /usr/lib/libdl.so.2 (0x00007f923da6c000)
librt.so.1 => /usr/lib/librt.so.1 (0x00007f923da62000)
libpthread.so.0 => /usr/lib/libpthread.so.0 (0x00007f923da3f000)
libstdc++.so.6 => /home/user/Software/julia-1.0.3/lib/julia/libstdc++.so.6 (0x00007f923d6c1000)
libm.so.6 => /usr/lib/libm.so.6 (0x00007f923d53c000)
libgcc_s.so.1 => /home/user/Software/julia-1.0.3/lib/julia/libgcc_s.so.1 (0x00007f923d324000)
/lib64/ld-linux-x86-64.so.2 => /usr/lib64/ld-linux-x86-64.so.2 (0x00007f9248d9e000)
LeoK987:
Yes, I run hello under buiddir, but itβs not taking the hello.so there for some reason, and complains about the lack of hello.so under /home/user/Software/julia-1.0.3/bin/
.
please copy-paste the full (latest) error message .
builddir]$ ./hello
Testing on clean Manjaro environment - is OK.
Step 13/13 : RUN cd $(julia -e 'print(abspath(joinpath(dirname(Base.find_package("PackageCompiler")), "../examples")))') && time julia -e 'using PackageCompiler; build_executable("hello.jl")' && cd builddir && ldd ./hello && ./hello
---> Running in 5108a55a38f4
Julia program file:
"/root/.julia/packages/PackageCompiler/jBqfm/examples/hello.jl"
C program file:
"/root/.julia/packages/PackageCompiler/jBqfm/examples/program.c"
Build directory:
"/root/.julia/packages/PackageCompiler/jBqfm/examples/builddir"
All done
real 3m18.788s
user 3m11.210s
sys 0m8.809s
linux-vdso.so.1 (0x00007ffefc75d000)
hello.so => /root/.julia/packages/PackageCompiler/jBqfm/examples/builddir/./hello.so (0x00007fbbff33c000)
libjulia.so.1 => /usr/local/julia/lib/libjulia.so.1 (0x00007fbbfebc9000)
libc.so.6 => /usr/lib/libc.so.6 (0x00007fbbfe9fe000)
libLLVM-6.0.so => /usr/local/julia/lib/julia/libLLVM-6.0.so (0x00007fbbfbd62000)
libdl.so.2 => /usr/lib/libdl.so.2 (0x00007fbbfbd5d000)
librt.so.1 => /usr/lib/librt.so.1 (0x00007fbbfbd53000)
libpthread.so.0 => /usr/lib/libpthread.so.0 (0x00007fbbfbd30000)
libstdc++.so.6 => /usr/local/julia/lib/julia/libstdc++.so.6 (0x00007fbbfb9b2000)
libm.so.6 => /usr/lib/libm.so.6 (0x00007fbbfb82d000)
libgcc_s.so.1 => /usr/local/julia/lib/julia/libgcc_s.so.1 (0x00007fbbfb615000)
/lib64/ld-linux-x86-64.so.2 => /usr/lib64/ld-linux-x86-64.so.2 (0x00007fbc0704e000)
hello, world
sin(0.0) = 0.0
ββββββββββββββββββββββββββββββββββββββββββ
1 ββ β β β β β β β‘ β β β β β ’β‘β β β β β β β β β β β β β β β β β β β β β β β β β β β
ββ β β β β β’ β β β β β β β β β’β β β β β β β β β β β β β β β β β β β β β β β β β β
ββ β β β β’ β β β β β β β β β β β ³β‘β β β β β β β β β β β β β β β β β β β β β β β β
ββ β β β’ β β β β β β β β β β β β β ±β‘β β β β β β β β β β β β β β β β β β β β β β β
ββ β β’ β β β β β β β β β β β β β β β ³β‘β β β β β β β β β β β β β β β β β β β β β β
ββ β’β β β β β β β β β β β β β β β β β’£β β β β β β β β β β β β β β β β β β β β β β
ββ β‘β β β β β β β β β β β β β β β β β β’β β β β β β β β β β β β β β β β β β β β β
ββ Όβ €β €β €β €β €β €β €β €β €β €β €β €β €β €β €β €β €β €β ¬β’¦β €β €β €β €β €β €β €β €β €β €β €β €β €β €β €β €β €β €β’€β
ββ β β β β β β β β β β β β β β β β β β β β β‘β β β β β β β β β β β β β β β β β’β β
ββ β β β β β β β β β β β β β β β β β β β β β β‘β β β β β β β β β β β β β β β β‘β β
ββ β β β β β β β β β β β β β β β β β β β β β β ±β‘β β β β β β β β β β β β β β‘β β β
ββ β β β β β β β β β β β β β β β β β β β β β β β ±β‘β β β β β β β β β β β β‘β β β β
ββ β β β β β β β β β β β β β β β β β β β β β β β β ±β‘β β β β β β β β β β‘β β β β β
ββ β β β β β β β β β β β β β β β β β β β β β β β β β β’β β β β β β β’ β β β β β β β
-1 ββ β β β β β β β β β β β β β β β β β β β β β β β β β β β β’β£β£β£β β β β β β β β β
ββββββββββββββββββββββββββββββββββββββββββ
0 100
Removing intermediate container 5108a55a38f4
---> ee1669d4634b
Successfully built ee1669d4634b
Successfully tagged jl-manjaro:latest
my dockerfile
# cat Dockerfile_manjaro
FROM jonathonf/manjaro
RUN pacman-mirrors -c all
RUN pacman -Syu --noconfirm wget tar gzip base-devel
ENV JULIA_MAJOR=1.0
ENV JULIA_VERSION=1.0.3
ENV JULIA_SHA256=362ba867d2df5d4a64f824e103f19cffc3b61cf9d5a9066c657f1c5b73c87117
ENV JULIA_DIR=/usr/local/julia
ENV JULIA_PATH=${JULIA_DIR}
RUN mkdir ${JULIA_DIR} && \
cd /tmp && \
wget -q https://julialang-s3.julialang.org/bin/linux/x64/${JULIA_MAJOR}/julia-${JULIA_VERSION}-linux-x86_64.tar.gz && \
echo "$JULIA_SHA256 julia-${JULIA_VERSION}-linux-x86_64.tar.gz" | sha256sum -c - && \
tar xzf julia-${JULIA_VERSION}-linux-x86_64.tar.gz -C ${JULIA_DIR} --strip-components=1 && \
rm /tmp/julia-${JULIA_VERSION}-linux-x86_64.tar.gz
RUN ln -fs ${JULIA_DIR}/bin/julia /usr/local/bin/julia
RUN julia -e 'using Pkg;Pkg.REPLMode.pkgstr("add UnicodePlots;precompile");using UnicodePlots'
RUN julia -e 'using Pkg;Pkg.REPLMode.pkgstr("add PackageCompiler;precompile");using PackageCompiler'
RUN cd $(julia -e 'print(abspath(joinpath(dirname(Base.find_package("PackageCompiler")), "../examples")))') \
&& time julia -e 'using PackageCompiler; build_executable("hello.jl")' \
&& cd builddir \
&& ldd ./hello \
&& ./hello
LeoK987
January 7, 2019, 12:39am
12
If I copy all the files under builddir into /home/user/Software/julia-1.0.3/bin/
and run hello under /home/user/Software/julia-1.0.3/bin/
, then it sort of works:
$ pwd
/home/user/Software/julia-1.0.3/bin
[manjaro bin]$ ./hello
hello, world
sin(0.0) = 0.0
ββββββββββββββββββββββββββββββββββββββββββ
1 ββ β β β β β β β‘ β β β β β ’β‘β β β β β β β β β β β β β β β β β β β β β β β β β β β
ββ β β β β β’ β β β β β β β β β’β β β β β β β β β β β β β β β β β β β β β β β β β β
ββ β β β β’ β β β β β β β β β β β ³β‘β β β β β β β β β β β β β β β β β β β β β β β β
ββ β β β’ β β β β β β β β β β β β β ±β‘β β β β β β β β β β β β β β β β β β β β β β β
ββ β β’ β β β β β β β β β β β β β β β ³β‘β β β β β β β β β β β β β β β β β β β β β β
ββ β’β β β β β β β β β β β β β β β β β’£β β β β β β β β β β β β β β β β β β β β β β
ββ β‘β β β β β β β β β β β β β β β β β β’β β β β β β β β β β β β β β β β β β β β β
ββ Όβ €β €β €β €β €β €β €β €β €β €β €β €β €β €β €β €β €β €β ¬β’¦β €β €β €β €β €β €β €β €β €β €β €β €β €β €β €β €β €β €β’€β
ββ β β β β β β β β β β β β β β β β β β β β β‘β β β β β β β β β β β β β β β β β’β β
ββ β β β β β β β β β β β β β β β β β β β β β β‘β β β β β β β β β β β β β β β β‘β β
ββ β β β β β β β β β β β β β β β β β β β β β β ±β‘β β β β β β β β β β β β β β‘β β β
ββ β β β β β β β β β β β β β β β β β β β β β β β ±β‘β β β β β β β β β β β β‘β β β β
ββ β β β β β β β β β β β β β β β β β β β β β β β β ±β‘β β β β β β β β β β‘β β β β β
ββ β β β β β β β β β β β β β β β β β β β β β β β β β β’β β β β β β β’ β β β β β β β
-1 ββ β β β β β β β β β β β β β β β β β β β β β β β β β β β β’β£β£β£β β β β β β β β β
ββββββββββββββββββββββββββββββββββββββββββ
0 100
There must be something wrong with my julia env setting then. In my .bashrc I have set these. Something not appropriate?
export JULIA_DIR=/home/user/Software/julia-1.0.3
export JULIA_BINDIR=$JULIA_DIR/bin
export PATH=$JULIA_BINDIR:/home/user/Software/VSCode-linux-x64/bin/:$PATH
export LD_LIBRARY_PATH=./:$JULIA_DIR/lib:$LD_LIBRARY_PATH
1 Like
good news
I am only a (julia)beginner - and I am mostly using Docker environment.
my simple advice:
1 Like
LeoK987
January 7, 2019, 12:58am
14
@ImreSamu , thanks very much for the kind help!
1 Like
if everything is working - please set a βsolvedβ flag in the forum - so others can see the solutions.
Itβs not working yet. I still can not run hello from under builddir if I donβt copy all the files into JULIA_BINDIR.
Thatβs because itβs failing to load its shared libraries, which for some reason becomes a segfault, not a linker error. Maybe a good idea to file an issue on PackageCompilerβs Github, and provide a link to this discussion for context. At the very least, a linker error would be preferred to a segfault.
LeoK987
January 8, 2019, 12:20am
18
I agree that it should not segfault, but I donβt understand why it works for @ImreSamu βs setup.
What we know: On clean (Manjaro) Docker environment - it is working.
Question: What is the differences?
only you can find this - because I canβt replicate the error
Some hint:
Can you replicate your error in (Manjaro) Docker environment? ( add julia files, settings, .bashrc )
Testing PackageCompiler is OK ? ( pkg> test PackageCompiler
)
What is the result of :
# export | grep -i julia
# set | grep -i julia
What is your full $PATH?
If you donβt see any problems - try cleaning your environment:
backup !!!
remove ~/.julia ; ~/.juliarc.jl
remove all julia versions
check no libjulia in your system:
`find / -name βlibjulia*β
clean/verify environment variables, $PATH
reinstall only Julia-v1.0.3
add packages
your testcase is working?
it can be a complex issue:
2 Likes