Bug#466422: gcc-4.2: broken alternatives for amd64 cross target
Source: gcc-4.2
Version: 4.2.2-7
Severity: normal
When building a cross compiler targeting Debian-amd64, the executable
prefix is x86_64-linux-gnu, but the alternatives are installed using the
prefix x86-64-linux-gnu, i.e. with a hyphen instead of the underscore.
e.g.:
/usr/bin/x86-64-linux-gnu-gcc ->
/etc/alternatives/x86-64-linux-gnu-gcc ->
/usr/bin/x86-64-linux-gnu-gcc-4.2, which doesn't exist.
The postinst and prerm scripts are generated by these lines in
debian/rules.d/binary-gcc-cross.mk:
sed 's/cross-/$(TP)/g;s/-ver/$(pkg_ver)/g' < debian/gcc-cross.postinst > debian/$(p_gcc)/DEBIAN/postinst
sed 's/cross-/$(TP)/g;s/-ver/$(pkg_ver)/g' < debian/gcc-cross.prerm > debian/$(p_gcc)/DEBIAN/prerm
and similarly in binary-cpp-cross.mk and binary-cxx-cross.mk.
The problem is that $(TP) has the underscore converted to a hyphen even
though the actual executables do not:
TP = $(subst _,-,$(DEB_TARGET_GNU_TYPE))-
The file names passed to dh_movefiles are OK because they are
constructed using $(DEB_TARGET_GNU_TYPE) directly, e.g.:
files_gcc = \
$(PF)/bin/$(DEB_TARGET_GNU_TYPE)-gcc$(pkg_ver) \
[...]
The minimal patch is to remove the substitution from the definition of
$(TP):
=====
--- debian/rules.defs
+++ debian/rules.defs
@@ -96,7 +96,7 @@
# LS: Library Suffix. Used primarily at the end of cross compiler
# library package names (e.g. libgcc-powerpc-cross).
DEB_TARGET_ALIAS ?= $(DEB_TARGET_GNU_TYPE)
- TP = $(subst _,-,$(DEB_TARGET_GNU_TYPE))-
+ TP = $(DEB_TARGET_GNU_TYPE)-
TS = -$(subst _,-,$(DEB_TARGET_ALIAS))
LS = -$(subst _,-,$(DEB_TARGET_ARCH))-cross
endif
=====
Obviously this could be improved by consistently using $(TP) wherever it
is appropriate.
-- System Information:
Debian Release: lenny/sid
APT prefers unstable
APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: i386 (i686)
Kernel: Linux 2.6.22-1-686 (SMP w/2 CPU cores)
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)
Shell: /bin/sh linked to /bin/bash
Versions of packages gcc-4.2 depends on:
ii binutils 2.18.1~cvs20080103-1 The GNU assembler, linker and bina
ii cpp-4.2 4.2.2-7 The GNU C preprocessor
ii gcc-4.2-base 4.2.2-7 The GNU Compiler Collection (base
ii libc6 2.7-6 GNU C Library: Shared libraries
ii libgcc1 1:4.3-20080127-1 GCC support library
Versions of packages gcc-4.2 recommends:
ii libc6-dev 2.7-6 GNU C Library: Development Librari
-- no debconf information
Reply to: