deplinenoise/tundra — Issue #86: gcc toolset incorrectly orders libraries before objects/archives
Author: zao
Created: 2011-10-22 13:03:13+00:00
State: open

The linker command line in the gcc.lua toolset lists the libraries before the object files and archives.
When building a standalone release of tundra on linux-gcc (on xubuntu 11.10) this results in a linker failure due to not satisfying pow from -lm.

Permuting the order of arguments in gcc.lua seems to solve the problem for this particular platform from
```["PROGCOM"] = "$(LD) $(PROGOPTS) $(LIBPATH:p-L) $(LIBS:p-l) -o $(@) $(<)",``` to
```["PROGCOM"] = "$(LD) $(PROGOPTS) $(LIBPATH:p-L) -o $(@) $(<) $(LIBS:p-l)",```.
I've got no idea how this would affect other platforms that use `gcc.lua`.
Error log before patching:

14:36:17 zao@rawr:~/slask/tundra (git:master:141a968)
∫ TUNDRA_HOME=$PWD ../build-tundra/tundra standalone release -v
applying host settings from tundra.host.linux
installed 55 relations from cache (250 files preloaded)
adding platforms: linux
parsing user-defined declaration parsers from tundra.syntax.glob
parsing user-defined declaration parsers from tundra.syntax.embed_lua
configuring for linux-gcc-release-standalone
Program tundra-output/linux-gcc-release-standalone/tundra_luac
gcc -Ltundra-output/linux-gcc-release-standalone -lm -lpthread -o tundra-output/linux-gcc-release-standalone/tundra_luac tundra-output/linux-gcc-release-standalone/__luac/lua/src/luac.o tundra-output/linux-gcc-release-standalone/__luac/lua/src> /print.o tundra-output/linux-gcc-release-standalone/libbase_lua_host.a
tundra-output/linux-gcc-release-standalone/libbase_lua_host.a(lvm.o): In function `luaV_execute':
lua/src/lvm.c:(.text+0x21ae): undefined reference to `pow'
lua/src/lvm.c:(.text+0x2265): undefined reference to `pow'
tundra-output/linux-gcc-release-standalone/libbase_lua_host.a(lcode.o): In function `codearith':
lua/src/lcode.c:(.text+0x1c72): undefined reference to `pow'
collect2: ld returned 1 exit status
*** build failed, 1 jobs run