[Dnsmasq-discuss] On a 64bit system, what switches create a 32bit binary.

Marc Branchaud marcnarc at xiplink.com
Tue Apr 12 21:41:36 BST 2016


On 16-04-12 02:37 PM, Rob Townley wrote:
> Yes, compile on 64bit machine to run on a 32bit machine.  Same OS.  

To do this you need to have a cross-compilation toolchain, which is a build
of gcc, ld and other tools, plus libc and any other libraries dnsmasq needs,
that runs on your host (64bit) system but outputs binaries for your target
(32bit) system.

Setting this up is not necessarily difficult, but it can be long and a bit
tedious.  Most pre-compiled toolchains you'll find online are for building,
say, ARM or PowerPC binaries on an 64bit system.  I don't know of anything
specifically for CentOS.

A pre-compiled toolchain might not be helpful anyway, because you need to
ensure that the toolchain uses the same libraries and kernel (or, more
precisely, their headers) as the 32-bit platform on which you want to run
dnsmasq.  So you might need to build your own cross-compilation toolchain.

Once you have the toolchain, the rest is easy.  All you need to do is make
sure your $PATH contains the toolchain's directories *before* the regular
system directories.  Then you can just run the regular dnsmasq make -- there
are no special switches or settings.  We do exactly this to build a 32bit
dnsmasq on our 64bit FreeBSD boxes (FreeBSD's build system has its own
commands for building a cross-compilation toolchain).


If you can run gcc et al. directly on your 32-bit hardware, you'll probably
find it easier to just build dnsmasq there instead of mucking around with
cross-compilation toolchains.  Even if the platform is underpowered and the
build takes a long time, it's at least time you can spend doing something else.


Good luck!

		M.




More information about the Dnsmasq-discuss mailing list