users-prolog
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Fwd: Re: Compilation on Darwin/MacOSX


From: Alexander Diemand
Subject: Fwd: Re: Compilation on Darwin/MacOSX
Date: Thu, 29 Jan 2004 18:16:53 +0100
User-agent: KMail/1.5.4

All,

I have forgotten to CC this mail to the list.
It might be of interest to others as well.

Addendum:
The problem only occured while compiling and linking a gprolog to native 
interface, which uses a different functor name than the native code routine's 
name.
example: :- 
foreign(pl_pgsql_connect(?integer), [fct_name('gp_pgsql_connect1')]).

Alex.
--- Begin Message --- Subject: Re: Compilation on Darwin/MacOSX Date: Thu, 29 Jan 2004 18:11:49 +0100 User-agent: KMail/1.5.4
Hi,

Command line used was something normal and standard with "gplc". 
In the meantime I continued looking into this matter and found some 
irregularities with assembler code generation (or the underlying hardware 
just improved in the meantime). :-)) 
The problem comes down to the fact that Mach-o has lazy linking and does not 
allow any changes in the .text section where our compiled code resides. 
Therefore the message below, which states " non-writable section".
This means that all external symbols need a stub construct in the .data 
section. The code in .text jumps to .data section, which in the meantime has 
magically been changed to point to the actual implementation of the target 
routine in linked shared libraries. Following the relevant documentation at 
http://developer.apple.com I have added this support (only for 
M_powerpc_darwin) to the Ma2Asm file: "powerpc_any.c"; see the attachement.
It seams to work pretty cool as compilation of the whole gprolog source tree 
and the example programs works! 
A single problem is still waiting for debugging: I was unable to run a 
compiled prolog program, which uses an interface to libgd. The reason might 
be the number of prolog-to-native stubs and thus the distance of the branches 
from .text to the .data stubs. (has to be debugged).

I would appreciate your testing of the attached "patched" powerpc_any.c on 
your platform and with your programs. The newly included code is between 
#ifdef M_powerpc_darwin und thus should not affect execution under Linux.

Greetings

Alex.



On Thursday 29 January 2004 15:45, Lindsey Spratt wrote:
> On Wednesday, January 28, 2004, at 09:59  AM, Alexander Diemand wrote:
> > Dear All
> >
> > I am trying to compile some prolog programs on a Mac running
> > Darwin/OSX(10.3).
> > GNU Prolog version: 1.2.16
> > GCC 3.3 (Apple's version)
> >
> > While examples in GNU Prolog work fine, programs with native interface
> > to
> > other libraries fail.
> > Example:
> >
> > ld: obj-Darwin/pgsql.pl.o has external relocation entries in
> > non-writable
> > section (__TEXT,__text) for symbols:
> > _strdup
> >
> > The symbol "_strdup" is defined in libc but the linker cannot find it
> > (??!!).
>
> I compile gprolog 1.2.16 on OSX 10.3 as part of my XGP project
> (http://xgp.sourceforge.net/). While I've had some complicated linking
> issues, I haven't seen the particular problem you have. What is the
> exact  command line you use to do the compilation?
>
> Lindsey Spratt
> http://homepage.mac.com/lspratt

Attachment: powerpc_any-c.gz
Description: GNU Zip compressed data


--- End Message ---

reply via email to

[Prev in Thread] Current Thread [Next in Thread]