Message ID | 20190102092304.27262-1-riku.voipio@linaro.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [v2] deb-pkg: generate correct build dependencies | expand |
On Wed, 2019-01-02 at 11:23 +0200, riku.voipio@linaro.org wrote: > From: Riku Voipio <riku.voipio@linaro.org> > > bison/flex is now needed always for building for kconfig. Some build > dependencies depend on kernel configuration, enable them as needed: > > - libelf-dev when UNWINDER_ORC is set > - libssl-dev for SYSTEM_TRUSTED_KEYRING > > Since the libssl-dev is needed for extract_cert binary, denote with > :native to install the libssl-dev for the build machines > architecture, > rather than for the architecture of the kernel being built. > > Tested-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> > Signed-off-by: Riku Voipio <riku.voipio@linaro.org> Reviewed-by: Ben Hutchings <ben@decadent.org.uk> > --- > v2: commit message updated > --- > scripts/package/mkdebian | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/scripts/package/mkdebian b/scripts/package/mkdebian > index edcad61fe3cd..c858abf4569e 100755 > --- a/scripts/package/mkdebian > +++ b/scripts/package/mkdebian > @@ -134,6 +134,8 @@ fi > > mkdir -p debian/ > echo $debarch > debian/arch > +extra_build_depends=", $(if_enabled_echo UNWINDER_ORC libelf-dev)" > +extra_build_depends="$extra_build_depends, $(if_enabled_echo SYSTEM_TRUSTED_KEYRING libssl-dev:native)" > > # Generate a simple changelog template > cat <<EOF > debian/changelog > @@ -170,7 +172,7 @@ Source: $sourcename > Section: kernel > Priority: optional > Maintainer: $maintainer > -Build-Depends: bc, kmod, cpio > +Build-Depends: bc, kmod, cpio, bison, flex $extra_build_depends > Homepage: http://www.kernel.org/ > > Package: $packagename
On Wed, Jan 02, 2019 at 07:48:12PM +0000, Ben Hutchings wrote: > On Wed, 2019-01-02 at 11:23 +0200, riku.voipio@linaro.org wrote: > > From: Riku Voipio <riku.voipio@linaro.org> > > > > bison/flex is now needed always for building for kconfig. Some build > > dependencies depend on kernel configuration, enable them as needed: > > > > - libelf-dev when UNWINDER_ORC is set > > - libssl-dev for SYSTEM_TRUSTED_KEYRING > > > > Since the libssl-dev is needed for extract_cert binary, denote with > > :native to install the libssl-dev for the build machines > > architecture, > > rather than for the architecture of the kernel being built. > > > > Tested-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> > > Signed-off-by: Riku Voipio <riku.voipio@linaro.org> > > Reviewed-by: Ben Hutchings <ben@decadent.org.uk> Acked-by: maximilian attems <maks@stro.at> > > --- > > v2: commit message updated > > --- > > scripts/package/mkdebian | 4 +++- > > 1 file changed, 3 insertions(+), 1 deletion(-) > > > > diff --git a/scripts/package/mkdebian b/scripts/package/mkdebian > > index edcad61fe3cd..c858abf4569e 100755 > > --- a/scripts/package/mkdebian > > +++ b/scripts/package/mkdebian > > @@ -134,6 +134,8 @@ fi > > > > mkdir -p debian/ > > echo $debarch > debian/arch > > +extra_build_depends=", $(if_enabled_echo UNWINDER_ORC libelf-dev)" > > +extra_build_depends="$extra_build_depends, $(if_enabled_echo SYSTEM_TRUSTED_KEYRING libssl-dev:native)" > > > > # Generate a simple changelog template > > cat <<EOF > debian/changelog > > @@ -170,7 +172,7 @@ Source: $sourcename > > Section: kernel > > Priority: optional > > Maintainer: $maintainer > > -Build-Depends: bc, kmod, cpio > > +Build-Depends: bc, kmod, cpio, bison, flex $extra_build_depends > > Homepage: http://www.kernel.org/ > > > > Package: $packagename > -- > Ben Hutchings > Absolutum obsoletum. (If it works, it's out of date.) - Stafford Beer > >
Hi Riku, On Wed, Jan 2, 2019 at 6:28 PM <riku.voipio@linaro.org> wrote: > > From: Riku Voipio <riku.voipio@linaro.org> > > bison/flex is now needed always for building for kconfig. Some build > dependencies depend on kernel configuration, enable them as needed: > > - libelf-dev when UNWINDER_ORC is set > - libssl-dev for SYSTEM_TRUSTED_KEYRING > > Since the libssl-dev is needed for extract_cert binary, denote with > :native to install the libssl-dev for the build machines architecture, > rather than for the architecture of the kernel being built. > > Tested-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> > Signed-off-by: Riku Voipio <riku.voipio@linaro.org> > --- > v2: commit message updated > --- $ make defconfig && make bindeb-pkg worked for me, but $ make allnoconfig && make bindeb-pkg failed with dpkg-checkbuilddeps: error: Unmet build dependencies: flex I do not know why. The relevant line in debian/control looks as follows, but I am not sure if trailing commas are causing the problem. Build-Depends: bc, kmod, cpio, bison, flex , , > scripts/package/mkdebian | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/scripts/package/mkdebian b/scripts/package/mkdebian > index edcad61fe3cd..c858abf4569e 100755 > --- a/scripts/package/mkdebian > +++ b/scripts/package/mkdebian > @@ -134,6 +134,8 @@ fi > > mkdir -p debian/ > echo $debarch > debian/arch > +extra_build_depends=", $(if_enabled_echo UNWINDER_ORC libelf-dev)" > +extra_build_depends="$extra_build_depends, $(if_enabled_echo SYSTEM_TRUSTED_KEYRING libssl-dev:native)" > > # Generate a simple changelog template > cat <<EOF > debian/changelog > @@ -170,7 +172,7 @@ Source: $sourcename > Section: kernel > Priority: optional > Maintainer: $maintainer > -Build-Depends: bc, kmod, cpio > +Build-Depends: bc, kmod, cpio, bison, flex $extra_build_depends > Homepage: http://www.kernel.org/ > > Package: $packagename > -- > 2.19.2 >
Hi Riku, On Thu, Jan 3, 2019 at 6:28 AM Masahiro Yamada <yamada.masahiro@socionext.com> wrote: > > Hi Riku, > > > > On Wed, Jan 2, 2019 at 6:28 PM <riku.voipio@linaro.org> wrote: > > > > From: Riku Voipio <riku.voipio@linaro.org> > > > > bison/flex is now needed always for building for kconfig. Some build > > dependencies depend on kernel configuration, enable them as needed: > > > > - libelf-dev when UNWINDER_ORC is set > > - libssl-dev for SYSTEM_TRUSTED_KEYRING > > > > Since the libssl-dev is needed for extract_cert binary, denote with > > :native to install the libssl-dev for the build machines architecture, > > rather than for the architecture of the kernel being built. > > > > Tested-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> > > Signed-off-by: Riku Voipio <riku.voipio@linaro.org> > > --- > > v2: commit message updated > > --- > > > $ make defconfig && make bindeb-pkg > > worked for me, but > > $ make allnoconfig && make bindeb-pkg > > failed with > > dpkg-checkbuilddeps: error: Unmet build dependencies: flex > > > I do not know why. I looked into this build error. This happens depending on 'debian/arch'. My host machine is x86_64. When I run "make defconfig; make bindeb-pkg", $ cat debian/arch amd64 When I run "make allnoconfig; make bindeb-pkg", $ cat debian/arch i386 $ head -n 6 debian/control Source: linux-5.0.0-rc7+ Section: kernel Priority: optional Maintainer: Masahiro Yamada <yamada.masahiro@socionext.com> Build-Depends: bc, kmod, cpio, bison, flex , , Homepage: http://www.kernel.org/ $ dpkg-buildpackage -r"fakeroot -u" -ai386 -b -nc -ucdpkg-buildpackage: source package linux-5.0.0-rc7+ dpkg-buildpackage: source version 5.0.0-rc7+-1 dpkg-buildpackage: source distribution xenial dpkg-buildpackage: source changed by Masahiro Yamada <yamada.masahiro@socionext.com> dpkg-architecture: warning: specified GNU system type i686-linux-gnu does not match CC system type x86_64-linux-gnu, try setting a correct CC environment variable dpkg-buildpackage: host architecture i386 dpkg-source --before-build linux dpkg-checkbuilddeps: error: Unmet build dependencies: flex dpkg-buildpackage: warning: build dependencies/conflicts unsatisfied; aborting dpkg-buildpackage: warning: (Use -d flag to override.) After I applied the following patch, I was able to build "make allnoconfig; make bindeb-pkg". diff --git a/scripts/package/Makefile b/scripts/package/Makefile index 453fece..6793642 100644 --- a/scripts/package/Makefile +++ b/scripts/package/Makefile @@ -72,11 +72,11 @@ deb-pkg: FORCE $(call cmd,src_tar,$(KDEB_SOURCENAME)) origversion=$$(dpkg-parsechangelog -SVersion |sed 's/-[^-]*$$//');\ mv $(KDEB_SOURCENAME).tar.gz ../$(KDEB_SOURCENAME)_$${origversion}.orig.tar.gz - +dpkg-buildpackage -r$(KBUILD_PKG_ROOTCMD) -a$$(cat debian/arch) -i.git -us -uc + +dpkg-buildpackage -r$(KBUILD_PKG_ROOTCMD) --target-arch $$(cat debian/arch) -i.git -us -uc bindeb-pkg: FORCE $(CONFIG_SHELL) $(srctree)/scripts/package/mkdebian - +dpkg-buildpackage -r$(KBUILD_PKG_ROOTCMD) -a$$(cat debian/arch) -b -nc -uc + +dpkg-buildpackage -r$(KBUILD_PKG_ROOTCMD) --target-arch $$(cat debian/arch) -b -nc -uc intdeb-pkg: FORCE +$(CONFIG_SHELL) $(srctree)/scripts/package/builddeb -- Best Regards Masahiro Yamada
On Tue, Feb 19, 2019 at 1:00 AM Masahiro Yamada <yamada.masahiro@socionext.com> wrote: > > Hi Riku, > > > On Thu, Jan 3, 2019 at 6:28 AM Masahiro Yamada > <yamada.masahiro@socionext.com> wrote: > > > > Hi Riku, > > > > > > > > On Wed, Jan 2, 2019 at 6:28 PM <riku.voipio@linaro.org> wrote: > > > > > > From: Riku Voipio <riku.voipio@linaro.org> > > > > > > bison/flex is now needed always for building for kconfig. Some build > > > dependencies depend on kernel configuration, enable them as needed: > > > > > > - libelf-dev when UNWINDER_ORC is set > > > - libssl-dev for SYSTEM_TRUSTED_KEYRING > > > > > > Since the libssl-dev is needed for extract_cert binary, denote with > > > :native to install the libssl-dev for the build machines architecture, > > > rather than for the architecture of the kernel being built. > > > > > > Tested-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> > > > Signed-off-by: Riku Voipio <riku.voipio@linaro.org> > > > --- > > > v2: commit message updated > > > --- > > > > > > $ make defconfig && make bindeb-pkg > > > > worked for me, but > > > > $ make allnoconfig && make bindeb-pkg > > > > failed with > > > > dpkg-checkbuilddeps: error: Unmet build dependencies: flex > > > > > > I do not know why. > > > > I looked into this build error. > > This happens depending on 'debian/arch'. > > My host machine is x86_64. > > > When I run "make defconfig; make bindeb-pkg", > > $ cat debian/arch > amd64 > > > > When I run "make allnoconfig; make bindeb-pkg", > > $ cat debian/arch > i386 > > > > $ head -n 6 debian/control > Source: linux-5.0.0-rc7+ > Section: kernel > Priority: optional > Maintainer: Masahiro Yamada <yamada.masahiro@socionext.com> > Build-Depends: bc, kmod, cpio, bison, flex , , > Homepage: http://www.kernel.org/ > > $ dpkg-buildpackage -r"fakeroot -u" -ai386 -b -nc > -ucdpkg-buildpackage: source package linux-5.0.0-rc7+ > dpkg-buildpackage: source version 5.0.0-rc7+-1 > dpkg-buildpackage: source distribution xenial > dpkg-buildpackage: source changed by Masahiro Yamada > <yamada.masahiro@socionext.com> > dpkg-architecture: warning: specified GNU system type i686-linux-gnu > does not match CC system type x86_64-linux-gnu, try setting a correct > CC environment variable > dpkg-buildpackage: host architecture i386 > dpkg-source --before-build linux > dpkg-checkbuilddeps: error: Unmet build dependencies: flex > dpkg-buildpackage: warning: build dependencies/conflicts unsatisfied; aborting > dpkg-buildpackage: warning: (Use -d flag to override.) > > > After I applied the following patch, > I was able to build "make allnoconfig; make bindeb-pkg". > > > > diff --git a/scripts/package/Makefile b/scripts/package/Makefile > index 453fece..6793642 100644 > --- a/scripts/package/Makefile > +++ b/scripts/package/Makefile > @@ -72,11 +72,11 @@ deb-pkg: FORCE > $(call cmd,src_tar,$(KDEB_SOURCENAME)) > origversion=$$(dpkg-parsechangelog -SVersion |sed 's/-[^-]*$$//');\ > mv $(KDEB_SOURCENAME).tar.gz > ../$(KDEB_SOURCENAME)_$${origversion}.orig.tar.gz > - +dpkg-buildpackage -r$(KBUILD_PKG_ROOTCMD) -a$$(cat > debian/arch) -i.git -us -uc > + +dpkg-buildpackage -r$(KBUILD_PKG_ROOTCMD) --target-arch > $$(cat debian/arch) -i.git -us -uc > > bindeb-pkg: FORCE > $(CONFIG_SHELL) $(srctree)/scripts/package/mkdebian > - +dpkg-buildpackage -r$(KBUILD_PKG_ROOTCMD) -a$$(cat > debian/arch) -b -nc -uc > + +dpkg-buildpackage -r$(KBUILD_PKG_ROOTCMD) --target-arch > $$(cat debian/arch) -b -nc -uc > > intdeb-pkg: FORCE > +$(CONFIG_SHELL) $(srctree)/scripts/package/builddeb This is not the right answer. "make allnoconfig; make bindeb-pkg" failed on Ubuntu 16.04, but succeeded on Ubuntu 18.04 I am puzzled... foo@4066694d5e03:/ref/linux$ git log --oneline -1 bd8f27f deb-pkg: generate correct build dependencies foo@4066694d5e03:/ref/linux$ make bindeb-pkg /bin/bash ./scripts/package/mkdebian Using default distribution of 'unstable' in the changelog Install lsb-release or set $KDEB_CHANGELOG_DIST explicitly dpkg-buildpackage -r"fakeroot -u" -a$(cat debian/arch) -b -nc -uc dpkg-buildpackage: source package linux-5.0.0-rc7+ dpkg-buildpackage: source version 5.0.0-rc7+-1 dpkg-buildpackage: source distribution unstable dpkg-buildpackage: source changed by foo <foo@4066694d5e03> dpkg-architecture: warning: specified GNU system type i686-linux-gnu does not match CC system type x86_64-linux-gnu, try setting a correct CC environment variable dpkg-buildpackage: host architecture i386 dpkg-source --before-build linux dpkg-checkbuilddeps: error: Unmet build dependencies: flex dpkg-buildpackage: warning: build dependencies/conflicts unsatisfied; aborting dpkg-buildpackage: warning: (Use -d flag to override.) scripts/package/Makefile:78: recipe for target 'bindeb-pkg' failed make[1]: *** [bindeb-pkg] Error 3 Makefile:1390: recipe for target 'bindeb-pkg' failed make: *** [bindeb-pkg] Error 2 The docker file I used is below. If I change "FROM ubuntu:16.04" to "FROM ubuntu:18.04", it goes well. ------------------->8------------------ FROM ubuntu:16.04 # user name ARG USER=foo # packages to install ARG PKGS=" \ bc \ bison \ build-essential \ flex \ git \ strace \ sudo \ cpio \ kmod \ " RUN \ apt-get update && \ DEBCONF_NOWARNINGS=yes apt-get install -y apt-utils && \ apt-get install -y ${PKGS} && \ useradd -m ${USER} && \ echo "${USER} ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers USER ${USER} WORKDIR /home/${USER} ---------------------->8--------------------------
On Tue, 2019-02-19 at 02:05 +0900, Masahiro Yamada wrote: [...] > "make allnoconfig; make bindeb-pkg" > failed on Ubuntu 16.04, but succeeded on Ubuntu 18.04 > > I am puzzled... [...] > dpkg-buildpackage: host architecture i386 > dpkg-source --before-build linux > dpkg-checkbuilddeps: error: Unmet build dependencies: flex > dpkg-buildpackage: warning: build dependencies/conflicts unsatisfied; aborting > dpkg-buildpackage: warning: (Use -d flag to override.) > scripts/package/Makefile:78: recipe for target 'bindeb-pkg' failed > make[1]: *** [bindeb-pkg] Error 3 > Makefile:1390: recipe for target 'bindeb-pkg' failed > make: *** [bindeb-pkg] Error 2 > > > The docker file I used is below. > > If I change "FROM ubuntu:16.04" to "FROM ubuntu:18.04", > it goes well. [...] For a cross-build, some build-dependencies may need to belong to the host architecture (what the package will run on) while others do not. In general, they must do one of: (a) Belong to the host architecture (b) Belong to any architecture, and include "Multi-Arch: foreign" in their own metadata (c) Belong to an architecture specified in the Build-Depends field We normally want (b) for tools like flex. But flex is (I assume) missing the Multi-Arch field in Ubuntu 16.04, as it used to in Debian. The way we dealt with this in Debian before flex was fixed was (c): use "flex:native". But for reasons I don't understand that *isn't* compatible with (b), so to be compatible with both old and new versions of flex you should build-depend on: flex | flex:native Ben.
On Mon, 2019-02-18 at 17:54 +0000, Ben Hutchings wrote: [...] > The way we dealt with this in Debian before flex was fixed was (c): use > "flex:native". But for reasons I don't understand that *isn't* > compatible with (b), so to be compatible with both old and new versions > of flex you should build-depend on: > > flex | flex:native And libssl-dev needs to be changed to libssl-dev:native, since it's used to build a program that runs at build time. Ben.
On Tue, Feb 19, 2019 at 4:13 AM Ben Hutchings <ben@decadent.org.uk> wrote: > > On Tue, 2019-02-19 at 02:05 +0900, Masahiro Yamada wrote: > [...] > > "make allnoconfig; make bindeb-pkg" > > failed on Ubuntu 16.04, but succeeded on Ubuntu 18.04 > > > > I am puzzled... > [...] > > dpkg-buildpackage: host architecture i386 > > dpkg-source --before-build linux > > dpkg-checkbuilddeps: error: Unmet build dependencies: flex > > dpkg-buildpackage: warning: build dependencies/conflicts unsatisfied; aborting > > dpkg-buildpackage: warning: (Use -d flag to override.) > > scripts/package/Makefile:78: recipe for target 'bindeb-pkg' failed > > make[1]: *** [bindeb-pkg] Error 3 > > Makefile:1390: recipe for target 'bindeb-pkg' failed > > make: *** [bindeb-pkg] Error 2 > > > > > > The docker file I used is below. > > > > If I change "FROM ubuntu:16.04" to "FROM ubuntu:18.04", > > it goes well. > [...] > > For a cross-build, some build-dependencies may need to belong to the > host architecture (what the package will run on) while others do not. > In general, they must do one of: > > (a) Belong to the host architecture > (b) Belong to any architecture, and include "Multi-Arch: foreign" in > their own metadata > (c) Belong to an architecture specified in the Build-Depends field > > We normally want (b) for tools like flex. But flex is (I assume) > missing the Multi-Arch field in Ubuntu 16.04, as it used to in Debian. > > The way we dealt with this in Debian before flex was fixed was (c): use > "flex:native". But for reasons I don't understand that *isn't* > compatible with (b), so to be compatible with both old and new versions > of flex you should build-depend on: > > flex | flex:native Yes, it worked with this fix. Thanks.
Hi Riku, On Tue, Feb 19, 2019 at 11:15 AM Masahiro Yamada <yamada.masahiro@socionext.com> wrote: > > The way we dealt with this in Debian before flex was fixed was (c): use > > "flex:native". But for reasons I don't understand that *isn't* > > compatible with (b), so to be compatible with both old and new versions > > of flex you should build-depend on: > > > > flex | flex:native > > Yes, it worked with this fix. > Could you please send v3? Thanks.
diff --git a/scripts/package/mkdebian b/scripts/package/mkdebian index edcad61fe3cd..c858abf4569e 100755 --- a/scripts/package/mkdebian +++ b/scripts/package/mkdebian @@ -134,6 +134,8 @@ fi mkdir -p debian/ echo $debarch > debian/arch +extra_build_depends=", $(if_enabled_echo UNWINDER_ORC libelf-dev)" +extra_build_depends="$extra_build_depends, $(if_enabled_echo SYSTEM_TRUSTED_KEYRING libssl-dev:native)" # Generate a simple changelog template cat <<EOF > debian/changelog @@ -170,7 +172,7 @@ Source: $sourcename Section: kernel Priority: optional Maintainer: $maintainer -Build-Depends: bc, kmod, cpio +Build-Depends: bc, kmod, cpio, bison, flex $extra_build_depends Homepage: http://www.kernel.org/ Package: $packagename