2005-02-28 11:04:48

by Donald Duckie

[permalink] [raw]
Subject: ethertap.c compilation problem

Hi!

I tried cross-compiling ethertap.c with
linux-sh-2.4.18, but can not successfully make it.

TOPDIR was set as /usr/src/linux-sh-2.4.18
CROSS_COMPILE =sh4-linux-
CC = $(CROSS_COMPILE)gcc

the compilation errors are:
--------------------------------------------------
[aphrodite@aphrodite2 net]$ pwd
/usr/src/linux-sh-2.4.18/drivers/net
[aphrodite@aphrodite2 net]$ make
make all_targets
make[1]: Entering directory
`/usr/src/linux-sh-2.4.18/drivers/net'
cc -DKBUILD_BASENAME=auto_irq -c -o auto_irq.o
auto_irq.c
In file included from /usr/include/asm/atomic.h:17,
from /usr/include/linux/module.h:25,
from auto_irq.c:33:
/usr/include/asm/system.h: In function `tas':
/usr/include/asm/system.h:81: unknown register name
`t' in `asm'
In file included from /usr/include/linux/sched.h:14,
from auto_irq.c:34:
/usr/include/linux/timex.h: At top level:
/usr/include/linux/timex.h:173: field `time' has
incomplete type
In file included from /usr/include/linux/sched.h:82,
from auto_irq.c:34:
/usr/include/linux/timer.h:17: field `list' has
incomplete type
auto_irq.c: In function `autoirq_report':
auto_irq.c:51: `jiffies' undeclared (first use in this
function)
auto_irq.c:51: (Each undeclared identifier is reported
only once
auto_irq.c:51: for each function it appears in.)
auto_irq.c: At top level:
auto_irq.c:56: syntax error before
"this_object_must_be_defined_as_export_objs_in_the_Makefile"
auto_irq.c:56: warning: data definition has no type or
storage class
auto_irq.c:57: syntax error before
"this_object_must_be_defined_as_export_objs_in_the_Makefile"
auto_irq.c:57: warning: data definition has no type or
storage class
make[1]: *** [auto_irq.o] Error 1
make[1]: Leaving directory
`/usr/src/linux-sh-2.4.18/drivers/net'
make: *** [first_rule] Error 2
--------------------------------------------------

what could be the possible problem in here?

basing on this compile log, i am expecting that:
(for example)
/usr/include/asm/system.h
to be
/usr/src/linux-sh-2.4.18/include/asm/system.h

I know that there is no need to touch the Makefiles,
Rules.make for this, but I also tried replacing all
$(TOPDIR) to /usr/src/linux-sh-2.4.18.
The result was still the same.

I already ran make dep, make clean, and still got the
same result.

And also to my surprise,
/usr/src/linux -> linux-sh-2.4.18
/usr/src/linux-sh-2.4.18
doing a :
cd linux
would result to:
/usr/src/linux instead of /usr/src/linux-sh-2.4.18
has anyone experienced this?
if so, can this be explained as to why this is the
result?

hoping for some insights on how to proceed with my
compilation problem.


thank you.
donald



__________________________________
Do you Yahoo!?
Yahoo! Mail - Easier than ever with enhanced search. Learn more.
http://info.mail.yahoo.com/mail_250


2005-02-28 20:36:15

by Willy Tarreau

[permalink] [raw]
Subject: Re: ethertap.c compilation problem

Hi,

On Mon, Feb 28, 2005 at 03:04:39AM -0800, Donald Duckie wrote:
(...)
> In file included from /usr/include/asm/atomic.h:17,
> from /usr/include/linux/module.h:25,
> from auto_irq.c:33:
> /usr/include/asm/system.h: In function `tas':
> /usr/include/asm/system.h:81: unknown register name
> `t' in `asm'
> In file included from /usr/include/linux/sched.h:14,
> from auto_irq.c:34:
> /usr/include/linux/timex.h: At top level:
> /usr/include/linux/timex.h:173: field `time' has
> incomplete type
> In file included from /usr/include/linux/sched.h:82,
> from auto_irq.c:34:
> /usr/include/linux/timer.h:17: field `list' has
> incomplete type
> auto_irq.c: In function `autoirq_report':
> auto_irq.c:51: `jiffies' undeclared (first use in this
> function)
> auto_irq.c:51: (Each undeclared identifier is reported
> only once
> auto_irq.c:51: for each function it appears in.)

Missing or bad includes. Is your 'include/asm' link pointing
to the valid arch ? Have you got any reports that this arch
compiles without any tweaking ?

> auto_irq.c: At top level:
> auto_irq.c:56: syntax error before
> "this_object_must_be_defined_as_export_objs_in_the_Makefile"

it means that you must append the name of the resulting ".o" file to
the "export_objs" list in the makefile located in the same directory.

(...)


> basing on this compile log, i am expecting that:
> (for example)
> /usr/include/asm/system.h
> to be
> /usr/src/linux-sh-2.4.18/include/asm/system.h

This should not be true. /usr/include/asm should reflect the includes for
YOUR architecture, not the one your are currently cross-compiling for. But
at most it may prevent you from compiling user-space progs (eg: lxdialog),
but should not cause any trouble to other parts of the kernel.

> I know that there is no need to touch the Makefiles,
> Rules.make for this, but I also tried replacing all
> $(TOPDIR) to /usr/src/linux-sh-2.4.18.
> The result was still the same.

No need to play with this. Oh, and BTW, are you sure that your GCC version
is compatible with 2.4.18 ? You should use 2.95 or even 2.91 for this, but
I don't think that any 3.X will work.

> I already ran make dep, make clean, and still got the
> same result.

Out of curiosity, have you done 'make oldconfig' ?
And also, have you set ARCH=sh4 ?

> And also to my surprise,
> /usr/src/linux -> linux-sh-2.4.18

you don't need /usr/src/linux at all, and I even suggest that you remove
this link which seems to confuse you.

> /usr/src/linux-sh-2.4.18
> doing a :
> cd linux
> would result to:
> /usr/src/linux instead of /usr/src/linux-sh-2.4.18
> has anyone experienced this?

This is a configurable 'cd' behaviour. Use 'cd -P' to follow the Physical
path. Man bash for more info.

> if so, can this be explained as to why this is the
> result?

absolutely not related.

> hoping for some insights on how to proceed with my
> compilation problem.

Well, at least clean up the few points above to leverage confusion, ensure
that your GCC is able to compile this tree and that you have set every
variable correctly, and if it still does not work, follow the includes and
try to find what breaks by hand.

You should be compiling this way :

$ cd /usr/src/linux-sh-2.4.18
$ cp .config ../.config.saved
$ make ARCH=sh4 distclean
$ mv ../.config.saved .config
$ make ARCH=sh4 CROSS_COMPILE=sh4-linux- oldconfig
$ make ARCH=sh4 CROSS_COMPILE=sh4-linux- dep
$ make ARCH=sh4 CROSS_COMPILE=sh4-linux- vmlinux modules

If you think you have no reason to encounter such problems, try to get in
touch with the arch maintainer.

Regards,
Willy