howto convert Linux shared libraries foo.so to FreeBSD shared
libraries
Dan Nelson
dnelson at allantgroup.com
Sat Jun 24 16:21:25 UTC 2006
In the last episode (Jun 24), Simeon Nifos said:
> Does anybody know how to convert a shared object compiled in Linux
> foo-linux.so to a shared object compiled for FreeBSD freebsd-foo.so?
> I mean a freebsd-foo.so to which I can link with objects compiled by
> a native FreeBSD compiler. Or equivalently how to create a FreeBSD
> foo.so from a linux foo.so which would be identical to that which
> would be compiled from source in FreeBSD?
I don't think either of these are possible because internal library
structures (the size of off_t, or the field sizes and ordering of
struct stat or FILE, for example) are different. Any converter would
have to decompile the code into C (impossible in practice) and
recompile it at a FreeBSD binary.
> I do not need to run a Linux binary. What I need to do is to link my
> object (.o) files compiled natively in FreeBSD with a foo.so which is
> a linux library.
Take a look at the www/linuxpluginwrapper port, which creates wrapper
libraries that convert Linux function calls to FreeBSD ones. You then
use libmap.conf to substitute these libraries for any ones called by
the Linux shared library. Depending on what your library's API looks
like, and what external functions it calls, you might be able to get it
to work.
The correct solution would be to ask your vendor for either a FreeBSD
shared library, or the source :)
--
Dan Nelson
dnelson at allantgroup.com
More information about the freebsd-questions
mailing list