Hi,
I answer to myself:
2007/5/24, Francisco Perea <[EMAIL PROTECTED]>:
Hi,
I'm newbie in Linux land. I'm trying to build a small router for GPRS
applications and I downloaded last version of uclinux
(uClinux-dist-20070130) and m68k-tools (m68k-uclinux-tools-20061214)
for a M5272C3 EVB.
It compiles fine for default options, but when I set routing
functions, linker stage for libnfnetlink doesn't works.
Here it's output:
make[5]: Entering directory `/uClinux-dist/lib/libnfnetlink/build/src'
/bin/sh ../libtool --mode=link ucfront-gcc m68k-elf-gcc -m5307
-DCONFIG_COLDFIRE -fPIC -Wall -O2 -g -fomit-frame-pointer -pipe
-fno-common -fno-builtin -Wall -DEMBED -msep-data -Dlinux
-D__linux__ -Dunix -D__uClinux__ -Wl,--fatal-warnings -Wl,-elf2flt
-Wl,-move-rodata -msep-data -Wl,--fatal-warnings -Wl,-elf2flt
-Wl,-move-rodata -msep-data -o libnfnetlink.la -rpath /lib
-Wc,-nostartfiles libnfnetlink.lo
rm -fr .libs/libnfnetlink.so.0.0.0.elf .libs/libnfnetlink.so.0.0.0.elf2flt
ucfront-gcc m68k-elf-gcc -m5307 -DCONFIG_COLDFIRE -shared
.libs/libnfnetlink.o -m5307 -msep-data -Wl,--fatal-warnings
-Wl,-elf2flt -Wl,-move-rodata -msep-data -Wl,--fatal-warnings
-Wl,-elf2flt -Wl,-move-rodata -msep-data -nostartfiles -Wl,-soname
-Wl,libnfnetlink.so.0 -o .libs/libnfnetlink.so.0.0.0
/usr/local/lib/gcc/m68k-uclinux/4.1.1/../../../../m68k-uclinux/bin/ld.real:
warning: cannot find entry symbol _start; defaulting to 00000000
.libs/libnfnetlink.so.0.0.0.elf2flt: In function `__uClibc_start_main':
: undefined reference to `main'
collect2: ld returned 1 exit status
make[5]: *** [libnfnetlink.la] Error 1
make[5]: Leaving directory `/uClinux-dist/lib/libnfnetlink/build/src'
make[4]: *** [all-recursive] Error 1
make[4]: Leaving directory `/uClinux-dist/lib/libnfnetlink/build'
make[3]: *** [all] Error 2
make[3]: Leaving directory `/uClinux-dist/lib/libnfnetlink'
make[2]: *** [libnfnetlink] Error 2
make[2]: Leaving directory `/uClinux-dist/lib'
make[1]: *** [all] Error 2
make[1]: Leaving directory `/uClinux-dist/lib'
make: *** [subdirs] Error 1
[EMAIL PROTECTED] uClinux-dist]#
(Don't forget, please, I'm newbie: correct me if I'm wrong!)
This happens because of mixing shared and static libraries. Automake
script (configure) searchs for shared capabilities and if they are
found it will set those as default. So uClibc libraries was compiled
as static and netfilter as shared, of course libnfnetfilter cannot
find __uClibc_start_main !
To enable shared libraries (that compiles and links ok) in kernel
config under General Setup set:
CONFIG_BINFMT_FLAT
CONFIG_BINFMT_SHARED_FLAT
Also change in uClinux-dist/uClibc/extra/Configs/Config.<yourarchitecture>
(Config.m68k in my case)
# select HAVE_NO_SHARED
select HAVE_SHARED
because if don't, this tells kernel to ignore shared options.
Also run a "make menuconfig" in uClinux-dist/uClibc/ and enable PIC:
[*] Generate Position Independent Code (PIC)
--- Enable support for shared libraries
That automagically enables shared libraries support.
Other solution, using static libraries, is under libnfnetlink and
libnetfilter_conntrack subdirs, in makefile change:
CONFOPTS = --prefix=
to
CONFOPTS = --enable-shared=no --prefix=
and this will compiles/links those directories as static libraries.
Netfilter libraries are compiled/linked because some code needs them,
obviously. In this case, conntrack program, from user options.
conntrack depends from libnetfilter_conntrack, and it depends from
libnfnetlink.
Problem is conntrack programs calls libraries as dynamic objects, and
uClinux, at this moment, doesn't have shared memory support (No
dynamic linker loader -ldso- as uClibc FAQ says: no support for
MMU-less processors). That means program and libraries compiles and
links ok, but cannot be called using standard funtions for shared
libraries. In conclusion any program that uses shared libraries under
uClinux won't link . That includes samba (not sure), conntrack or/and
any program that uses -dynamic -ldl or just -ldl linker flags cannot
be used under uClinux. It's easier to detect that situation if code
uses any dlopen, dlerror or such dl functions or linker flags mention
-ldl.!!
It didn't works for kernel 2.4 neither kernel 2.6
I also compile my own version of tools just to see if that solves the
problem, but it doesn't.
The only problem with tools is when building shell scripts. If there's
a message such:
tail: cannot open «+43» for reading: No such file or directory
is caused by a tail option missing, just add to bottom tail line
tail +${SKIP} ${SCRIPT} ...
by
tail -n +${SKIP} ${SCRIPT}...
I guess all problem is a symbolink link to tell compiler where to
search for uClibc libraries. But problem is where to put symbolic
link?
There's no need to set any links, but to avoid mixing things, in
uClinux-dist/lib/Makefile are symlinks. They could be changed to:
$(ROOTDIR)/lib/libnfnetlink/build/src/.libs/*.* \
$(ROOTDIR)/lib/libnetfilter_conntrack/build/src/.libs/*.* \
$(ROOTDIR)/lib/libnetfilter_log/build/src/.libs/*.* \
and this will avoid problems finding libraries. If static was linked,
".a" will be sym-linked or if shared was linked ".so" will be
sym-linked.
Also a symbolic link for compiler/linker could be set. Linker "knows"
where to search but a search path could be added without harm:
Listing search path for libraries:
m68k-elf-gcc -print-search-dirs
/usr/lib/gcc/m68k-uclinux/4.1.1 directory doesn't exists. It could be
created as symbolic link inside of m68-uclinux (after create it, of
course) to:
/usr/lib/gcc/m68k-uclinux/4.1.1 -> /uClinux-dist/lib
No big deal, but could help to avoid those "couldn't find ..." messages
I also have tried switching from uClibc to uC-lib and kernel and
libraries stages compile fine, but user apps won't compile.
By the way, uC-lib isn't to old now for user apps now?
uClibc compiles and links just fine
Also when I set MTD options using kernel 2.6 there's a compile problem
in jedec probe.
Haven't tested again, but kernel 2.4 just drive well MTD stuff.
Here it's output:
make[1]: Entering directory `/uClinux-dist/linux-2.6.x'
CHK include/linux/version.h
CHK include/linux/utsrelease.h
CHK include/linux/compile.h
GEN usr/initramfs_data.cpio.gz
AS usr/initramfs_data.o
LD usr/built-in.o
CC drivers/mtd/chips/jedec_probe.o
drivers/mtd/chips/jedec_probe.c:395: error: 'MTD_UADDR_0x1554_0x0AAA'
no se declaró aquí (no en una función)
make[4]: *** [drivers/mtd/chips/jedec_probe.o] Error 1
make[3]: *** [drivers/mtd/chips] Error 2
make[2]: *** [drivers/mtd] Error 2
make[1]: *** [drivers] Error 2
make[1]: Leaving directory `/uClinux-dist/linux-2.6.x'
make: *** [linux] Error 1
[EMAIL PROTECTED] uClinux-dist]#
It works for 2.4 version.
I also change user to root, isn't the best practice, but I have to try! ;)
"It will bite you someday" says any documentation in Linux resources...
--
Francisco Perea
Ing. Electricista
Regards
--
Francisco Perea
Ing. Electricista
_______________________________________________
uClinux-dev mailing list
[email protected]
http://mailman.uclinux.org/mailman/listinfo/uclinux-dev
This message was resent by [email protected]
To unsubscribe see:
http://mailman.uclinux.org/mailman/options/uclinux-dev