Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH v2 1/1] ncftp: fix cross-compilation test
@ 2014-02-18 22:31 Romain Naour
  2014-02-18 22:59 ` Thomas Petazzoni
  0 siblings, 1 reply; 5+ messages in thread
From: Romain Naour @ 2014-02-18 22:31 UTC (permalink / raw)
  To: buildroot

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

Signed-off-by: Romain Naour <romain.naour@openwide.fr>
---
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

diff --git a/package/ncftp/ncftp-0001-fix-cross-compilation-test.patch b/package/ncftp/ncftp-0001-fix-cross-compilation-test.patch
new file mode 100644
index 0000000..f92cce9
--- /dev/null
+++ b/package/ncftp/ncftp-0001-fix-cross-compilation-test.patch
@@ -0,0 +1,51 @@
+From 39396048bee3db9a29ec909aece1bdc6e6880e91 Mon Sep 17 00:00:00 2001
+From: Romain Naour <romain.naour@openwide.fr>
+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 <romain.naour@openwide.fr>
+---
+ 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
+
-- 
1.8.5.3

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [Buildroot] [PATCH v2 1/1] ncftp: fix cross-compilation test
  2014-02-18 22:31 [Buildroot] [PATCH v2 1/1] ncftp: fix cross-compilation test Romain Naour
@ 2014-02-18 22:59 ` Thomas Petazzoni
  2014-02-18 23:18   ` Romain Naour
  0 siblings, 1 reply; 5+ messages in thread
From: Thomas Petazzoni @ 2014-02-18 22:59 UTC (permalink / raw)
  To: buildroot

Dear Romain Naour,

On Tue, 18 Feb 2014 23:31:52 +0100, Romain Naour wrote:
> 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
> 
> Signed-off-by: Romain Naour <romain.naour@openwide.fr>
> ---
> v2:
> Add a cross-compilation test suggested by Thomas Petazzoni.

Can you instead test the following patch:

diff --git a/package/ncftp/ncftp.mk b/package/ncftp/ncftp.mk
index ff6c70a..c9068b7 100644
--- a/package/ncftp/ncftp.mk
+++ b/package/ncftp/ncftp.mk
@@ -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

-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [Buildroot] [PATCH v2 1/1] ncftp: fix cross-compilation test
  2014-02-18 22:59 ` Thomas Petazzoni
@ 2014-02-18 23:18   ` Romain Naour
  2014-02-18 23:28     ` Thomas Petazzoni
  0 siblings, 1 reply; 5+ messages in thread
From: Romain Naour @ 2014-02-18 23:18 UTC (permalink / raw)
  To: buildroot

Hi Thomas,

Le 18/02/2014 23:59, Thomas Petazzoni a ?crit :
> Dear Romain Naour,
>
> On Tue, 18 Feb 2014 23:31:52 +0100, Romain Naour wrote:
>> 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
>>
>> Signed-off-by: Romain Naour <romain.naour@openwide.fr>
>> ---
>> v2:
>> Add a cross-compilation test suggested by Thomas Petazzoni.
> Can you instead test the following patch:
>
> diff --git a/package/ncftp/ncftp.mk b/package/ncftp/ncftp.mk
> index ff6c70a..c9068b7 100644
> --- a/package/ncftp/ncftp.mk
> +++ b/package/ncftp/ncftp.mk
> @@ -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
>
Ok, it works.
The configure script is regenerated correctly.

I had problems using NCFTP_AUTORECONF = YES
what is the difference?

Thank you,
Romain Naour

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Buildroot] [PATCH v2 1/1] ncftp: fix cross-compilation test
  2014-02-18 23:18   ` Romain Naour
@ 2014-02-18 23:28     ` Thomas Petazzoni
  2014-02-19 12:10       ` Romain Naour
  0 siblings, 1 reply; 5+ messages in thread
From: Thomas Petazzoni @ 2014-02-18 23:28 UTC (permalink / raw)
  To: buildroot

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.

> 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
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Buildroot] [PATCH v2 1/1] ncftp: fix cross-compilation test
  2014-02-18 23:28     ` Thomas Petazzoni
@ 2014-02-19 12:10       ` Romain Naour
  0 siblings, 0 replies; 5+ messages in thread
From: Romain Naour @ 2014-02-19 12:10 UTC (permalink / raw)
  To: buildroot

Hi Thomas,

----- Mail original -----
| De: "Thomas Petazzoni" <thomas.petazzoni@free-electrons.com>
| ?: "Romain Naour" <romain.naour@openwide.fr>
| 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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-02-19 12:10 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-02-18 22:31 [Buildroot] [PATCH v2 1/1] ncftp: fix cross-compilation test Romain Naour
2014-02-18 22:59 ` Thomas Petazzoni
2014-02-18 23:18   ` Romain Naour
2014-02-18 23:28     ` Thomas Petazzoni
2014-02-19 12:10       ` Romain Naour

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox