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

Re: where to put object file



On Fri, 2005-07-22 at 23:55 +0200, Bas Wijnen wrote:
> On Fri, Jul 22, 2005 at 03:44:05PM +1000, skaller wrote:
> > Where should a required object file  be put?
> > 
> > File in question is a mainline stub, associated with a 
> > static archive, program is built by linking it with
> > the archive and user object file. 
> 
> If I were upstream, 

I am both upstream and maintainer..

> I would probably put it inside the static archive using
> ar. 

That isn't really possible: the file contains main(),
and there could be more than one such file which do
different things (in fact there are, but only one
is 'standard' at the moment).

>  If that is not desirable
[]
>  I think it should go in /usr/lib/package/, like
> other (platform dependant) package helper files.

Actually the 'standard' place is 

$PREFIX/lib/felix/rtl

however the standard place for the library .a file is 
also there. I changed that for Debian, the .a and .so
files both go in /usr/lib as per Debian Policy.

> I suppose this is a -dev package btw? 

No, it's a complete programming language (felix-1.1.0-1)
currently bundled into a single Debian package.

The translator does not generate programs, it generates
libraries. By default, to make a program you need 
three parts:

(a) The user code (xxxx.so)
(b) The executable driver (/usr/bin/flx_run)
(c) The runtime library (/usr/lib/libflx_dynamic.so)

The sequence of operation by the scripting harness is:

1. flxg, the Felix compiler, translates xxxx.flx
to xxxx.hpp and xxxx.cpp (C++ source code)

2. g++ compiles xxxx.cpp to xxxx.o

3. g++ links xxxx.o to xxxx.so

4. flx_run loads xxxx.so using dlopen() and runs
the symbol 'start' in a special way.

However you can also use static linkage, 
and then you need:

(a) The user code (xxxx.o)
(b) The mainline object file (????/flx_run.o)
(c) The runtime library (/usr/lib/libflx_static.a)

in which case the compilation goes

1. flxg translates xxxx.flx to xxxx.cpp and .hpp as above

2. g++ compiles xxxx.cpp to xxxx.o

3. g++ links flx_run.o libflx_static.a and xxxx.o 
   to create the program xxxx
 
4. the program xxxx is run

The question is where to put (b) in the static case.
The user just types:

flx xxxx # for dynamic linkage

or

flx --static xxxx # for static linkage

except the latter doesn't work due to a bug:
the file flx_run.o is in the wrong place.
There is a bug in th bugtracker:

Bug#319167: felix: flx expects libflx_static.a in wrong path

I need to fix it, but I'm not sure how .. hence the question.

> I think only libraries should go in /usr/lib.  

> A directory like that gets
> pretty unreadable, because it's so full of stuff, but the fact that the
> compiler can find things there is worth it.  However, as it won't find object
> files there (unless specifically pointed to it), putting them there anyway
> would just be obscure IMO.

Yeah, that makes sense.

Just some explanation: running a single threaded program
is a special case. Felix makes reentrant library code
which is used to support high performance user space 
threading.

There is no standard way to drive the threads: the client
has to write a driver in C++ (this is to allow the system
to be embedded easily).

However the 'single thread of control' is a special case
where the package provides a standard driver which makes
that thread look like an ordinary program. That's the
flx_run executable (if the user code is dynamically
loaded) or the flx_run.o mainline if static linking
is to be used.

-- 
John Skaller <skaller at users dot sourceforge dot net>

Attachment: signature.asc
Description: This is a digitally signed message part


Reply to: