From jan@swi.psy.uva.nl Fri Jun 22 09:13:57 2001
Received: from gollem.swi.psy.uva.nl (root@gollem [145.18.152.30])
	by swi.psy.uva.nl (8.11.2/8.11.2) with ESMTP id f5M7Duc15543;
	Fri, 22 Jun 2001 09:13:56 +0200 (MET DST)
Received: (from jan@localhost)
	by gollem.swi.psy.uva.nl (8.11.2/8.11.2/SuSE Linux 8.11.1-0.5) id f5M7DuL14410;
	Fri, 22 Jun 2001 09:13:56 +0200
Date: Fri, 22 Jun 2001 09:13:56 +0200
Message-Id: <200106220713.f5M7DuL14410@gollem.swi.psy.uva.nl>
From: Jan Wielemaker <jan@swi.psy.uva.nl>
Subject: Re: [SWIPL] SWI & JPL
To: Ross Hayward <R.Hayward@qut.edu.au>, prolog@swi.psy.uva.nl
In-Reply-To: Ross Hayward's message of Fri, 22 Jun 2001 16:35:20 +1000
Phone: +31 - 20 - 525 6121

> 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

