Blame README.MULTILIB

Packit 9fb438
Multilib allows you to have both 32-bit and 64-bit versions of libmunge
Packit 9fb438
installed at the same time, capable of communicating with either a 32-bit
Packit 9fb438
or 64-bit version of munged.
Packit 9fb438
Packit 9fb438
On Linux, at least, 32-bit libraries usually reside in /usr/lib, and
Packit 9fb438
64-bit libraries usually reside in /usr/lib64.  But on ia64, for example,
Packit 9fb438
64-bit libraries reside in /usr/lib since everything is 64-bit there.
Packit 9fb438
Packit 9fb438
If you are building from source, you can pass a command-line option to
Packit 9fb438
the configure script:
Packit 9fb438
Packit 9fb438
  $ ./configure --enable-arch=32
Packit 9fb438
Packit 9fb438
  $ ./configure --enable-arch=64
Packit 9fb438
Packit 9fb438
If you are building RPMs, you can pass a command-line option to rpmbuild:
Packit 9fb438
Packit 9fb438
  $ rpmbuild -ta --clean --with arch32 munge-x.y.z.tar.bz2
Packit 9fb438
Packit 9fb438
  $ rpmbuild -ta --clean --with arch64 munge-x.y.z.tar.bz2
Packit 9fb438
Packit 9fb438
You might also have to specify the --target command-line option:
Packit 9fb438
Packit 9fb438
  $ rpmbuild -ta --clean --with arch32 --target i386 munge-x.y.z.tar.bz2
Packit 9fb438
Packit 9fb438
  $ rpmbuild -ta --clean --with arch64 --target x86_64 munge-x.y.z.tar.bz2
Packit 9fb438
Packit 9fb438
For each platform, you will have one source RPM and three binary RPMs
Packit 9fb438
(munge, munge-devel, and munge-libs).
Packit 9fb438
Packit 9fb438
If you wanted to install both 32-bit and 64-bit MUNGE libraries on an
Packit 9fb438
RPM-based x86_64 system, for example, you would need to install either
Packit 9fb438
the 32-bit or 64-bit version of the main munge RPM (containing munged),
Packit 9fb438
and both 32-bit and 64-bit versions of the munge-devel and munge-libs RPMs:
Packit 9fb438
Packit 9fb438
  $ rpm -ivh RPMS/x86_64/munge-0.5-1.x86_64.rpm \
Packit 9fb438
             RPMS/x86_64/munge-devel-0.5-1.x86_64.rpm \
Packit 9fb438
             RPMS/x86_64/munge-libs-0.5-1.x86_64.rpm \
Packit 9fb438
             RPMS/i386/munge-devel-0.5-1.i386.rpm \
Packit 9fb438
             RPMS/i386/munge-libs-0.5-1.i386.rpm
Packit 9fb438
Packit 9fb438
You can then link your application against either the 32-bit or 64-bit library:
Packit 9fb438
Packit 9fb438
  $ gcc -o foo foo.c -m32 -lmunge
Packit 9fb438
Packit 9fb438
  $ gcc -o foo foo.c -m64 -lmunge
Packit 9fb438
Packit 9fb438
Packit 9fb438
AIX uses RPM 3.x which does not recognize the "--with" command-line option.
Packit 9fb438
The 'arch 32_64' define builds a single multiarch library where both 32-bit
Packit 9fb438
and 64-bit objects reside in libmunge.a.  Note that the 'arch 32_64' string
Packit 9fb438
must be quoted to appear as a single command-line argument.  Export the
Packit 9fb438
OBJECT_MODE variable to the environment.
Packit 9fb438
Packit 9fb438
The OS detection in RPM 3.x appends the OS version and release to the name
Packit 9fb438
(eg, "aix5.3").  Since I didn't want to pin the spec file to a particular
Packit 9fb438
set of AIX versions, I used the generic OS string "aix".  Consequently,
Packit 9fb438
you must specify "--target ppc-aix" when building the RPM, and "--ignoreos"
Packit 9fb438
when installing the RPM.
Packit 9fb438
Packit 9fb438
  $ export OBJECT_MODE=32
Packit 9fb438
  $ rpm -ta --clean --define 'arch 32' --target ppc-aix munge-x.y.z.tar.bz2
Packit 9fb438
Packit 9fb438
  $ export OBJECT_MODE=64
Packit 9fb438
  $ rpm -ta --clean --define 'arch 64' --target ppc-aix munge-x.y.z.tar.bz2
Packit 9fb438
Packit 9fb438
  $ export OBJECT_MODE=32
Packit 9fb438
  $ rpm -ta --clean --define 'arch 32_64' --target ppc-aix munge-x.y.z.tar.bz2
Packit 9fb438
Packit 9fb438
You can then link your application against either the 32-bit or 64-bit library:
Packit 9fb438
Packit 9fb438
  $ export OBJECT_MODE=32
Packit 9fb438
  $ gcc -o foo foo.c -lmunge
Packit 9fb438
Packit 9fb438
  $ export OBJECT_MODE=64
Packit 9fb438
  $ gcc -o foo foo.c -lmunge