From owner-freebsd-emulation Wed Feb 24 13:38:42 1999 Delivered-To: freebsd-emulation@freebsd.org Received: from cons.org (knight.cons.org [194.233.237.195]) by hub.freebsd.org (Postfix) with ESMTP id E2429115CC for ; Wed, 24 Feb 1999 13:36:22 -0800 (PST) (envelope-from cracauer@cons.org) Received: (from cracauer@localhost) by cons.org (8.8.8/8.7.3) id JAA24039; Wed, 24 Feb 1999 09:23:03 +0100 (CET) Date: Wed, 24 Feb 1999 09:23:03 +0100 From: Martin Cracauer To: freebsd-emulation@freebsd.org Cc: Marcel Moolenaar Subject: Problem with Linux-crosscompiling on FreeBSD-ELF Message-ID: <19990224092302.A24011@cons.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.95.1i Sender: owner-freebsd-emulation@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org 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 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