Porting software to FreeBSD 5.2.1

Matthew Seaman m.seaman at infracaninophile.co.uk
Mon Apr 12 03:22:24 PDT 2004


On Mon, Apr 12, 2004 at 01:28:47AM -0500, Eric De la Cruz Lugo wrote:

> You probably know that libc is the library that includes all the standard C 
> commands (such as printf, read, open, etc.and so on) as well as system calls. 
> Up until 1997, the only library available was the GNU libc v1, which since the 
> move to ELF binary format was given major number 5 (/lib/libc.so.5). In 1997, 
> the Free Software Foundation developed GNU libc v2, with the intention of 
> being cleaner, more portable, and more standard (POSIX compliant). Under 
> Linux, this version got major number 6, hence it's called libc6. These two 
> libraries are incompatible - if a program is compiled with one libc's headers 
> and stubs, it can't be used with the other. 
>  
>  
> any one knows how i can use the libc6 in the linux compat directory? i have 
> checked on my sistem and in fact i have it!  
>  
> /usr/compat/linux/lib/libc.so.6 

Well, Linux is not FreeBSD.  And vice-versa.  You're trying to compile
this code as FreeBSD native, so you don't want to use the libraries
under /usr/compat/linux at all -- those are there for the benefit of
Linux binaries run under emulation.

The libc version number in FreeBSD is the same as the major version
number of the OS, so your FreeBSD 5.2.1 system has:

    /usr/lib/libc.so.5         -- single threaded libc
    /usr/lib/libc_r.so.5       -- reentrant (for multiply threaded) libc

Now, the problem you're running into is that certain similar function
calls etc. have an API similar enough that you can get the code to
compile, but that differ in subtle but significant ways in operation.
This can lead to core dumps and other effects as you've seen.
Unfortunately there is no simple way to resove that sort of problem.
You need to run the problem code under the debugger, work out why it
is blowing up and produce patches to the source code that fix the
problem.  It helps if you have an intimate knowledge of the FreeBSD
libc and preferably the Linux/GNU libc and where the incompatabilities
are likely to occur.

	Cheers,

	Matthew

-- 
Dr Matthew J Seaman MA, D.Phil.                       26 The Paddocks
                                                      Savill Way
PGP: http://www.infracaninophile.co.uk/pgpkey         Marlow
Tel: +44 1628 476614                                  Bucks., SL7 1TH UK
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-questions/attachments/20040412/be7e296f/attachment.bin


More information about the freebsd-questions mailing list