[Rivet] rivet requires the 'rivet' Python module

Hendrik Hoeth hendrik.hoeth at cern.ch
Tue Oct 19 14:26:30 BST 2010


Hi Andy,

it's a bit off-topic, but ...

Thus spake Andy Buckley (andy.buckley at ed.ac.uk):

> > To learn more about multilib environments,
> > http://cross-lfs.org/view/svn/x86_64/ is a good reader.
> 
> Any bits in particular, Hendrik? This looks interesting, but as I don't
> intend to build LFS (cross-compiled or otherwise) in the near future, a
> pointer at any particularly enlightening bits about cross-compilation of
> 32/64 bit would be nice. (And might make my life easier re. 32 bit Rivet
> builds for Genser!)

Chapter 5 deals with constructing a cross-compile toolchain (if your
current toolchain doesn't support it), but if you have the 32-bit libc
installed on a typical 64-bit distribution, you should be fine, as the
compilers that come with those distributions usually already support
multilib.

Chapter 6 builds a chroot environment that has everything you need to
build a whole system, and it uses the cross-compile toolchain of chapter
5. So the section 6.2 (Build Variables) in combination of the commands
used to compile binutils and gcc in chapter 5 might be of interest. But
again, most typical distributions will help you here (at least as long
as you don't want to compile for a completely different architecture).

Then in chapters 8 and 10 it gets interesting again. The BUILD32 and
BUILD64 flags in chapter 8.8 (Build Flags) tell the compiler whether you
require a 32 or 64 bit output, and it is a good idea to set CC and CXX
to "gcc/g++ $BUILD32" or "gcc/g++ $BUILD64" if you are aiming at a
specific target. Using --libdir=$PREFIX/lib or --libdir=$PREFIX/lib64
for configuring takes care of putting the libraries in the correct
place for most software packages. Sometimes you need to set LIBDIR=...
while running make and/or make install. Sometimes you need to patch
their makefiles. Just browse through some of the examples in chapter 10.

Something else you should be aware of is that optimisation flags for
certain compiler/CPU combinations differ between 32 and 64 bit. A great
source of information is the Gentoo wiki:
http://en.gentoo-wiki.com/wiki/Safe_Cflags
(check the links at the bottom of the page for specific CPUs).
With a recent gcc "-march=native" works fine, but again be careful out
there -- up to very recently e.g. an Intel i5 was recognised as some
other old CPU. The way to check what you compiler actually does is to
run "gcc -Q --help=target $CFLAGS" which should give you a long list of
all the options that are enabled or disabled, as well as your compiler's
opinion on what CPU you want to optimise for.

When looking for external libraries that come with a *-config script
(fastjet comes to my mind), you want to use the correct script to get
your compile flags. Since that script is typically installed in
$PREFIX/bin you only get one version even if you install 32 and 64 bit
libs, so when you install a package like fastjet, a nice way of dealing
with this is to rename the 32-bit version to fastjet-config-32, the
64-bit version to fastjet-config-64 and then use the proper one -- read
chapter 10.24 (Creating a Multiarch Wrapper) on how to automate this
choice by using an environment variable ("USE_ARCH"). Check e.g. the
libtool chapters (10.39 and 10.40) for an example how to use the
multiarch_wrapper (which is a pretty convenient tool also for other
purposes!).

And last not least, you might want to set PKG_CONFIG_PATH to something
that corresponds to your target. On my laptop for example I set it to
/usr/lib64/pkgconfig for 64-bit and to /usr/lib/pkgconfig for 32-bit
installations.

Cheers,

   Hendrik

-- 
One doesn't discover new lands without consenting to lose
sight of the shore for a very long time.    -- André Gide


More information about the Rivet mailing list