[uClinux-dev] Failing to build uClinux

McLoughlin, Conor Conor.McLoughlin at avocent.com
Fri Aug 26 05:46:05 EDT 2005

Hi everyone,

I am new to uClinux and am having a number of issues building uClinux
with the latest sources, 
I didn't have these issues with a previous snapshot of the source.

My target is Xilinx microblaze for the Memec Sparten 3 development
board, but the issues are more generic to uClinux-dev that specific to
my target.

I grabbed a cvs snapshot of uClinux-dev and uClinux-2.4.x a few days ago
(August 23rd).
I applied the patch given in
to run the kernel from ROM.

The first minor issue is "permission denied" while creating symbolic
link in uClinux-dev/include.
ln: creating symbolic link `gcc/include` to
include`: Permission denied

This issue relates to the version (4.5.3)of the ln command I have. This
behaves differently
to later versions when the destination of the link already exists. 
For example, if I do "ln -s /tmp test1; ln -s /tmp test1". The second
ln, seeing that test1 
is already a link to a directory, creates another link on top of /tmp.
With a later version
of ln this does not appear to happen.
I easily work around this simply by modifying Makefile to check for the
existence of the
symbolic link first.

With the second issue, I don't understand why others have not seen it
before now.
This first appears when building zlib. The compile fails because it
can't find a number of standard header files.
I can work around this by putting back some lines that were removed from
--- Makefile.original	2005-08-25 13:38:18.000000000 +0100
+++ Makefile	2005-08-25 15:42:47.000000000 +0100
@@ -6,12 +6,19 @@
+# we need the standard gcc includes
+GCC_DIR   := $(shell $(CC) -v 2>&1|grep specs|sed -e 's/.*
 # glibc contains lots of nasty headers in a bad location,  so we need
 # to cheat a little here
 	$(ROOTDIR)/lib/STLport/stlport/*,STLport \
+	$(ROOTDIR)/uClibc/include/*,. \
 	$(ROOTDIR)/lib/libgmp/gmp.h,. \
 	$(ROOTDIR)/lib/libgmp/mp.h,. \
 	$(ROOTDIR)/lib/libgmp/gmp-impl.h,. \
@@ -44,6 +51,7 @@
 	$(ROOTDIR)/$(LINUXDIR)/include/asm,. \
 	$(ROOTDIR)/$(LINUXDIR)/include/mtd,. \
 	$(ROOTDIR)/config,. \
+	$(GCC_DIR)/include/*,include \
 	$(ROOTDIR)/lib/expat/lib/expat.h,. \
 	$(ROOTDIR)/user/tinytcl/*.h,. \
 	$(ROOTDIR)/prop/config/config*.h,. \
@@ -98,9 +106,11 @@
 			ln -s $$i $$dst/.; \
 		done ; \
-	@ln -s `$(CC) -print-file-name=include` gcc
+	@if [ ! -L gcc ]; then ln -s `$(CC) -print-file-name=include`
gcc; fi
 	@echo "Making include/c++ symlink to compiler c++ includes"
-	@ln -s /usr/local/include/g++-v3 c++
+	@if [ ! -L c++ ]; then ln -s /usr/local/include/g++-v3 c++; fi
 	@for i in `$(CXX) -v -xc++ /dev/null 2>&1 | sed -e '/^Reading
specs/,/^#include <\.\.\.>/d' -e '/End of search list/Q'`; do \
 		if [ -f $$i/new ]; then rm -f c++; ln -s $$i c++; break;
fi; \
I don't know if this approach is correct, but it does overcome this
particular problem.
I don't know yet if it introduces any other problems.

After this, the build now fails with

make[2]: Entering directory
mb-gcc  -Os -g -fomit-frame-pointer -fno-common -Wall   -mno-xl-soft-mul
-mxl-barrel-shift -mno-xl-soft-div -Dlinux -D__linux__ -Dunix
-D__uClinux__ -DEMBED -nostdinc
-I/home/conorm/uClinux-dist/uClinux-dist/include/include -fno-builtin
-D__USE_BSD   -c -o agetty.o agetty.c
mb-gcc  -Os -g -fomit-frame-pointer -fno-common -Wall   -mno-xl-soft-mul
-mxl-barrel-shift -mno-xl-soft-div -Dlinux -D__linux__ -Dunix
-D__uClinux__ -DEMBED -nostdinc
-I/home/conorm/uClinux-dist/uClinux-dist/include/include -fno-builtin
-Wl,-elf2flt -nostartfiles
-L/home/conorm/uClinux-dist/uClinux-dist/lib -o agetty agetty.o -lc
/../../../../microblaze/lib/libc_hard_shift.a  -lc
mb-gcc: /home/conorm/uClinux-dist/uClinux-dist/lib/crt0.o: No such file
or directory

I am just now trying to see what the source of this problem is.  I
suspect that it may be something similar to the problem with the header

I was surprised that I see these issues and don't understand why others
have not reported seeing them yet.
Is there something obvious that I am missing or not doing correctly that
could throw up these build problems?  Is there some patches that I
should have applied?

When the changes were made to the uClinux-dist/include/Makefile to
remove some of the links to header files, were there any changes
elsewhere to allow the header files to be found?

Any ideas would be very welcome at this stage.


More information about the uClinux-dev mailing list