moved LDFLAGS to end of gcc invocation to fix build