linux: fix linking errors
Some gcc versions require linker flags to be specified last.  This fixes the build on Linux.