The configure script for module-init-tools fails on the target host string 'sh4-unknown-linux-gnu' even when setting 'ac_cv_host=yes' Reproducible: Always Steps to Reproduce: 1./usr/sh4-unknown-linux-gnu/xmerge -av1 module-init-tools I am following the Gentoo Cross development guide at http://www.gentoo.org/proj/en/base/embedded/handbook/index.xml?part=1&chap=1 2. 3. Actual Results: This error originally occurred when executing: /usr/sh4-unknown-linux-gnu/xmerge -av gentoo-sources as described in the guide. This pulled in all the basic system tools such as findutils, coreutils and module-init-tools. (I have fixed other bugs that occurred with findutils and coreutils as described in other bug reports.) The error is shown as: dirac sh4-unknown-linux-gnu # /usr/sh4-unknown-linux-gnu/xmerge -av1 module-init-tools These are the packages that would be merged, in order: Calculating dependencies... done! [ebuild N ] sys-apps/module-init-tools-3.5 to /usr/sh4-unknown-linux-gnu/ USE="-old-linux" 0 kB Total: 1 package (1 new), Size of downloads: 0 kB Would you like to merge these packages? [Yes/No] >>> Verifying ebuild manifests >>> Emerging (1 of 1) sys-apps/module-init-tools-3.5 for /usr/sh4-unknown-linux-gnu/ * module-init-tools-3.5.tar.bz2 RMD160 SHA1 SHA256 size ;-) ... [ ok ] * checking ebuild checksums ;-) ... [ ok ] * checking auxfile checksums ;-) ... [ ok ] * checking miscfile checksums ;-) ... [ ok ] >>> Unpacking source... >>> Unpacking module-init-tools-3.5.tar.bz2 to /var/tmp/portage/sys-apps/module-init-tools-3.5/work * Replacing obsolete head/tail with POSIX compliant ones * - fixed tests/test-depmod/10badcommand.sh * Applying module-init-tools-3.1_generate-modprobe-assume-kernel.patch ... [ ok ] * Applying module-init-tools-3.2_pre7-abort-on-modprobe-failure.patch ... [ ok ] * Applying module-init-tools-3.2.2-handle-dupliate-aliases.patch ... [ ok ] >>> Source unpacked in /var/tmp/portage/sys-apps/module-init-tools-3.5/work >>> Compiling source in /var/tmp/portage/sys-apps/module-init-tools-3.5/work/module-init-tools-3.5 ... * econf: updating module-init-tools-3.5/config.guess with /usr/share/gnuconfig/config.guess * econf: updating module-init-tools-3.5/config.sub with /usr/share/gnuconfig/config.sub ./configure --prefix=/usr --build=x86_64-pc-linux-gnu --host=sh4-unknown-linux-gnu --target=unknown --mandir=/usr/share/man --infodir=/usr/share/info --datadir=/usr/share --sysconfdir=/etc --localstatedir=/var/lib --prefix=/ --enable-zlib checking build system type... x86_64-pc-linux-gnu checking host system type... sh4-unknown-linux-gnu checking target system type... Invalid configuration `unknown': machine `unknown' not recognized configure: error: /bin/sh ./config.sub unknown failed If I set 'ac_cv_host=yes' in my cross compilation environment then the error morphs into: dirac sh4-unknown-linux-gnu # /usr/sh4-unknown-linux-gnu/xmerge -av1 module-init-tools These are the packages that would be merged, in order: Calculating dependencies... done! [ebuild N ] sys-apps/module-init-tools-3.5 to /usr/sh4-unknown-linux-gnu/ USE="-old-linux" 0 kB Total: 1 package (1 new), Size of downloads: 0 kB Would you like to merge these packages? [Yes/No] >>> Verifying ebuild manifests >>> Emerging (1 of 1) sys-apps/module-init-tools-3.5 for /usr/sh4-unknown-linux-gnu/ * module-init-tools-3.5.tar.bz2 RMD160 SHA1 SHA256 size ;-) ... [ ok ] * checking ebuild checksums ;-) ... [ ok ] * checking auxfile checksums ;-) ... [ ok ] * checking miscfile checksums ;-) ... [ ok ] >>> Unpacking source... >>> Unpacking module-init-tools-3.5.tar.bz2 to /var/tmp/portage/sys-apps/module-init-tools-3.5/work * Replacing obsolete head/tail with POSIX compliant ones * - fixed tests/test-depmod/10badcommand.sh * Applying module-init-tools-3.1_generate-modprobe-assume-kernel.patch ... [ ok ] * Applying module-init-tools-3.2_pre7-abort-on-modprobe-failure.patch ... [ ok ] * Applying module-init-tools-3.2.2-handle-dupliate-aliases.patch ... [ ok ] >>> Source unpacked in /var/tmp/portage/sys-apps/module-init-tools-3.5/work >>> Compiling source in /var/tmp/portage/sys-apps/module-init-tools-3.5/work/module-init-tools-3.5 ... * econf: updating module-init-tools-3.5/config.guess with /usr/share/gnuconfig/config.guess * econf: updating module-init-tools-3.5/config.sub with /usr/share/gnuconfig/config.sub ./configure --prefix=/usr --build=x86_64-pc-linux-gnu --host=sh4-unknown-linux-gnu --target=unknown --mandir=/usr/share/man --infodir=/usr/share/info --datadir=/usr/share --sysconfdir=/etc --localstatedir=/var/lib --prefix=/ --enable-zlib checking build system type... x86_64-pc-linux-gnu checking host system type... (cached) yes configure: error: invalid value of canonical host Expected Results: module-init-tools should compile correctly
I have fixed this - some misunderstanding on my part. Setting ac_cv_target=sh4-unknown-linux-gnu in my build environment solved the problem. The configure script for module-init-tools was executing config.sub $target_alias which is failing because target=unknown is passed to the configure script. Comparison with the configure script for coreutils shows that the coreutils configure script executes config.sub $host_alias which succeeds. Both the coreutils and module-init-tools configure scripts pass target=unknown on the command line - in module-init-tools this fails. AFAICS, either the configure script for module-init-tools is calling config.sub incorrectly or the cross compilation environment is incorrectly passing target=unknown to the configure script. Sorry about the noise.