Date: Wed, 24 Feb 1999 09:23:03 +0100 From: Martin Cracauer <cracauer@cons.org> To: freebsd-emulation@freebsd.org Cc: Marcel Moolenaar <marcel@scc.nl> Subject: Problem with Linux-crosscompiling on FreeBSD-ELF Message-ID: <19990224092302.A24011@cons.org>
next in thread | raw e-mail | index | archive | help
I planned to attack this problem myself, but currently don't have time, so here is at least a notice. Marcel, this also affects the linux_libs package, see below. When doing Linux crosscompiles under FreeBSD-ELF, we face the problem that the Linux linker will also try to link to FreeBSD libraries. Under FreeBSD-aout it wouldn't. This break library search. Consider the following: PATH=/compat/linux/usr/bin:$PATH gcc -o test1 test1.c The library search path for a Linux compiler is typically /usr/lib /lib /usr/local/lib /usr/X11R6/lib or such. The problem now is that we have one Linux libc.so in /compat/linux/lib/libc.so not /usr/lib] and one FreeBSD libc.so in /usr/lib/libc.so Now, the Linux crosscompiler starts searching for libc.so in what he thinks is /usr/lib, which under Linux-emulation in FreeBSD is silently converted into a double-search in /compat/linux/usr/lib and /usr/lib [the FreeBSD one]. That means that it will find the FreeBSD libc.so in /usr/lib and it will use it since it is a ELF shared library. The search its satisfied before /lib (and therefore /compat/linux/lib) where the real Linux libc.so is located and the resulting binary will be broken because it is linked to the wrong C library. I solved the problem by symbolic linking all Linux libraries into the first directory in the search path. We need to take action here. Marcel, if you prepare a new linux_libs package, could you take this into account? I would think that we should either symlink everything into the first search directory or if we don't want to fill on a regular directory we could modify the Linux crosscompiler so that it has a new directory as the first one in the search path and then use this one a the main collection. Also, we could just move all Linux shared libs into one dir. Martin -- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Martin Cracauer <cracauer@cons.org> http://www.cons.org/cracauer/ Tel.: (private) +4940 5221829 Fax.: (private) +4940 5228536 Paper: (private) Waldstrasse 200, 22846 Norderstedt, Germany To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-emulation" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19990224092302.A24011>