Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 10 Jul 2004 08:20:38 +1000
From:      andrew clarke <mail@ozzmosis.com>
To:        Kris Kennaway <kris@obsecurity.org>
Cc:        freebsd-ports@freebsd.org
Subject:   Re: devel/linux_devtools question
Message-ID:  <20040709222037.GA70342@ozzmosis.com>
In-Reply-To: <20040709212549.GA52445@xor.obsecurity.org>
References:  <20040709172523.GA64473@ozzmosis.com> <20040709212549.GA52445@xor.obsecurity.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, Jul 09, 2004 at 02:25:49PM -0700, Kris Kennaway wrote:

> > $setenv CC /compat/linux/usr/bin/gcc 
> > 
> > $make blah
> > /compat/linux/usr/bin/gcc -O -pipe   blah.c  -o blah
> > In file included from /usr/include/errno.h:36,
> >                  from blah.c:1:
> > /usr/include/bits/errno.h:25:26: linux/errno.h: No such file or directory
> > *** Error code 1
> > 
> > Stop in /usr/home/ozzmosis/src/csource/blah.
> 
> Not going to work since the compiler will still see freebsd headers.

That's what I initially thought too, but gcc -v seems to suggest it
should work as it says it's looking in /compat/linux/[...]/include
first.  Also, notice the file is named /usr/include/bits/errno.h, which
doesn't exist in the freebsd headers, but does in the linux headers, so
it does seem to be OK.

$/compat/linux/usr/bin/gcc -v -c blah.c
Reading specs from /compat/linux/usr/bin/../lib/gcc-lib/i386-redhat-linux/3.2/specs
...
ignoring nonexistent directory "/compat/linux/usr/i386-redhat-linux/include"
ignoring nonexistent directory "/usr/i386-redhat-linux/include"
ignoring duplicate directory "/usr/lib/gcc-lib/i386-redhat-linux/3.2/include"
#include "..." search starts here:
#include <...> search starts here:
 /compat/linux/usr/lib/gcc-lib/i386-redhat-linux/3.2/include
 /usr/local/include
 /usr/include
End of search list.
In file included from /usr/include/errno.h:36,
                 from blah.c:1:
/usr/include/bits/errno.h:25:26: linux/errno.h: No such file or directory

This works:

$cat blah2.c
#include <stdio.h>

int main(void) { return puts("kwyjibo"; }

$/compat/linux/usr/bin/make blah2
cc     blah2.c   -o blah2

$file blah2
blah2: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for
GNU/Linux 2.2.5, dynamically linked (uses shared libs), not stripped

> chroot to /compat/linux and build from there, so the compiler
> toolchain sees only linux files.

$chroot /compat/linux
chroot: /compat/linux: Operation not permitted

Hmm.  I've never used chroot.  I assume it needs jail support in the
kernel?  The man page is a bit vague about that.

Either way, I tend to think the linux_devtools port is missing some
important files:

$pwd
/usr/compat/linux

$find . | grep -c linux/errno
0

Regards
Andrew



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040709222037.GA70342>