Skip to content

Example C program crashes with "cannot open shared object file" #1193

Description

@kamahen

The traceback doesn't make sense. When I ran under gdb, the crash seems to have happened somewhere inside PL_initialise(), where it calls prologTopLevel() (pl-init.c:1247).

[peter@penguin man (master=)]$ swipl-ld -goal true -o calc calc.c calc.pl
% Disabled autoloading (loaded 30 files)
% Disabled autoloading (loaded 0 files)
% halt
[peter@penguin man (master=)]$ ./calc pi/2
ERROR: /home/peter/.local/lib/swipl/library/uri.pl:59: Initialization goal raised exception:
ERROR: uri: cannot open shared object file: No such file or directory
ERROR: In:
ERROR:   [18] throw(error(shared_object(open,'uri: cannot open shared object file: No such file or directory'),context(...,_4354)))
ERROR:   [16] <meta call>
ERROR:   [15] with_mutex('$foreign',load_foreign_library(foreign(uri),uri,[])) <foreign>
ERROR:   [11] '$run_init_goal'('$syspreds':use_foreign_library_noi(...)) at /home/peter/src/swipl-devel/boot/init.pl:823
ERROR:   [10] catch(system:'$run_init_goal'(...),_4488,system:'$initialization_error'(_4510,...,...)) at /home/peter/src/swipl-devel/boot/init.pl:563
ERROR:    [9] catch_with_backtrace(system:'$run_init_goal'(...),_4546,system:'$initialization_error'(_4568,...,...)) at /home/peter/src/swipl-devel/boot/init.pl:643
ERROR: 
ERROR: Note: some frames are missing due to last-call optimization.
ERROR: Re-run your program in debug mode (:- debug.) to get more detail.
ERROR: /home/peter/.local/lib/swipl/library/time.pl:134: Initialization goal raised exception:
ERROR: time: cannot open shared object file: No such file or directory
ERROR: In:
ERROR:   [18] throw(error(shared_object(open,'time: cannot open shared object file: No such file or directory'),context(...,_218)))
ERROR:   [16] <meta call>
ERROR:   [15] with_mutex('$foreign',load_foreign_library(foreign(time),time,[])) <foreign>
ERROR:   [11] '$run_init_goal'('$syspreds':use_foreign_library_noi(...)) at /home/peter/src/swipl-devel/boot/init.pl:823
ERROR:   [10] catch(system:'$run_init_goal'(...),_352,system:'$initialization_error'(_374,...,...)) at /home/peter/src/swipl-devel/boot/init.pl:563
ERROR:    [9] catch_with_backtrace(system:'$run_init_goal'(...),_410,system:'$initialization_error'(_432,...,...)) at /home/peter/src/swipl-devel/boot/init.pl:643
ERROR: 
ERROR: Note: some frames are missing due to last-call optimization.
ERROR: Re-run your program in debug mode (:- debug.) to get more detail.
1.5707963267948966
[peter@penguin man (master=)]$ ldd ./calc
	linux-vdso.so.1 (0x00007ffd9c1d4000)
	libswipl.so.9 => /home/peter/.local/lib/swipl/lib/x86_64-linux/libswipl.so.9 (0x00007ec3c7af4000)
	libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007ec3c7907000)
	libtinfo.so.6 => /lib/x86_64-linux-gnu/libtinfo.so.6 (0x00007ec3c78d8000)
	libgmp.so.10 => /lib/x86_64-linux-gnu/libgmp.so.10 (0x00007ec3c7857000)
	libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007ec3c783a000)
	libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007ec3c7832000)
	libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007ec3c76ee000)
	libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007ec3c76cc000)
	/lib64/ld-linux-x86-64.so.2 (0x00007ec3c7c9d000)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions