Update build.xml to support ld --as-needed

Ubuntu uses the linker option "--as-needed" by default. This requires that libraries are added in the correct order to the linker command line (i.e. after the objects requesting external symbols). This change fixes the build on Ubuntu.