
Vitor Santos Costa wrote:
- The second possibility is that C++ needs a dynamic library, which is
weird. You can try
configure --enable-dynamic-loading make clean make install
That should have a .so file.
Please tell me if you can't still make it work.
Dear Vitor,
since I have stumbled on exactly the same problem encountered by Pat, I have tried the above suggestion. This solves the problem indicated by "usr/bin/ld: /usr/local/lib/libYap.a(c_interface.o): relocation R_X86_64_32S against `Yap_REGS' can not be used when making a shared object; recompile with -fPIC". However, now there is another problem:
% Restoring file /usr/local/lib/Yap/startup YAP version Yap-5.1.1 % reconsulting /home/roberto/ppl/ppl/interfaces/Prolog/YAP/yap_pl_check.pl... % reconsulting /home/roberto/ppl/ppl/interfaces/Prolog/YAP/ppl_yap.pl... % % % YAP OOOPS: tried to access illegal address 0x8!!!!. % % 1725KB of Code Space (0x8800000--0x89af4b0) 1KB of Global Stack (0x89b4000--0x89b4598) 2KB of Local Stack (0x8b3f768--0x8b40000) 0KB of Trail (0x8b40008--0x8b40088) Performed 0 garbage collections Running code at clause 1 of prolog:load_foreign_files/3 Continuation is at clause 1 of prolog:load_foreign_files/3 clause 1 of prolog:load_foreign_files/3 clause 2 of prolog:$do_yes_no/2 clause 6 of prolog:$process_directive/3 clause 5 of prolog:$execute_command/4 indexing code of prolog:$catch/3 (*) clause 1 of prolog:$system_catch/4 clause 1 of prolog:$loop/2 clause 1 of prolog:$do_lf/9 clause 7 of prolog:$lf/13 clause 1 of prolog:$load_files/3 clause 5 of prolog:$execute_command/4 indexing code of prolog:$catch/3 (*) clause 1 of prolog:$system_catch/4 clause 1 of prolog:$loop/2 clause 1 of prolog:$do_lf/9 clause 7 of prolog:$lf/13 clause 1 of prolog:$load_files/3 indexing code of prolog:$catch/3 (*) clause 1 of prolog:$system_catch/4 clause 1 of prolog:$do_startup_reconsult/1 clause 1 of prolog:$init_system/0 clause 1 of prolog:$live/0
Exiting ....
The problem disappears if I configure with
configure --enable-dynamic-loading --enable-debug-yap
I have tried to disable all optimizations in order to better understand what is going on using gdb, but with optimizations turned off, making Yap dies at this point:
gcc -rdynamic -Wl,-R,NONE/lib -o yap yap.o libYap.so -lgmp -lreadline -lncurses -ltermcap -lm -ldl -lnsl /usr/bin/ld: yap: hidden symbol `stat' in /usr/lib64/libc_nonshared.a(stat.oS) is referenced by DSO /usr/bin/ld: final link failed: Nonrepresentable section on output collect2: ld returned 1 exit status
By configuring with
CFLAGS="-g -O" ./configure --enable-dynamic-loading
I can use gdb to see where the illegal access at address 0x8 occurs:
% Restoring file /usr/local/lib/Yap/startup YAP version Yap-5.1.1 % reconsulting /home/roberto/ppl/ppl/interfaces/Prolog/YAP/yap_pl_check.pl... % reconsulting /home/roberto/ppl/ppl/interfaces/Prolog/YAP/ppl_yap.pl...
Program received signal SIGSEGV, Segmentation fault. Yap_NewPredPropByFunctor (fe=0x89af410, cur_mod=142656577) at ./C/adtdefs.c:532 532 p->KindOfPE = PEProp; (gdb) list 527 Prop p0; 528 PredEntry *p = (PredEntry *) Yap_AllocAtomSpace(sizeof(*p)); 529 530 INIT_RWLOCK(p->PRWLock); 531 INIT_LOCK(p->PELock); 532 p->KindOfPE = PEProp; 533 p->ArityOfPE = fe->ArityOfFE; 534 p->cs.p_code.FirstClause = p->cs.p_code.LastClause = NULL; 535 p->cs.p_code.NOfClauses = 0; 536 p->PredFlags = 0L; (gdb) print p $1 = (PredEntry *) 0x0 (gdb) print &(p->KindOfPE) $2 = (PropFlags *) 0x8 (gdb)
Does this shed any light? Please let me know if I can do more to help locate the sources of the problems. All the best,
Roberto