[En-Nut-Discussion] multiple definitions solved (was: TCP uses to much memory with zero window?)

Bernd Walter enut at cicely.de
Tue Jun 9 20:53:21 CEST 2009


On Tue, Jun 09, 2009 at 04:35:02PM +0200, Bernd Walter wrote:
> On Tue, Jun 09, 2009 at 01:03:15PM +0200, Harald Kipp wrote:
> > Bernd Walter wrote:
> Updating Ethernut code is always very difficult for me.
> I tried updating to 4.8.2, but got many new problems.
> Missing C-files in the Makefiles and such.
> I also had problems with clock settings.
> This is likely because I use a different build environment than most.
> I build Ethernut with my code, so I can switch parameters, such as
> CPU clock and CPU type easily.
> I run FreeBSD as build OS.
> And I have several local modifications.
> Currently I'm almost done, and just left with multiple definitions
> of _write, _close, etc with newlib and ethernut:
> /usr/local/arm-elf/lib/gcc/arm-elf/4.1.0/../../../../arm-elf/lib/thumb/interwork/libg.a(syscalls.o): In function `_write':
> ../../../../../../.././newlib/libc/sys/arm/syscalls.c:333: multiple definition of `_write'
> contrib/ethernut-4.8.2/lib/libnutcrt.a(write.o):write.c:(.text+0x0): first defined here

I've finally managed to get it to compile again.
Ethernut was missing calloc and strdup:
[916]devel> svn diff
Index: contrib/ethernut-4.8.2/crt/Makefile
===================================================================
--- contrib/ethernut-4.8.2/crt/Makefile (revision 4180)
+++ contrib/ethernut-4.8.2/crt/Makefile (working copy)
@@ -92,7 +92,7 @@
         fread.c fscanf.c getc.c getchar.c gets.c kbhit.c scanf.c ungetc.c vfscanf.c \
         fprintf.c fputc.c fputs.c fwrite.c printf.c putc.c putchar.c puts.c vfprintf.c \
         sprintf.c sscanf.c vsprintf.c vsscanf.c gmtime.c localtim.c mktime.c time.c \
-        tzset.c errno.c malloc.c environ.c getenv.c putenv.c setenv.c
+        tzset.c errno.c malloc.c environ.c getenv.c putenv.c setenv.c calloc.c strdup.c
 
 SRCCP = fprintf_p.c fputs_p.c fscanf_p.c fwrite_p.c printf_p.c puts_p.c \
        scanf_p.c sprintf_p.c sscanf_p.c vfprintf_p.c vfscanf_p.c \

Not sure if it was missing in the original Ethernut code, or happened
when merging my own changes in.

Since I saw similar problems on the list without real answers:
For the people seeing similar problems with multiple definitions.
It took the implementations fom newlib, which the sucked in invalid
and colliding syscall based implementations.
I removed the unuseable objectfiles from the lib:
arm-elf-ar d libg.a syscalls.o
A few more deletes up to deleting the wrong calloc and strdup I've
found out the missing Ethernut source files.
The same symptoms can be produced by other missing files as well.

Runtime test not done yet.

-- 
B.Walter <bernd at bwct.de> http://www.bwct.de
Modbus/TCP Ethernet I/O Baugruppen, ARM basierte FreeBSD Rechner uvm.



More information about the En-Nut-Discussion mailing list