On Mon, Feb 08, 2010 at 06:41:24PM +0100, Jan Engelhardt wrote:
> Hi,
> 
> 
> 
> I was putting libhugetlbfs through an rpmbuild compilation on a SPARC64 
> system and found that it does not compile.
> 
> The reason is very simple: libhugetlbfs misuses `uname -m` 
> to decide whether to build 32- or 64-bit. This is a bad heuristic,
> as the userspace that is run and compiled can be different from the 
> kernel in use, meaning I have to add ugly hacks to the .spec file, as 
> in
> 
> make
> %ifarch sparc sparcv9 # that's targetarch
>       CC32="gcc" CC64="" NATIVEONLY=1
> %endif
> 
> I currently do not see any reasonable way to fix this other than 
> restructuring the Makefile such that it won't make a distinction between 
> 32 and 64 and just builds whatever gcc produces. That would be how a 
> large part of software packages are built today.

But there's a good reason we don't just take whatever gcc produces for
libhugetlbfs.  For platforms with 32-bit and 64-bit variants
(i386/x86_64, powerpc/powerpc64) we want to build both 32-bit and
64-bit versions of the libraries - so they can be used with both
32-bit and 64-bit apps.

I'd have expected you also want builds for both sparc and sparc64,
likewise.  If you're building for a different setup than the one
you're compiling on, it's essentially a trivial case of
cross-compiling, and as usual for a cross-compile, you need to specify
the right compiler.  Or in the case of libhugetlbfs the right two
compilers, one for the 32-bit target arch and one for the 64-bit
target arch.  In this case the "cross compiler" will just be the
normal gcc with the right options to select a 32-bit or 64-bit build,
but the principle is the same.

I realise that having to override the compiler for your rpm build is
inconvenient, but removing the logic to do both 32-bit and 64-bit
builds will greatly inconvenience everyone else who needs to do that.

> I would have a partial 
> patch to transform it to automake, but would need review whether I've 
> matched everything.

Please no.  automake is a hideous tangled mess we can really do
without.

-- 
David Gibson                    | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au  | minimalist, thank you.  NOT _the_ _other_
                                | _way_ _around_!
http://www.ozlabs.org/~dgibson

------------------------------------------------------------------------------
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
_______________________________________________
Libhugetlbfs-devel mailing list
Libhugetlbfs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libhugetlbfs-devel

Reply via email to