Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

compiled hello.jl segfault #163

Closed
XilinJia opened this issue Jan 8, 2019 · 1 comment · Fixed by #304
Closed

compiled hello.jl segfault #163

XilinJia opened this issue Jan 8, 2019 · 1 comment · Fixed by #304

Comments

@XilinJia
Copy link

XilinJia commented Jan 8, 2019

This relates to discussion in the forum: https://discourse.julialang.org/t/aot-compiled-hello-jl-core-dump/19318/5

First copy hello.jl into a tmp folder. Then

$ 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
julia>exit()

builddir]$ ./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

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

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)

Not sure what is going on, I then copied hello.so from builddir into my JULIA_BINDIR: /home/user/Software/julia-1.0.3/bin/, then:

builddir]$ ./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)

But if I copy all files in builddir into my JULIA_BINDIR, then it works.

How can I not copy all files into JULIA_BINDIR?

@terasakisatoshi
Copy link
Contributor

How about trying build_executable("hello.jl","hello") instead of build_executable("hello.jl") ?
I always do so and it works fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants