Linux compatibility: is it possible to link freebsd code to a linux library?

From: Olivier Boudry (olivier_sp1_at_yahoo.com)
Date: 08/12/04


Date: 12 Aug 2004 00:26:34 -0700

Hello,

Linux compatibility works fine to run linux binaries, but I'm
wondering if it's possible to compile code on FreeBSD and link it to a
linux library?

I want to compile SAP-Rfc, a perl module, to perform RFC to an SAP
server. The code must be linked to librfc.a, a library I can get only
in binary format for linux (no source available).

When I try to compile it I get the following error:
> make
cp lib/SAP/Config.pm blib/lib/SAP/Config.pm
cp Rfc.pm blib/lib/SAP/Rfc.pm
cp Iface.pm blib/lib/SAP/Iface.pm
/usr/local/bin/perl /usr/local/lib/perl5/5.8.5/ExtUtils/xsubpp
-typemap /usr/local/lib/perl5/5.8.5/ExtUtils/typemap Rfc.xs > Rfc.xsc
&& mv Rfc.xsc Rfc.c
cc -c -I/usr/sap/rfcsdk/include
-DAPPLLIB_EXP="/usr/local/lib/perl5/5.8.5/BSDPAN" -DHAS_FPSETMASK
-DHAS_FLOATINGPOINT_H -fno-strict-aliasing -pipe -I/usr/local/include
-O -pipe -DVERSION=\"1.32\" -DXS_VERSION=\"1.32\" -DPIC -fPIC
"-I/usr/local/lib/perl5/5.8.5/mach/CORE" -DSUMITELSE Rfc.c
Running Mkbootstrap for SAP::Rfc ()
chmod 644 Rfc.bs
rm -f blib/arch/auto/SAP/Rfc/Rfc.so
LD_RUN_PATH="/compat/linux/lib" cc -shared -L/usr/local/lib Rfc.o
-o blib/arch/auto/SAP/Rfc/Rfc.so -L/compat/linux/lib -lm -ldl
-lpthread -L/usr/sap/rfcsdk/lib -lrfc
/usr/libexec/elf/ld: cannot find -ldl
*** Error code 1

I added /compat/linux/lib to the library search path. The library is
found at configuration time, but not at link time.

So my first questions is: Is it possible to compile code on FreeBSD
and link it to a precompiled linux library.

And the second question: If yes, is there something I can do so ld
finds the needed libld and libpthread needed by librfc.a?

Best regards,

Olivier Boudry.



Relevant Pages

  • Re: xmingw and f2py
    ... I need to use f2py to compile code for the win32 platform and I want to ... do this in Linux. ... For those who dont know xmingw is a port to linux of mingw. ...
    (comp.lang.python)
  • Re: Linux compatibility: is it possible to link freebsd code to a linux library?
    ... > Linux compatibility works fine to run linux binaries, ... > wondering if it's possible to compile code on FreeBSD and link it to a ...
    (comp.unix.bsd.freebsd.misc)
  • xmingw and f2py
    ... I need to use f2py to compile code for the win32 platform and I want to ... do this in Linux. ... For those who dont know xmingw is a port to linux of mingw. ...
    (comp.lang.python)
  • Re: FreeBSD 4.x Opteron Question
    ... the FreeBSD developers told everyone that 5.3 was da ... initially over linux not because there's a bunch of good guys on the ... My tests measure kernel performance; ... > a networking device is a key performance indicator. ...
    (freebsd-questions)
  • Re: Newbie Experience
    ... I've only been around since FreeBSD 5.4 ... FreeBSD kernel too. ... always sunshine and linux is farts. ... in the hey day of AT&T Unix I'm ...
    (freebsd-questions)