Discussion:
[Dnsmasq-discuss] On a 64bit system, what switches create a 32bit binary.
Rob Townley
2016-04-12 03:42:49 UTC
Permalink
My name server runs on 32bit hardware, but all other machines are 64bit OS
on 64bit hardware.

egrep -R -i '386|x86|32bit' did not come back with much relevant info.

dnsmasq runs on all kinds of disparate hardware, so i know it is done
everyday.

(CentOS6 systems.)
w***@gmail.com
2016-04-12 15:14:36 UTC
Permalink
My name server runs on 32bit hardware, but all other machines are 64bit OS on
64bit hardware.
egrep -R -i '386|x86|32bit' did not come back with much relevant info.
dnsmasq runs on all kinds of disparate hardware, so i know it is done everyday.
(CentOS6 systems.)
what are you asking? how to cross-compile on one of your 64bit machines to 32bit
so you can run your self-built dnsmasq over there??
--
NOTE: No off-list assistance is given without prior approval.
*Please keep mailing list traffic on the list* unless
private contact is specifically requested and granted.
Rob Townley
2016-04-12 18:37:04 UTC
Permalink
Yes, compile on 64bit machine to run on a 32bit machine. Same OS.
Post by w***@gmail.com
My name server runs on 32bit hardware, but all other machines are 64bit OS on
64bit hardware.
egrep -R -i '386|x86|32bit' did not come back with much relevant info.
dnsmasq runs on all kinds of disparate hardware, so i know it is done everyday.
(CentOS6 systems.)
what are you asking? how to cross-compile on one of your 64bit machines to
32bit so you can run your self-built dnsmasq over there??
--
NOTE: No off-list assistance is given without prior approval.
*Please keep mailing list traffic on the list* unless
private contact is specifically requested and granted.
_______________________________________________
Dnsmasq-discuss mailing list
http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss
Marc Branchaud
2016-04-12 20:41:36 UTC
Permalink
Post by Rob Townley
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.
Ryan Zev Solomon
2016-04-12 20:59:08 UTC
Permalink
Post by Marc Branchaud
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.
Another option which I generally find to be easier to manage is to build
in a virtual machine instead of getting a cross compilation toolchain
working. So, if you need to build for x86, with CentOS 6, then set up an
x86 VM running CentOS 6.
Kurt H Maier
2016-04-12 23:24:42 UTC
Permalink
Post by Rob Townley
My name server runs on 32bit hardware, but all other machines are 64bit OS
on 64bit hardware.
egrep -R -i '386|x86|32bit' did not come back with much relevant info.
dnsmasq runs on all kinds of disparate hardware, so i know it is done
everyday.
(CentOS6 systems.)
You need to

yum install libc-devel.i686 libgcc.i686 compat-glibc compat-glibc-headers

then you need to edit the Makefile

CFLAGS = -m32 -Wall -W -O2
LDFLAGS = -m32

Then you should be able to run 'make' and get a usable build.

To do it properly, you should install the rpm build tools, install the
source rpm for dnsmasq, modify the .spec file to include the above flags
and build-time dependencies, and use rpmbuild to produce the package.

khm

Loading...