Bug#798064: glibc: please find kfreebsd-kernel-headers in multiarch path
Control: reassign -1 src:glibc 2.19-19 Control: forcemerge -1 672774 I just noticed the earlier, duplicate bug. Regards, -- Steven Chamberlain ste...@pyro.eu.org signature.asc Description: Digital signature
Bug#798064: glibc: please find kfreebsd-kernel-headers in multiarch path
Hi Steven, On Sat, Sep 05, 2015 at 01:50:02AM +0100, Steven Chamberlain wrote: > We're hoping to move kfreebsd-kernel-headers' files to multiarch > path /usr/include/$(DEB_TARGET_MULTIARCH), so that headers of other > kernels are co-installable on a build machine (for cross-building and > bootstrapping). Thanks for doing that work! > Please could glibc be patched as attached, to always look in that > directory for system includes, even for native builds (HOST==BUILD). I'm not quite sure how much backwards compatibility we need here and your patch probably breaks that. In former times (before multiarch based cross building) cross libraries were installed in a sysroot, typically /usr/$(DEB_HOST_GNU_TYPE). The package dpkg-cross was used to convert regular :$(DEB_HOST_ARCH) packages to -$(DEB_HOST_ARCH)-cross:all packages and convert the paths in the same way. (In jenkins.d.n/view/rebootstrap this method is called "supported", because it is the only way supported by the gcc maintainers.) So maybe we could find a way that works for both the "dpkg-cross" way (at least in theory) and the multiarch way. For linux this is not sorted out either yet. The relevant code here is in debian/sysdeps/linux.mk: | ifeq ($(DEB_HOST_GNU_TYPE),$(DEB_BUILD_GNU_TYPE)) | LINUX_HEADERS := /usr/include | else | LINUX_HEADERS := /usr/$(DEB_HOST_GNU_TYPE)/include | endif | LINUX_ARCH_HEADERS := /usr/include/$(DEB_HOST_MULTIARCH) The patch in bug #773300 (which is mostly obsolete due to merging #766877), suggests to change this ifeq to the following line. | ifeq ($(shell dpkg-query --status linux-libc-dev-$(DEB_HOST_ARCH)-cross 2>/dev/null),) It might make sense to do something similar for kfreebsd, but I was still wondering whether this particular test method works in all relevant cases. Aurelien, I shall follow up to #773300 again and explain what parts of that bug are still applicable. > - ifeq ($(DEB_HOST_GNU_TYPE),$(DEB_BUILD_GNU_TYPE)) > -KFREEBSD_HEADERS := /usr/include > - else > -KFREEBSD_HEADERS := /usr/$(DEB_HOST_GNU_TYPE)/include > - endif > + KFREEBSD_HEADERS := /usr/include/$(DEB_TARGET_MULTIARCH) Using target variables is wrong here. It might work (because target defaults to host), but it doesn't make sense semantically. This must be DEB_HOST_MULTIARCH here. Target variables are only relevant for compilers, but glibc isn't a compiler. Helmut
Bug#798064: glibc: please find kfreebsd-kernel-headers in multiarch path
Hi! Helmut Grohne wrote: > So maybe we could find a way that works for both the "dpkg-cross" way > (at least in theory) and the multiarch way. > > For linux this is not sorted out either yet. The relevant code here is > in debian/sysdeps/linux.mk: > | ifeq ($(DEB_HOST_GNU_TYPE),$(DEB_BUILD_GNU_TYPE)) > | LINUX_HEADERS := /usr/include > | else > | LINUX_HEADERS := /usr/$(DEB_HOST_GNU_TYPE)/include > | endif > | LINUX_ARCH_HEADERS := /usr/include/$(DEB_HOST_MULTIARCH) Actually... that looks like it should already work. The files in LINUX_ARCH_HEADERS are used in preference to LINUX_HEADERS, if they are available. We can just do the same in kfreebsd.mk, using multiarch headers if they're found, or the old locations as a fallback. It also means glibc can apply this patch before kfreebsd-kernel-headers has made the change; no need to bump the Build-Depends version now. > Using target variables is wrong here. It might work (because target > defaults to host), but it doesn't make sense semantically. This must be > DEB_HOST_MULTIARCH here. Target variables are only relevant for > compilers, but glibc isn't a compiler. I've corrected this too in the new version of the patch, attached. Thanks again for your help! Regards, -- Steven Chamberlain ste...@pyro.eu.org --- debian/sysdeps/kfreebsd.mk.orig 2015-07-09 12:28:06.0 + +++ debian/sysdeps/kfreebsd.mk 2015-09-05 16:29:00.655101849 + @@ -16,6 +16,7 @@ else KFREEBSD_HEADERS := /usr/$(DEB_HOST_GNU_TYPE)/include endif + KFREEBSD_ARCH_HEADERS := /usr/include/$(DEB_HOST_MULTIARCH) else KFREEBSD_HEADERS := $(KFREEBSD_SOURCE)/sys endif @@ -27,18 +28,14 @@ $(stamp)mkincludedir: rm -rf debian/include mkdir debian/include - for file in bsm net netatalk netipx nfs osreldate.h sys x86 vm ; do \ - if test -e $(KFREEBSD_HEADERS)/$$file ; then \ + for file in bsm machine machine-i386 net netatalk netipx nfs osreldate.h sys x86 vm ; do \ + if test -e $(KFREEBSD_ARCH_HEADERS)/$$file ; then \ + ln -s $(KFREEBSD_ARCH_HEADERS)/$$file debian/include ; \ + elif test -e $(KFREEBSD_HEADERS)/$$file ; then \ ln -s $(KFREEBSD_HEADERS)/$$file debian/include ; \ fi ; \ done -# Link all machine directories. We can't just link machine -# because of explicit references to and - # . - find $(KFREEBSD_HEADERS) -maxdepth 1 -xtype d -name machine\* \ - -exec ln -s '{}' debian/include ';' - # To make configure happy if libc0.1-dev is not installed. touch debian/include/assert.h signature.asc Description: Digital signature
Bug#798064: glibc: please find kfreebsd-kernel-headers in multiarch path
Steven Chamberlain wrote: > We can just do the same in kfreebsd.mk, using multiarch headers if > they're found, or the old locations as a fallback. Turns out this was not backward-compatible, because other packages (libc0.1-dev) may create /usr/include/$(DEB_HOST_ARCH)/sys, having some but not all the required headers. Doing the opposite works though - look for /usr/include/sys (or the dpkg-cross location); if it's not there, try looking at the new multiarch location instead. This is the same ordering used by gcc's default include paths already. Revised patch attached. Thanks, Regards, -- Steven Chamberlain ste...@pyro.eu.org --- debian/sysdeps/kfreebsd.mk.orig 2015-07-09 12:28:06.0 + +++ debian/sysdeps/kfreebsd.mk 2015-09-05 16:29:00.655101849 + @@ -16,6 +16,7 @@ else KFREEBSD_HEADERS := /usr/$(DEB_HOST_GNU_TYPE)/include endif + KFREEBSD_ARCH_HEADERS := /usr/include/$(DEB_HOST_MULTIARCH) else KFREEBSD_HEADERS := $(KFREEBSD_SOURCE)/sys endif @@ -27,18 +28,14 @@ $(stamp)mkincludedir: rm -rf debian/include mkdir debian/include - for file in bsm net netatalk netipx nfs osreldate.h sys x86 vm ; do \ - if test -e $(KFREEBSD_HEADERS)/$$file ; then \ + for file in bsm machine machine-i386 net netatalk netipx nfs osreldate.h sys x86 vm ; do \ + if test -e $(KFREEBSD_HEADERS)/$$file ; then \ + ln -s $(KFREEBSD_HEADERS)/$$file debian/include ; \ + elif test -e $(KFREEBSD_ARCH_HEADERS)/$$file ; then \ ln -s $(KFREEBSD_ARCH_HEADERS)/$$file debian/include ; \ fi ; \ done -# Link all machine directories. We can't just link machine -# because of explicit references to and - # . - find $(KFREEBSD_HEADERS) -maxdepth 1 -xtype d -name machine\* \ - -exec ln -s '{}' debian/include ';' - # To make configure happy if libc0.1-dev is not installed. touch debian/include/assert.h signature.asc Description: Digital signature
Bug#798064: glibc: please find kfreebsd-kernel-headers in multiarch path
Sorry, that was wrong. Required headers could be located in /usr/include/sys and /usr/include/$(DEB_HOST_MULTIARCH)/sys at the same time. It is necessary to split debian/include/sys/ and link to individual headers (or subdirectories) wherever they are located. I think I have a patch now that meets all the requirements. Firstly it will look for headers at the new multiarch location, /usr/include/$(DEB_HOST_MULTIARCH). Those could be native headers, or foreign-architecture headers if you've installed those for cross-building. But otherwise it will fall back to using headers from the original locations: /usr/include for native builds; /usr/$(DEB_HOST_GNU_TYPE)/include for old-style cross builds. I've tested this with successful native kfreebsd-amd64 builds (including multilib), having kernel headers in either the original or the new (multiarch) locations. Thank you, Regards, -- Steven Chamberlain ste...@pyro.eu.org --- glibc-2.19/debian/sysdeps/kfreebsd.mk 2015-07-09 13:28:06.0 +0100 +++ glibc-2.19/debian/sysdeps/kfreebsd.mk 2015-09-05 20:23:27.708048223 +0100 @@ -16,6 +16,7 @@ else KFREEBSD_HEADERS := /usr/$(DEB_HOST_GNU_TYPE)/include endif + KFREEBSD_ARCH_HEADERS := /usr/include/$(DEB_HOST_MULTIARCH) else KFREEBSD_HEADERS := $(KFREEBSD_SOURCE)/sys endif @@ -27,17 +28,25 @@ $(stamp)mkincludedir: rm -rf debian/include mkdir debian/include - for file in bsm net netatalk netipx nfs osreldate.h sys x86 vm ; do \ - if test -e $(KFREEBSD_HEADERS)/$$file ; then \ + + # Link to any headers found at the new multiarch location, + # otherwise look for them in the old locations + for file in bsm machine machine-amd64 machine-i386 net netatalk netipx nfs osreldate.h x86 vm ; do \ + if test -e $(KFREEBSD_ARCH_HEADERS)/$$file ; then \ + ln -s $(KFREEBSD_ARCH_HEADERS)/$$file debian/include ; \ + elif test -e $(KFREEBSD_HEADERS)/$$file ; then \ ln -s $(KFREEBSD_HEADERS)/$$file debian/include ; \ fi ; \ done -# Link all machine directories. We can't just link machine -# because of explicit references to and - # . - find $(KFREEBSD_HEADERS) -maxdepth 1 -xtype d -name machine\* \ - -exec ln -s '{}' debian/include ';' + mkdir -p debian/include/sys + # Link to any headers found in the old locations first + find $(KFREEBSD_HEADERS)/sys -mindepth 1 \ + -exec ln -sf '{}' debian/include/sys ';' + # Link to any headers found at the new multiarch location, + # replacing any existing links + find $(KFREEBSD_ARCH_HEADERS)/sys -mindepth 1 \ + -exec ln -sf '{}' debian/include/sys ';' # To make configure happy if libc0.1-dev is not installed. touch debian/include/assert.h signature.asc Description: Digital signature
Bug#798064: glibc: please find kfreebsd-kernel-headers in multiarch path
Package: glibc Version: 2.19-19 Severity: wishlist Tags: patch Hi, We're hoping to move kfreebsd-kernel-headers' files to multiarch path /usr/include/$(DEB_TARGET_MULTIARCH), so that headers of other kernels are co-installable on a build machine (for cross-building and bootstrapping). gcc-5 is already fine with this. And since gcc's default include search path has /usr/include/$(DEB_TARGET_MULTIARCH), it is expected to not cause many problems; except where -nostdinc is used. Please could glibc be patched as attached, to always look in that directory for system includes, even for native builds (HOST==BUILD). We hope to make this change with kfreebsd-kernel-headers (>= 10.1~7~), unless there are objections, or if my upcoming mass rebuild reveal any other breakage in reverse-depends. Thanks! -- System Information: Debian Release: stretch/sid APT prefers unstable APT policy: (500, 'unstable'), (1, 'experimental') Architecture: kfreebsd-amd64 (x86_64) Kernel: kFreeBSD 9.0-2-amd64-xenhvm-ipsec Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash --- glibc-2.19/debian/sysdeps/kfreebsd.mk.orig 2015-07-09 12:28:06.0 + +++ glibc-2.19/debian/sysdeps/kfreebsd.mk 2015-09-04 16:04:43.104028000 + @@ -11,11 +11,7 @@ libc_extra_config_options = $(extra_config_options) ifndef KFREEBSD_SOURCE - ifeq ($(DEB_HOST_GNU_TYPE),$(DEB_BUILD_GNU_TYPE)) -KFREEBSD_HEADERS := /usr/include - else -KFREEBSD_HEADERS := /usr/$(DEB_HOST_GNU_TYPE)/include - endif + KFREEBSD_HEADERS := /usr/include/$(DEB_TARGET_MULTIARCH) else KFREEBSD_HEADERS := $(KFREEBSD_SOURCE)/sys endif