This is the mail archive of the newlib@sources.redhat.com mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

newlib & make versions


Hi,

I'm trying to compile newlib and I'm getting an error. After digging
inside a bit, I found out that it happens due to misuse of make in one
of the makefiles, or (more probably) because of differences between
different make versions. All the information is below, and I'd like to
ask you what make versions do you use to compile newlib, and whether
there are any plans to update the makefiles for the latest version?

The version of newlib that I'm using is 1.9.0, but I've fecthed the
current CVS version and the same happened with it too. I'm compiling
on an x86 host, targeted for powerpc-eabi. The configure command was:

./configure --target=powerpc-eabi --prefix=/usr/local/powerpc-eabi

I run make thusly:

make CC_FOR_TARGET=powerpc-eabi-gcc AS_FOR_TARGET=powerpc-eabi-as LD_FOR_TARGET=powerpc-eabi-ld AR_FOR_TARGET=powerpc-eabi-ar RANLIB_FOR_TARGET=powerpc-eabi-ranlib

The compiler and binutils are all available as specified. Then, after
some time whirring and crunching, make gives me the following:

make[2]: Entering directory `/home/alexsh/ppc/compiler/newlib-1.9.0/powerpc-eabi/libgloss/rs6000'
powerpc-eabi-gcc -O2 -g  -I. -I./.. `if [ -d ./../../newlib ]; then echo -I./../../newlib/targ-include -I./../../newlib/libc/include; fi` -mrelocatable-lib -mno-eabi -I. -I./.. -g -O2 -c sim-crt0.S
powerpc-eabi-gcc -O2 -g  -I. -I./.. `if [ -d ./../../newlib ]; then echo -I./../../newlib/targ-include -I./../../newlib/libc/include; fi` -mrelocatable-lib -mno-eabi -I. -I./.. -g -O2 -c mcount.S
powerpc-eabi-gcc -O2 -g  -I. -I./.. `if [ -d ./../../newlib ]; then echo -I./../../newlib/targ-include -I./../../newlib/libc/include; fi` -mrelocatable-lib -mno-eabi -O2 -I. -I./.. -c -g -O2 sim-print.c
powerpc-eabi-gcc -O2 -g  -I. -I./.. `if [ -d ./../../newlib ]; then echo -I./../../newlib/targ-include -I./../../newlib/libc/include; fi` -mrelocatable-lib -mno-eabi -O2 -I. -I./.. -c -g -O2 sim-inbyte.c
powerpc-eabi-gcc -O2 -g  -I. -I./.. `if [ -d ./../../newlib ]; then echo -I./../../newlib/targ-include -I./../../newlib/libc/include; fi` -mrelocatable-lib -mno-eabi -O2 -I. -I./.. -c -g -O2 sim-sbrk.c
powerpc-eabi-gcc -O2 -g  -I. -I./.. `if [ -d ./../../newlib ]; then echo -I./../../newlib/targ-include -I./../../newlib/libc/include; fi` -mrelocatable-lib -mno-eabi -O2 -I. -I./.. -c -g -O2 sim-abort.c
powerpc-eabi-gcc -O2 -g  -I. -I./.. `if [ -d ./../../newlib ]; then echo -I./../../newlib/targ-include -I./../../newlib/libc/include; fi` -mrelocatable-lib -mno-eabi -O2 -I. -I./.. -c -g -O2 sim-errno.c
powerpc-eabi-gcc -O2 -g  -I. -I./.. `if [ -d ./../../newlib ]; then echo -I./../../newlib/targ-include -I./../../newlib/libc/include; fi` -mrelocatable-lib -mno-eabi -I. -I./.. -g -O2 -c simulator.S
powerpc-eabi-ar rv libsim.a sim-print.o sim-inbyte.o sim-sbrk.o sim-abort.o sim-errno.o simulator.o fstat.o getpid.o isatty.o kill.o putnum.o stat.o unlink.o mcount.o
a - sim-print.o
a - sim-inbyte.o
a - sim-sbrk.o
a - sim-abort.o
a - sim-errno.o
a - simulator.o
powerpc-eabi-ar: fstat.o: No such file or directory
make[2]: *** [libsim.a] Error 1
make[2]: Leaving directory `/home/alexsh/ppc/compiler/newlib-1.9.0/powerpc-eabi/libgloss/rs6000'
make[1]: *** [stmp-bsp] Error 2
make[1]: Leaving directory `/home/alexsh/ppc/compiler/newlib-1.9.0/powerpc-eabi/libgloss'
make: *** [all-target-libgloss] Error 2

Now, I looked into the Makefile to see what it is. It contains the
following line:

fstat.o: $(srcdir)/../fstat.c

fstat.o is *not* generated. If I type "make fstat.o", it says that
nothing needs to be done for fstat.o, even though it doesn't actually
exist.

This is actually a make subtlety. To see it, create an empty
directory, touch a file there named foo.c, and put the following line
into Makefile:
bar.o: foo.c
If you then type "make" (or "make bar.o"), it will tell you that
nothing needs to be done for bar.o. If you put the following line in
the Makefile instead:
foo.o: foo.c
It will then try to compile foo.c into foo.o when you type "make",
because of the rule it has for converting .c files to .o files
(implicit in this example, and explicit in the newlib makefile -- but
it doesn't make a difference).

I'm not sure whether this is a bug or a feature -- for all I know it
can be both. I'm using make 3.79.1, which seems to be the latest
version. So, my question again -- how do you people compile newlib?


Thanks in advance!

-- 
Alex Shnitman <alexsh@hectic.net>
http://alexsh.hectic.net/   UIN 188956
PGP 0xEC5D619D / E1 F2 7B 6C A0 31 80 28  63 B8 02 BA 65 C7 8B BA


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]