Need -lgcc for tttt build
DanielO opened this issue · 3 comments
Hi,
I am following http://zipcpu.com/zipcpu/2018/02/12/zbasic-intro.html and I got this trying to build tttt:
[ubuntu 13:45] /media/psf/Home/projects/zbasic/sw/board >make tttt
CROSS=zip- ARCH=zip make --no-print-directory -C tttt/src ARCH=zip CROSS=zip- zip-tttt
Building dependency file
zip-gcc -T../../../zlib/../board/board.ld obj-zip/comborow.o obj-zip/comboset.o obj-zip/gboard.o obj-zip/strategy.o obj-zip/vset.o obj-zip/main.o -L../../../zlib -Wl,--start-group -Wl,--Map=zip-tttt.map -lzbasic -lc -lg -o zip-tttt
/media/psf/Home/projects/zipcpu/sw/install/cross-tools/lib/gcc/zip/6.2.0/../../../../zip/lib/libc.a(lib_a-vfprintf.o): In function `_vfprintf_r':
vfprintf.c:(.text+0x648): undefined reference to `__unorddf2'
vfprintf.c:(.text+0x664): undefined reference to `__ledf2'
vfprintf.c:(.text+0x7f8): undefined reference to `__eqdf2'
vfprintf.c:(.text+0x1470): undefined reference to `__eqdf2'
vfprintf.c:(.text+0x1b1c): undefined reference to `__nedf2'
vfprintf.c:(.text+0x1f28): undefined reference to `__unorddf2'
vfprintf.c:(.text+0x1f48): undefined reference to `__ltdf2'
vfprintf.c:(.text+0x2004): undefined reference to `__nedf2'
/media/psf/Home/projects/zipcpu/sw/install/cross-tools/lib/gcc/zip/6.2.0/../../../../zip/lib/libc.a(lib_a-dtoa.o): In function `_dtoa_r':
dtoa.c:(.text+0x2c4): undefined reference to `__eqdf2'
dtoa.c:(.text+0x3a0): undefined reference to `__floatunsidf'
dtoa.c:(.text+0x3c0): undefined reference to `__subdf3'
dtoa.c:(.text+0x3d8): undefined reference to `__muldf3'
dtoa.c:(.text+0x3f0): undefined reference to `__adddf3'
dtoa.c:(.text+0x400): undefined reference to `__floatsidf'
<snip>
I found it necessary to add -lgcc to the XLIBS line.
Good catch!
I didn't initially use -lgcc, but became needed once I was able to build it because it provided soft-floating point.
I should probably place -lgcc into the default command line for the tools to fix this. For now, I expect to just change the zbasic instructions.
Dan
OK, I wasn't sure where to file it since your blog doesn't have a bug tracker ;)
WRT needing it - I think it does depend on your compiler version but it's mostly black magic to me..
Yeah, "mostly black magic".
I'm still looking for the "right way" to handle this fix. Part of the difficulty is that -lgcc depends upon the C library, but you shouldn't need to specify "-lc -lgcc" on the command line (which I just had to do for a project), so this is definitely an issue and I'm looking into it. At least for now there's a work around, but it's not really the solution I want. I'm going to leave this open until I figure it out.