[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Cross Package Building and IMPORTANT symlinks in /gnu/lib.



IMPORTANT for CROSS COMPILERS: Please make sure your /gnu/lib directory has
clean symlinks, see below point (4).

Hello,

slowly, I think other Debian developers have installed GNU/Hurd and prepare
for package building. Although native building is prefered, sometimes cross
compilation comes handy. Here is a first small attempt to document necessary
steps and cave eats.

(1) Install dpkg-cross, my dpkg-architecture stuff (patches are in the BTS)
    and i386-gnu-gcc (and i386-gnu-mig).
(2) Edit /etc/dpkg/cross-compile and /etc/dpkg/cross-config.gnu

cross-compile:
=============================================  E X A M P L E  ==========
crossbase = /usr/local
crossroot-hurd-i386 = /gnu
maintainer = Marcus Brinkmann <brinkmd@debian.org>

amd:
        SYSCC = $(ARCH)-linux-gcc

joe:
        BUILD_CC = gcc
        includeprefix = \"/usr/i386-gnu\"

fortune-mod:
        STRFILE=/usr/sbin/strfile

apache:
        BUILD_CC = gcc
========================================================================

cross-config.gnu:
==============================================  E X A M P L E  =========
#
# i386 specific configure variables
#
ac_cv_c_bigendian=no
ac_cv_c_char_unsigned=no
# short is used in e2fsprogs
ac_cv_sizeof_short=2
ac_cv_sizeof_long=4
ac_cv_sizeof_int=4
# For tar, or tar will try to use superdigits and fail.
ac_cv_sizeof_long_long=8
# For dpkg.
ac_cv_sizeof_unsigned_long=4
ac_cv_sizeof_unsigned_int=4
========================================================================


(3) Mount your gnu filesystem at /gnu (or crossroot-hurd-i386)
(4) fix your library path's. Some library packages contain links absolute
    paths (EVIL! for cross comp.) or relative paths - but from /usr/lib
    (EVIL! for symlink /usr -> ./). This means, the libraries are taken from
    linux or can't be found at all. Solution, run the fixlinks script:
    (needs to be run each time after you installed a bunch of libraries)

===========================================================================
#!/usr/bin/perl
#
# fixlinks, fix shared library links on a Debian GNU/Hurd system
#
# Copyright 1999 Marcus Brinkmann <brinkmd@debian.org>
#
# GPL

$libdir = '/gnu/lib';

opendir LIBDIR, $libdir;

while ($file = readdir LIBDIR)
{
	if (-l $libdir.'/'.$file) {
		$goal =  readlink $libdir.'/'.$file;
		$base = `basename $goal`;
		chomp $base;
		if ($goal eq '/lib/'.$base || $goal eq '../../lib/'.$base || $goal eq './'.$base) {
			$list{$libdir.'/'.$file} = $base;
		}
	}
}

foreach $file (keys %list) {
	unlink $file;
	symlink $list{$file}, $file;
}
=============================================================================

(5) Check if all links from the /usr/i386-gnu three are correct, and also
    have a look in /gnu/lib.

(6) Try to compile a simple package with

  dpkg-buildpackage -ahurd-i386 -rfakeroot -B


This may be incomplete, please let me know.

Thank you,
Marcus

-- 
`Rhubarb is no Egyptian god.' Debian http://www.debian.org   finger brinkmd@ 
Marcus Brinkmann              GNU    http://www.gnu.org     master.debian.org
Marcus.Brinkmann@ruhr-uni-bochum.de                        for public  PGP Key
http://homepage.ruhr-uni-bochum.de/Marcus.Brinkmann/       PGP Key ID 36E7CD09


Reply to: