Subject: Re: [SWIPL] SWI & JPL

From: Jan Wielemaker <[email-masked]>
Date: Fri, 22 Jun 2001 09:13:56 +0200

> This is a multi-part message in MIME format.
> --------------E3943BC248948FC93AEC7B6C
> Content-Type: text/plain; charset=us-ascii
> Content-Transfer-Encoding: 7bit
> 
> Has anyone had trouble linking to libpl.a when compiling jpl?
> 
> I'm using solaris 2.7, gcc 2.95.2, pl-4.0.7,  jpl-1.0.1 and a limited
> number if ideas.
> 
> 
> gcc  -shared -o ../lib/libjpl.so jpl_fli_Prolog.o
> -L/home3/hayward/lib/pl-4.0.7/runtime/sparc-solaris2.7 -lpl -ldl
> -lreadline -ltermcap -lm
> Text relocation remains                         referenced
>     against symbol                  offset      in file
> <unknown>                           0x464
> /home3/hayward/lib/pl-4.0.7/runtime/sparc-solaris2.7/libpl.a(pl-util.o)
> <unknown>                           0x460
> /home3/hayward/lib/pl-4.0.7/runtime/sparc-solaris2.7/libpl.a(pl-util.o)
> .....
> <unknown>                           0x2888
> /home3/hayward/lib/pl-4.0.7/runtime/sparc-solaris2.7/libpl.a(pl-wic.o)
> <unknown>                           0x288c
> /home3/hayward/lib/pl-4.0.7/runtime/sparc-solaris2.7/libpl.a(pl-wic.o)
> <unknown>                           0x2890
> /home3/hayward/lib/pl-4.0.7/runtime/sparc-solaris2.7/libpl.a(pl-wic.o)
> ld: fatal: relocations remain against allocatable but non-writable
> sections
> collect2: ld returned 1 exit status
> make[1]: *** [../lib/libjpl.so] Error 1
> make[1]: Leaving directory `/home3/hayward/B/A/PROLOG/jpl-1.0.1/src'
> make: *** [all] Error 2

You should recompile SWI-Prolog, adding the option -fPIC to gcc to make
Prolog's code position-independent.  It's been a while ago I did this,
but then Prolog got a lot (+/- 30%) slower on the SPARC due to the
clumsy way the sparc handles relative calls and jumps over long
distances.  Maybe things have improved since.  Otherwise I would compile
two versions; one normal and one using -fPIC.

	Regards --- Jan