I'm building a re-branded Firefox from the source for version 51 stable. I would like to be able to package the compiled binary as a .deb and have it work on several different Linux distributions including Ubuntu 14+ and Mint/Mate 16-18.
I compiled it on a Mint 18 machine and it runs fine there, but trying to run it on a Ubuntu 16.04 or Mate 17 machine produces:
XPCOMGlueLoad error for file /opt/myapp/lib/myapp-51.0.2/libxul.so:
/opt/myapp/lib/myapp-51.0.2/libxul.so: symbol _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED1Ev, version GLIBCXX_3.4.21 not defined in file libstdc++.so.6 with link time reference
Couldn't load XPCOM.
All the machines are 64 bit architecture, so I'm assuming this is an issue with library versions? I'm pretty sure there's an option that just bakes in dependencies rather than linking to the system version, but it's really hard to find any information on building Firefox beyond the most basic process.
How can I build a Firefox binary that runs on all modern Ubuntu-based 64bit Linux systems?