Subject: hp700 native build problem with tools/file
To: None <tech-toolchain@netbsd.org>
From: Chuck Silvers <chuq@chuq.com>
List: tech-toolchain
Date: 05/07/2005 10:05:53
hi folks,

now that I've fixed a number of kernel bugs, the native build process on
hp700 gets a lot further than it ever did before and I've run into
a problem with the host-tool build of "file".  here's the relevant part
of the log:

--- file.o ---
source='/build/src/tools/file/../../dist/file/src/file.c' object='file.o' libtool=no  depfile='.deps/file.Po' tmpdepfile='.deps/file.TPo'  depmode=gcc3 /bin/sh /build/src/tools/file/../../dist/file/depcomp  cc -DHAVE_CONFIG_H -I. -I/build/src/tools/file/../../dist/file/src -I..  -DMAGIC='"/build/tooldir/share/file/magic"'    -O -c `test -f '/build/src/tools/file/../../dist/file/src/file.c' || echo '/build/src/tools/file/../../dist/file/src/'`/build/src/tools/file/../../dist/file/src/file.c
--- libmagic.la ---
/bin/sh ../libtool --mode=link cc  -O    -o libmagic.la -rpath /build/tooldir/lib -version-info 1:0:0 magic.lo apprentice.lo softmagic.lo ascmagic.lo  compress.lo is_tar.lo readelf.lo print.lo fsmagic.lo funcs.lo  apptype.lo  -lz
rm -fr .libs/libmagic.la .libs/libmagic.* .libs/libmagic.*
cc -shared -nodefaultlibs  magic.lo apprentice.lo softmagic.lo ascmagic.lo compress.lo is_tar.lo readelf.lo print.lo fsmagic.lo funcs.lo apptype.lo  -lz  -Wl,-soname -Wl,libmagic.so.1 -o .libs/libmagic.so.1.0
softmagic.lo(.text+0x894): In function `mconvert':
: warning: undefined reference to `$$divU'
softmagic.lo(.text+0x8a8): In function `mconvert':
: warning: undefined reference to `$$remU'
softmagic.lo(.text+0xbb8): In function `mconvert':
: warning: undefined reference to `$$divU'
softmagic.lo(.text+0xbcc): In function `mconvert':
: warning: undefined reference to `$$remU'
softmagic.lo(.text+0xccc): In function `mconvert':
: warning: undefined reference to `$$divU'
softmagic.lo(.text+0xce0): In function `mconvert':
: warning: undefined reference to `$$remU'
softmagic.lo(.text+0x1798): In function `mget':
: warning: undefined reference to `$$divU'
softmagic.lo(.text+0x17d4): In function `mget':
: warning: undefined reference to `$$remU'
softmagic.lo(.text+0x18d4): In function `mget':
: warning: undefined reference to `$$divU'
softmagic.lo(.text+0x18e8): In function `mget':
: warning: undefined reference to `$$remU'
readelf.lo(.text+0x508): In function `donote':
: warning: undefined reference to `$$divU'
readelf.lo(.text+0x550): In function `donote':
: warning: undefined reference to `$$divU'
(cd .libs && rm -f libmagic.so.1 && ln -s libmagic.so.1.0 libmagic.so.1)
(cd .libs && rm -f libmagic.so && ln -s libmagic.so.1.0 libmagic.so)
(cd .libs && rm -f libmagic.so && ln -s libmagic.so.1.0 libmagic.so)
ar cru .libs/libmagic.a  magic.o apprentice.o softmagic.o ascmagic.o compress.o is_tar.o readelf.o print.o fsmagic.o funcs.o apptype.o 
ranlib .libs/libmagic.a
creating libmagic.la
(cd .libs && rm -f libmagic.la && ln -s ../libmagic.la libmagic.la)
--- file ---
/bin/sh ../libtool --mode=link cc  -O    -o file  file.o libmagic.la -lz
cc -O -o .libs/file file.o  ./.libs/libmagic.so -lz -Wl,--rpath -Wl,/build/tooldir/lib
ld: .libs/file: hidden symbol `__canonicalize_funcptr_for_compare' in /usr/lib/libgcc.a(fptr.o) is referenced by DSO
*** [file] Error code 1
1 error




removing the "-nodefaultlibs" option allows this to complete.
what's the right way fix this so that it works on all platforms?

-Chuck