Use LDLIBS not LDFLAGS

LDLIBS comes after the built object.  Using
LDFLAGS does not and so missing symbols result.