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

Bug#274367: glibc: [amd64] New GLIBC pass to create 32bit libc6-i386 and libc6-dev-i386 packages



On Sat, Feb 11, 2006 at 10:15:32AM +0100, Andreas Jochens wrote:
> Hello,
Hi !

> On 06-Feb-10 12:58, Aurelien Jarno wrote:
> > Please find attached a new patch, that uses /lib32 and /usr/lib32. There
> > is a lot of difference from the previous patch, so don't hesitate to
> > comment it. I know there is a missing conflicts with the current version
> > of ia32-libs, I am currently looking for a way to do it cleanly.
> 
> Thanks for the new patch! I tried to compile glibc with this patch
> and the compilation was basically successful. I had to add the missing 
> debian/control.in/i386 file with the control information for the
> libc6-(-dev)-i386 packages.
Oops sorry, this file is in my local copy, but I stripped out in the
patch, while stripping parts that belong to other patches.

> The resulting libc6-dev-i386 package still has two small problems. 
> The symlinks in libc6-dev-i386 need to be changed from e.g.
> 
> lrwxrwxrwx root/root 0 2006-02-11 08:02:36 /usr/lib32/librt.so -> /lib/librt.so.1
> 
> to
> 
> lrwxrwxrwx root/root 0 2006-02-11 08:02:36 /usr/lib32/librt.so -> /lib32/librt.so.1
> 
> 
> Also, in /usr/lib32/libc.so the line
> 
> GROUP ( /lib/libc.so.6 /usr/lib/libc_nonshared.a )
> 
> has to be changed to
> 
> GROUP ( /lib32/libc.so.6 /usr/lib32/libc_nonshared.a )
> 
> and  in /usr/lib32/libpthread.so the line
> 
> GROUP ( /lib/libpthread.so.0 /usr/lib/libpthread_nonshared.a )
> 
> has to be changed to
> 
> GROUP ( /lib32/libpthread.so.0 /usr/lib32/libpthread_nonshared.a )
> 
> 
> Alternatively, something like '--libdir=/usr/lib32' could be added
> to the configure options and everything could be installed in
> /usr/lib32, i.e. the top-level /lib32 directory could be dropped 
> entirely. 

I have tried this solution, but it still put files into /lib. This part
is controlled via slibdir, not libdir.

That's why my latest patch, fixes the .so files and the link in the same
way as for the amd64 linker patch, ie by fixing them individually.

> To have an extra top-level directory /lib32 with 32-bit libraries 
> does not make much sense anyway. During the boot process
> the top-level /lib directory with the native 64-bit libraries
> should be sufficient.
> 
> However, the packaging process for the libc6-(dev)-i386 packages would 
> have to be changed a little to take this change into account.

I agree that it will be better. However I also think the location of
those files should be coherent accross all bi-arch packages. Also note
that the changes to the .install files is not so trivial, because some
files that should be placed into libc6-i386 are ending in .so, but it
should be possible to find a solution. And that also means that the
links have to be changed for all bi-arch packages.

I may latter send a patch about that.

Meanwhile, please find attached my latest version of the patch. I have
tested the resulting libc, and I was able to compile a simple hello.c, 
and to run it without problem.

Bye
Aurelien

-- 
  .''`.  Aurelien Jarno	            | GPG: 1024D/F1BCDB73
 : :' :  Debian developer           | Electrical Engineer
 `. `'   aurel32@debian.org         | aurelien@aurel32.net
   `-    people.debian.org/~aurel32 | www.aurel32.net
diff -u glibc-2.3.6/debian/rules.d/control.mk glibc-2.3.6/debian/rules.d/control.mk
--- glibc-2.3.6/debian/rules.d/control.mk
+++ glibc-2.3.6/debian/rules.d/control.mk
@@ -23,6 +23,7 @@
 	cat debian/control.in/libc6.1		>> $@T
 	cat debian/control.in/libc0.3		>> $@T
 	cat debian/control.in/libc1		>> $@T
+	cat debian/control.in/i386		>> $@T
 	cat debian/control.in/sparc64		>> $@T
 	cat debian/control.in/s390x		>> $@T
 	cat debian/control.in/amd64		>> $@T
