Julia: Segfault on clean build, FreeBSD 12.1

Created on 2 Feb 2020  路  14Comments  路  Source: JuliaLang/julia

I updated my FreeBSD system from 12.0 to 12.1, cleaned out my Julia clone (git clean -fdx) and rebuilt from scratch with the default options and no ccache. It seems there was a segfault while building the sysimage:

    LINK usr/lib/libjulia.so.1.5
ld: warning: found local symbol '__bss_start' in global part of symbol table in file /usr/home/alex/Projects/julia/usr/lib/libLLVM.so
ld: warning: found local symbol '_end' in global part of symbol table in file /usr/home/alex/Projects/julia/usr/lib/libLLVM.so
ld: warning: found local symbol '_edata' in global part of symbol table in file /usr/home/alex/Projects/julia/usr/lib/libLLVM.so
    CC ui/repl.o
    LINK usr/bin/julia
    JULIA usr/lib/julia/corecompiler.ji
gmake[1]: *** [sysimage.mk:61: /usr/home/alex/Projects/julia/usr/lib/julia/corecompiler.ji] Segmentation fault (core dumped)
gmake: *** [Makefile:81: julia-sysimg-ji] Error 2

The full build output can be found here. The system compiler is Clang 8.0.1 and the local GCC version is 9.2.0.

EDIT: Also note the LLVM deprecation messages during the build; I don't recall getting those on Linux or macOS.

bug build freebsd

All 14 comments

Seems to build and work just fine if I rebuild with USE_BINARYBUILDER=0. A problem with the cross-compiled LLVM, maybe? @staticfloat?

Also, the nightly binaries as of fbc2c0aec1, version 1.5.0-DEV.221, seem to be operable AFAICT...

Any chance to find out which is the offending binary, maybe by using binary search? :grin:

which is the offending binary

Not sure what you mean. Like which dependency is the problem?

Yes

Also, the nightly binaries as of fbc2c0a, version 1.5.0-DEV.221, seem to be operable AFAICT...

So you're saying the nightly binaries work, but you can't compile from source using BB deps?

Yes, exactly.

Can you run the bootstrap command in gdb or lldb to see where the segfault is coming from?

I'm not sure how exactly to do that. Any tips?

This should work:

cd base
gdb ../julia
(gdb) r --output-ji x compiler/compiler.jl
$ gdb ../julia
GNU gdb (GDB) 9.1 [GDB v9.1 for FreeBSD]
<...>
Reading symbols from ../julia...
(gdb) r --output-ji x compiler/compiler.jl
Starting program: /usr/home/alex/Projects/julia/julia --output-ji x compiler/compiler.jl
[New LWP 100768 of process 10478]

Thread 1 received signal SIGSEGV, Segmentation fault.
0x000000080048c0c8 in uv__to_stat (src=0x7fffffffde10, dst=0x19) at src/unix/fs.c:1104
1104    src/unix/fs.c: No such file or directory.
(gdb) bt
#0  0x000000080048c0c8 in uv__to_stat (src=0x7fffffffde10, dst=0x19) at src/unix/fs.c:1104
#1  0x000000080048bdbf in uv__fs_stat (path=0x80000006400 <error: Cannot access memory at address 0x80000006400>, buf=0x19)
    at src/unix/fs.c:1260
#2  0x0000000000000000 in ?? ()

Looks like it could be an issue with the libuv provided by BinaryBuilder. Any suggestions for how to confirm?

Quoting Elliot from a discussion elsewhere,

I think this is something having to do with attempting to link a static library that was built on 11 against system libraries from 12

One potential fix here may be to dynamically link libuv.

Something has changed, and now it's a sigabort rather than a segfault

$ gdb ../julia
GNU gdb (GDB) 9.1 [GDB v9.1 for FreeBSD]
<...>
Reading symbols from ../julia...
(gdb) r --output-ji x compiler/compiler.jl
Starting program: /usr/home/alex/Projects/julia/julia --output-ji x compiler/compiler.jl
[New LWP 100873 of process 31424]

Thread 1 received signal SIGABRT, Aborted.
0x0000000800d7a1ba in thr_kill () from /lib/libc.so.7
(gdb) bt
#0  0x0000000800d7a1ba in thr_kill () from /lib/libc.so.7
#1  0x0000000800d785e4 in raise () from /lib/libc.so.7
#2  0x0000000800cec7e9 in abort () from /lib/libc.so.7
#3  0x000000080049fbb0 in uv__io_poll (loop=0x800810380 <default_loop_struct>, timeout=0) at src/unix/kqueue.c:239
#4  0x000000080048802d in uv_run (loop=0x800810380 <default_loop_struct>, mode=UV_RUN_DEFAULT) at src/unix/core.c:359
#5  0x00000008003b63fa in jl_atexit_hook (exitcode=<optimized out>) at init.c:284
#6  0x0000000000202395 in main (argc=<optimized out>, argv=<optimized out>) at repl.c:228

Could be the same underlying issue though

Was this page helpful?
0 / 5 - 0 ratings