ncftp: fix cross-compilation test
PATCH v2 1/1 ncftp: fix cross-compilation test
The cross-compilation test is based on the ability to run a test program on the host, which is wrong.
If it runs, then the configure script concludes
that we're doing native compilation,
if it doesn't run, we're doing cross-compilation.
Replace it with a more correct test.
Fixes
http://autobuild.buildroot.net/results/969/969a49ae97a50634ea846a82b9c360e4fb020ace/build-end.log
---
v2:
Add a cross-compilation test suggested by Thomas Petazzoni.
.../ncftp-0001-fix-cross-compilation-test.patch | 51 ++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 package/ncftp/ncftp-0001-fix-cross-compilation-test.patch
package/ncftp/ncftp-0001-fix-cross-compilation-test.patch new file +51 -0
@@ -0,0 +1,51 @@ +From 39396048bee3db9a29ec909aece1bdc6e6880e91 Mon Sep 17 00:00:00 2001 +From: Romain Naour <[email protected]> +Date: Fri, 14 Feb 2014 02:21:57 +0100 +Subject: [PATCH 1/1] configure: fix cross-compilation test + +The cross-compilation test is based on the ability to run +a test program on the host, which is wrong. + +If it runs, then the configure script concludes +that we're doing native compilation, +if it doesn't run, we're doing cross-compilation. + +Replace it with a more correct test. + +Fixes +http://autobuild.buildroot.net/results/969/969a49ae97a50634ea846a82b9c360e4fb020ace/build-end.log + +Note: The case where --build and --host are used together is not handled. + +Signed-off-by: Romain Naour <[email protected]> +--- + configure | 13 ++++++++----- + 1 file changed, 8 insertions(+), 5 deletions(-) + +diff --git a/configure b/configure +index 2f0fae0..2cfaa65 100755 +--- a/configure ++++ b/configure +@@ -1273,11 +1273,14 @@ main(){return(0);} + EOF + if { (eval echo configure:1275: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + ac_cv_prog_cc_works=yes +- # If we can't run a trivial program, we are probably using a cross compiler. +- if (./conftest; exit) 2>/dev/null; then +- ac_cv_prog_cc_cross=no +- else +- ac_cv_prog_cc_cross=yes ++ if test "x$host_alias" != x; then ++ if test "x$build_alias" = x; then ++ cross_compiling=maybe ++ $as_echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. ++ If a cross compiler is detected then cross compile mode will be used." >&2 ++ elif test "x$build_alias" != "x$host_alias"; then ++ cross_compiling=yes ++ fi + fi + else + echo "configure: failed program was:" >&5 +-- +1.8.5.3 +
Signature · 1 line
1.8.5.3
PATCH v2 1/1 ncftp: fix cross-compilation test
Dear Romain Naour,
Quoted 9 lines · Romain Naour
The cross-compilation test is based on the ability to run a test program on the host, which is wrong.
If it runs, then the configure script concludes that we're doing native compilation,
if it doesn't run, we're doing cross-compilation.Replace it with a more correct test.
Quoted 7 lines
Fixes
http://autobuild.buildroot.net/results/969/969a49ae97a50634ea846a82b9c360e4fb020ace/build-end.logSigned-off-by Romain Naour <[email protected]>---
v2:
Add a cross-compilation test suggested by Thomas Petazzoni.
Can you instead test the following patch:
package/ncftp/ncftp.mk +8 -0
@@ -11,6 +11,14 @@ NCFTP_TARGET_BINS = ncftp NCFTP_LICENSE = Clarified Artistic License NCFTP_LICENSE_FILES = doc/LICENSE.txt +NCFTP_DEPENDENCIES = host-autoconf + +define NCFTP_RUN_AUTOCONF + (cd $(@D); $(HOST_DIR)/usr/bin/autoconf -I$(@D)/autoconf_local/) +endef + +NCFTP_PRE_CONFIGURE_HOOKS += NCFTP_RUN_AUTOCONF + ifeq ($(BR2_PACKAGE_NCFTP_GET),y) NCFTP_TARGET_BINS += ncftpget endif
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com
PATCH v2 1/1 ncftp: fix cross-compilation test
Hi Thomas,
Le 18/02/2014 23:59, Thomas Petazzoni a ?crit :
Quoted 31 lines
Dear Romain Naour,
Quoted 9 lines · Romain Naour
The cross-compilation test is based on the ability to run a test program on the host, which is wrong.
If it runs, then the configure script concludes that we're doing native compilation,
if it doesn't run, we're doing cross-compilation.Replace it with a more correct test.
Quoted 7 lines
Fixes
http://autobuild.buildroot.net/results/969/969a49ae97a50634ea846a82b9c360e4fb020ace/build-end.logSigned-off-by Romain Naour <[email protected]>---
v2:
Add a cross-compilation test suggested by Thomas Petazzoni.Can you instead test the following patch:
package/ncftp/ncftp.mk +1
-0@@ -11,6 +11,14 @@ NCFTP_TARGET_BINS = ncftp NCFTP_LICENSE = Clarified Artistic License NCFTP_LICENSE_FILES = doc/LICENSE.txt +NCFTP_DEPENDENCIES = host-autoconf
package/ncftp/ncftp.mk NCFTP_TARGET_BINS = ncftp · line 24
Quoted 10 lines
package/ncftp/ncftp.mk +7
-0+ +define NCFTP_RUN_AUTOCONF + (cd $(@D); $(HOST_DIR)/usr/bin/autoconf -I$(@D)/autoconf_local/) +endef + +NCFTP_PRE_CONFIGURE_HOOKS += NCFTP_RUN_AUTOCONF + ifeq ($(BR2_PACKAGE_NCFTP_GET),y) NCFTP_TARGET_BINS += ncftpget endif
Ok, it works.
The configure script is regenerated correctly.
I had problems using NCFTP_AUTORECONF = YES
what is the difference?
Thank you,
Romain Naour
PATCH v2 1/1 ncftp: fix cross-compilation test
Dear Romain Naour,
Quoted 2 lines · Romain Naour
Ok, it works.
The configure script is regenerated correctly.
Cool. Does it fix the original problem? I only quickly looked at the generated configure script to verify that the cross compiling test is correct, but I did not verify that the original problem was really solved.
Quoted 2 lines
I had problems using
NCFTP_AUTORECONF= YES
what is the difference?
ncftp is not fully autotools based: it uses autoconf, but not automake. And the autoconf invocation needs a special -I path to find the aclocal.m4, since it cannot be re-generated using aclocal, because it uses some funky m4 macros and I have no idea where are the original m4 files with these macros.
Best regards,
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com
PATCH v2 1/1 ncftp: fix cross-compilation test
Hi Thomas,
----- Mail original -----
| De: "Thomas Petazzoni" <[email protected]> | ?: "Romain Naour" <[email protected]> | Cc: buildroot at busybox.net | Envoy?: Mercredi 19 F?vrier 2014 00:28:49 | Objet: Re: [Buildroot] [PATCH v2 1/1] ncftp: fix cross-compilation test | | Dear Romain Naour, | | On Wed, 19 Feb 2014 00:18:42 +0100, Romain Naour wrote: | | > Ok, it works. | > The configure script is regenerated correctly. | | Cool. Does it fix the original problem? I only quickly looked at the | generated configure script to verify that the cross compiling test is | correct, but I did not verify that the original problem was really | solved.
This is what I meant by "it works".
I tested in a Debian chroot where ncurses is not installed. So, the original problem is solved :)
| | > I had problems using NCFTP_AUTORECONF = YES | > what is the difference? | | ncftp is not fully autotools based: it uses autoconf, but not | automake. | And the autoconf invocation needs a special -I path to find the | aclocal.m4, since it cannot be re-generated using aclocal, because it | uses some funky m4 macros and I have no idea where are the original | m4 | files with these macros.
Thanks for your explanations,
I am not yet familiar with autotools but I progress :)
Best regards,
Romain