[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: Cross compiling a program
On 3/8/2012 05:40, Greg Troxel wrote:
Is there a helpful document somewhere that describes the process of
cross compiling a program for use under NetBSD/sparc?
I'm not sure.
I want to compile newer versions of gpsd but the project maintainers
have switched away from configure scripts to python and SCons, neither
of which will compile and install for NetBSD/sparc. I do have,
however, several Debian/x86 systems that have working versions of both
of those programs. I want to be able to compile gpsd on one of those
Debian systems but generate a NetBSD/sparc binary.
You only need scons on the build system.
I am surprised that python will not build on NetBSD/sparc. I am pretty
sure I had a test environment for gpsd (pre-scons, post-python) on an
IPX running NetBSD 4.0_STABLE.
I have a working python 2.4 running on my IPX (using NetBSD 5.1) but the
SCons package wants python 2.6. The python package will not install. I
may have to try from source directly from python and scons and see if it
works but I couldn't use the prebuilt packages using pkgadd.
Most of the documentation discusses cross compiling NetBSD itself
(which I may do later if I can't figure out how to upgrade NetBSD in
place, but that's a totally different effort that I'm having trouble
For upgrading, see pkgsrc/sysutils/etcmanage and read very carefully
BUILD-NetBSD and INSTALL-NetBSD. That encapsulates how I deal with
upgrading. Note also that boot blocks have compatibility issues, so
that if you update a sparc in place from 1.6 to 6.0 then I think boot
blocks that are 2.0 or newer don't boot 4.0 kernels, but I am fuzzy on
the details. I think each single-version jump is ok in that the
up-to-date X boot blocks can boot X+1.
I wouldn't be making a major version change, just 5.1 to 5.1.1.
I don't see anything about individual programs that are
downloaded from source.
To cross-compile from source, do
full build.sh of NetBSD/sparc, matching version what you are going to
run. (I use BUILD-NetBSD, but it just picks defaults that I like,
use the cross-compiler toolchain from above, either writing wrapper
scripts or using the right PATH, or autoconf support. Note that you
almost certainly want to use --sysroot to point to the DESTDIR so you
get the right include files. You may need to make a directory
I containing cpp, cc, and so on that basically does
cc --sysroot=/your/destdir $*
and use that directory as your compiler path.
[those two steps are not all that hard]
Make the program you want to build cross-build safe. Things with gnu
autoconf are generally pretty close, SCons not so much.
Cross-building is one of the things gpsd decided not to care about
when they moved to scons. I think that was a bad technical decision;
everyone rants about how autoconf is complicated, but almost always I
see people propose replacing it with setups that lack out-of-srcdir
builds, cross builds, support for making a distfile and running a
non-srcdir build and make check, etc.
I have never tried to cross-compile python; I am not particularly
I'll check into this process some more but I may just have to try and
build direct if possible. Didn't work last time but maybe this time.
Main Index |
Thread Index |