diff -u glibc-2.3.6/debian/rules.d/debhelper.mk glibc-2.3.6/debian/rules.d/debhelper.mk
--- glibc-2.3.6/debian/rules.d/debhelper.mk
+++ glibc-2.3.6/debian/rules.d/debhelper.mk
@@ -193,7 +193,7 @@
 	  destdir=$$1; \
 	  shift; \
 	  z=debian/$(libc)-$$x.install; \
-	  if test $$destdir = 64; then \
+	  if test $$destdir = 32 -o $$destdir = 64; then \
 	    cp debian/debhelper.in/libc-alt.install $$z; \
 	    zd=debian/$(libc)-dev-$$x.install; \
 	    cp debian/debhelper.in/libc-alt-dev.install $$zd; \
diff -u glibc-2.3.6/debian/sysdeps/amd64.mk glibc-2.3.6/debian/sysdeps/amd64.mk
--- glibc-2.3.6/debian/sysdeps/amd64.mk
+++ glibc-2.3.6/debian/sysdeps/amd64.mk
@@ -20,0 +21,31 @@
+
+# build 32-bit (i386) alternative library
+GLIBC_PASSES += i386
+DEB_ARCH_REGULAR_PACKAGES += libc6-i386 libc6-dev-i386
+libc6-i386_shlib_dep = libc6-i386 (>= $(shlib_dep_ver))
+
+i386_configure_target = i486-linux
+i386_CC = $(CC) -m32
+i386_add-ons = nptl $(add-ons)
+i386_extra_cflags = -march=pentium4 -g1 -O3
+i386_extra_config_options = $(extra_config_options) --includedir=/usr/include/i386-linux-gnu --libdir=/usr/lib32
+i386_LIBDIR = 32
+i386_MIN_KERNEL_SUPPORTED = 2.6.0
+
+define i386_extra_install
+mv debian/tmp-i386/lib32 debian/tmp-i386/lib32
+mv debian/tmp-i386/usr/lib32/* debian/tmp-i386/usr/lib32
+for link in $$(find debian/tmp-i386/usr/lib32 -type l) ; do ln -sf $$(readlink $$link | sed -e "s#/lib/#/lib32/#g") $$link ; done
+for so in $$(find debian/tmp-i386/usr/lib32 -maxdepth 1 -type f -name *.so) ; do perl -pi -e "s#/lib/#/lib32/#g" $$so ; done
+endef
+
+define libc6-dev-i386_extra_pkg_install
+dh_install -plibc6-dev-i386 debian/tmp-i386/usr/include/i386-linux-gnu \
+        usr/include
+endef
+
+define libc6-i386_extra_pkg_install
+mkdir -p debian/libc6-i386/lib
+ln -s /lib32/ld-linux.so.2 debian/libc6-i386/lib
+endef
+
diff -u glibc-2.3.6/debian/patches/series glibc-2.3.6/debian/patches/series
--- glibc-2.3.6/debian/patches/series
+++ glibc-2.3.6/debian/patches/series
@@ -120,0 +121 @@
+amd64-i386-biarch.diff -p1
diff -u glibc-2.3.6/debian/control.in/main glibc-2.3.6/debian/control.in/main
--- glibc-2.3.6/debian/control.in/main
+++ glibc-2.3.6/debian/control.in/main
@@ -1,7 +1,7 @@
 Source: @glibc@
 Section: libs
 Priority: required
-Build-Depends: gettext (>= 0.10.37-1), make (>= 3.80-1), dpkg-dev (>= 1.13.5), debianutils (>= 1.13.1), tar (>= 1.13.11), bzip2, texinfo (>= 4.0), linux-kernel-headers (>= 2.6.13+0rc3-2) [!hurd-i386], mig (>= 1.3-2) [hurd-i386], hurd-dev (>= 20020608-1) [hurd-i386], gnumach-dev [hurd-i386], texi2html, file, gcc-4.0 [!powerpc !m68k !hppa !hurd-i386], gcc-3.4 (>= 3.4.4-6) [powerpc], gcc-3.4 [m68k hppa], gcc-3.3 [hurd-i386], autoconf, binutils (>= 2.16.1cvs20051109-1), sed (>= 4.0.5-4), gawk, debhelper (>= 4.1.76), libc6-dev-amd64 [i386], libc6-dev-ppc64 [powerpc], quilt
+Build-Depends: gettext (>= 0.10.37-1), make (>= 3.80-1), dpkg-dev (>= 1.13.5), debianutils (>= 1.13.1), tar (>= 1.13.11), bzip2, texinfo (>= 4.0), linux-kernel-headers (>= 2.6.13+0rc3-2) [!hurd-i386], mig (>= 1.3-2) [hurd-i386], hurd-dev (>= 20020608-1) [hurd-i386], gnumach-dev [hurd-i386], texi2html, file, gcc-4.0 [!powerpc !m68k !hppa !hurd-i386], gcc-3.4 (>= 3.4.4-6) [powerpc], gcc-3.4 [m68k hppa], gcc-3.3 [hurd-i386], autoconf, binutils (>= 2.16.1cvs20051109-1), sed (>= 4.0.5-4), gawk, debhelper (>= 4.1.76), libc6-dev-amd64 [i386], libc6-dev-ppc64 [powerpc], libc6-dev-i386 [amd64] | ia32-libs-dev [amd64], quilt
 Build-Depends-Indep: perl, po-debconf
 Maintainer: GNU Libc Maintainers <debian-glibc@lists.debian.org>
 Uploaders: Ben Collins <bcollins@debian.org>, GOTO Masanori <gotom@debian.org>, Philip Blundell <pb@nexus.co.uk>, Jeff Bailey <jbailey@raspberryginger.com>, Daniel Jacobowitz <dan@debian.org>, Clint Adams <schizo@debian.org>, Denis Barbier <barbier@debian.org>
only in patch2:
unchanged:
--- glibc-2.3.6.orig/debian/control.in/i386
+++ glibc-2.3.6/debian/control.in/i386
@@ -0,0 +1,22 @@
+Package: libc6-i386
+Architecture: amd64
+Section: libs
+Priority: extra
+Depends: libc6 (= ${Source-Version})
+Conflicts: ia32-libs (<= 1.5)
+Description: GNU C Library: 32bit shared libraries for AMD64
+ This package includes shared versions of the standard C
+ library and the standard math library, as well as many others.
+ This is the 32bit version of the library, meant for AMD64 systems.
+
+Package: libc6-dev-i386
+Architecture: amd64
+Section: libdevel
+Priority: standard
+Depends: libc6-i386 (= ${Source-Version}), libc6-dev (= ${Source-Version}), lib32gcc1
+Conflicts: ia32-libs (<= 1.5)
+Description: GNU C Library: 32bit development libraries for AMD64
+ Contains the symlinks and object files needed to compile and link programs
+ which use the standard C library. This is the 32bit version of the
+ library, meant for AMD64 systems.
+
--- glibc-2.3.6.orig/debian/patches/amd64-i386-biarch.diff
+++ glibc-2.3.6/debian/patches/amd64-i386-biarch.diff
@@ -0,0 +1,16 @@
+--- glibc-2.3.6.orig/sysdeps/unix/sysv/linux/x86_64/dl-cache.h	2006-02-10 07:50:41.000000000 +0100
++++ glibc-2.3.6/sysdeps/unix/sysv/linux/x86_64/dl-cache.h	2006-02-10 07:50:56.000000000 +0100
+@@ -22,4 +22,4 @@
+ #define _dl_cache_check_flags(flags)			\
+   ((flags) == _DL_CACHE_DEFAULT_ID)
+ 
+-#include <sysdeps/unix/sysv/linux/sparc/dl-cache.h>
++#include <sysdeps/unix/sysv/linux/mips/dl-cache.h>
+--- glibc-2.3.6.orig/sysdeps/unix/sysv/linux/mips/dl-cache.h	2006-02-10 07:33:28.054067544 +0000
++++ glibc-2.3.6/sysdeps/unix/sysv/linux/mips/dl-cache.h	2006-02-10 07:34:15.056024278 +0000
+@@ -40,4 +40,4 @@
+ 	}							\
+     } while (0)
+ 
+-#include_next <dl-cache.h>
++#include <sysdeps/generic/dl-cache.h>

Reply to: