From owner-freebsd-alpha Mon Jul 22 13:49:24 2002 Delivered-To: freebsd-alpha@freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 0951037B400 for ; Mon, 22 Jul 2002 13:49:21 -0700 (PDT) Received: from harrier.mail.pas.earthlink.net (harrier.mail.pas.earthlink.net [207.217.120.12]) by mx1.FreeBSD.org (Postfix) with ESMTP id A05D543E4A for ; Mon, 22 Jul 2002 13:49:20 -0700 (PDT) (envelope-from tlambert2@mindspring.com) Received: from pool0501.cvx40-bradley.dialup.earthlink.net ([216.244.43.246] helo=mindspring.com) by harrier.mail.pas.earthlink.net with esmtp (Exim 3.33 #1) id 17Wk7E-00000J-00; Mon, 22 Jul 2002 13:49:12 -0700 Message-ID: <3D3C6F92.AF46F2AE@mindspring.com> Date: Mon, 22 Jul 2002 13:48:18 -0700 From: Terry Lambert X-Mailer: Mozilla 4.79 [en] (Win98; U) X-Accept-Language: en MIME-Version: 1.0 To: Vahe Khachikyan Cc: freebsd-alpha@FreeBSD.ORG Subject: Re: Linux DEV breaks CCC! [was - Re: How did I break CCC?] References: <1026948385.3d35fd2179b20@vvl15.fh-konstanz.de> <1027369332.3d3c69746f1aa@vvl15.fh-konstanz.de> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-alpha@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org Vahe Khachikyan wrote: > I found out that linux development package installed on FBSD Alpha box > breaks the functionality of an existing CCC. > > The problem is that the INCLUDE paths seams to be hard coded somewhere. > It is even imossible to install the ccc package from scratch, cause > during make install it tries to comile something and ends up > with a big amount of errors cause of some definitions in include files. > I traced the program and find out that it reads the include files from > /compat/linux/usr/include if there is a directory with such name. > Renaming mentioned directory helps to figure out the problem > and the compiler becomes quite happy! > > Has anybody any idea why it searches the include files over there ? The compiler runs under Linux binary compatability mode. This means that there is an automatic pereference for path lookups to look in /compat/linux for any abcolute path name (i.e. beginning with "/"). This is done as part of the emulation so that the libraries that get used in the running of Linux binaries are Linux libraries, and so that the data files used by the Linux libraries (e.g. /etc/host.conf, /etc/resolv.conf) are in the correct format for those library routines which read them. The way the compiler works is by running in Linux binary compatability mode, which then generates Alpha assembly language. The Alpha assembly language is then passed to the local system assembler; if you do not have the Linux "devtools" installed, this will be the FreeBSD version of gas on the platform, and the resulting binaries will be FreeBSD native binaries. Probably, there should be a "magic" branding mechanism that causes only path lookups on binary components to be via the compatability path. However, there are not seperate open(2) calls that are used to distinguish binary from non-binary to the OS. Also, you might be doing what you are doing as a result of intent on your part to do Linux developement with the CCC compiler on FreeBSD ...with the intent that the code that results be Linux binaries. Obviously, for that to be true, you would not be using the ports (FreeBSD) version of the CCC compiler, since you would want to make sure that the gas and gld being called were in fact the Linux gas and gld. But in point of fact, the code can't tell the difference, and it's being invoked from a FreeBSD shell script, rather than a FreeBSD binary (or Linux binary). Probably, your best bet for cohabitation would be to create a "/FreeBSD" that would not be there in the Linux case, and link it to the "/" directory, e.g.: ln -s / /FreeBSD And then specify on the compiler command line (if this is possible) that /FreeBSD/include should be referenced before /usr/include. The lookup for /compat/linux/FreeBSD/include will fail, and everything will just work. This assumes that the /compat/linux prefix is not reinterpreted on the traversal of "/" for targets of symbolic links (this is done in the Linux system call layer for path names, so it should not be a problem, assuming you can get the compiler to cooperate). This type of thing should probably be automatic in the FreeBSD CCC package; it's ugly, but likely necessary, if your peculiar configuration is to be supported. -- Terry To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-alpha" in the body of the message