I have tried adding "dflags": ["-m64"] to package.json
but the linker can't find most of the libraries.

I guess you could try to setup a chroot environment and install all missing things there... or
copy the missing libs over from the Amazon box. But since that could get a little hairy, I would
rather install a 64-bit OS somewhere.