This is to make cross-compiling for i386 on amd64 easier, by adding
-m32/64 or -arch flags where appropriate.
This commit also adds a gcc linker on Linux and macOS, replacing the
default g++ linker. It's roughly equivalent, but means the shared
library has fewer dependencies (e.g. it doesn't link against libstdc++).