Patchwork Fix crosstool-ng build when local system has libgmp already installed

login
register
mail settings
Submitter Solomon Peachy
Date July 11, 2013, 3:46 a.m.
Message ID <20130711034602.GA12049@shaftnet.org>
Download mbox | patch
Permalink /patch/258298/
State Changes Requested
Headers show

Comments

Solomon Peachy - July 11, 2013, 3:46 a.m.
Basically, the ppl configure script wasn't properly setting 
CFLAGS/CXXFLAGS/LDFLAGS to point at the ctng-built gmp, so ppl tried to 
use the system gmp headers instead.

This patch fixes that.

Ideally ct-ng would have the option of just using the local system's gmp 
package, but this patch allows ct-ng to build toolchains on Fedora 19, 
for example.

The patch is against ct-ng 0.16.0, but it is still relevant for 0.18.0.

 - Solomon
Yann E. MORIN - July 15, 2013, 9:02 p.m.
Solomon, All,

On 2013-07-10 23:46 -0400, Solomon Peachy spake thusly:
> Basically, the ppl configure script wasn't properly setting 
> CFLAGS/CXXFLAGS/LDFLAGS to point at the ctng-built gmp, so ppl tried to 
> use the system gmp headers instead.
> 
> This patch fixes that.

He! Good catch!

> Ideally ct-ng would have the option of just using the local system's gmp 
> package, but this patch allows ct-ng to build toolchains on Fedora 19, 
> for example.

Yes, I was planning on adding such support. But that's not so easy, and
we still need to build the companion libs for older systems, or even
recent system that are not completely up-to-date.

> The patch is against ct-ng 0.16.0, but it is still relevant for 0.18.0.

The patch is missing your Signed-off-by line. Care to add it and resend,
please?

> From c0974e2b880901f74fce7415bde265380f5fba50 Mon Sep 17 00:00:00 2001
> From: Solomon Peachy <pizza@shaftnet.org>
> Date: Wed, 10 Jul 2013 23:39:19 -0400
> Subject: [PATCH] [toolchain]  Fix compile on distros that include a local
>  'gmp'
> 
> ---
>  .../ppl/0.11.2/200-fix-build-with-local-gmp.patch  | 24 ++++++++++++++++++++++

May it also be applied to other versions of PPL? If so, can you add
those patches too and resubmit, please?

Regards,
Yann E. MORIN.
Solomon Peachy - July 15, 2013, 10:55 p.m.
On Mon, Jul 15, 2013 at 11:02:34PM +0200, Yann E. MORIN wrote:
> > The patch is against ct-ng 0.16.0, but it is still relevant for 0.18.0.
> 
> The patch is missing your Signed-off-by line. Care to add it and resend,
> please?

Sure, no problem.
 
> May it also be applied to other versions of PPL? If so, can you add
> those patches too and resubmit, please?

It looks like it applies to older versions of PPL too, It doesn't seem 
to be relevant to PPL >= 0.12, not that ct-ng supports that anyway..

I'll poste a new patch, this time against hg-HEAD, and try to 
include a patch for all PPL versions we support.

 - Solomon

Patch

diff --git a/crosstool-ng-1.16.0/patches/ppl/0.11.2/200-fix-build-with-local-gmp.patch b/crosstool-ng-1.16.0/patches/ppl/0.11.2/200-fix-build-with-local-gmp.patch
new file mode 100644
index 0000000..a4bb9f1
--- /dev/null
+++ b/crosstool-ng-1.16.0/patches/ppl/0.11.2/200-fix-build-with-local-gmp.patch
@@ -0,0 +1,24 @@ 
+--- a/m4/ac_check_gmp.m4~	2011-02-27 04:07:47.000000000 -0500
++++ b/m4/ac_check_gmp.m4	2013-07-10 19:57:35.894457259 -0400
+@@ -32,6 +32,9 @@
+     with_libgmpxx_prefix="$with_libgmp_prefix"
+   fi
+ fi
++CPPFLAGS="$CPPFLAGS -I$with_libgmp_prefix/include"
++CXXFLAGS="$CXXFLAGS -I$with_libgmpxx_prefix/include"
++LDFLAGS="$CPPFLAGS -L$with_libgmpxx_prefix/lib -L$with_libgmp_prefix/lib"
+ 
+ AC_ARG_WITH(gmp-build,
+   AS_HELP_STRING([--with-gmp-build=DIR],
+--- a/configure~	2011-02-27 04:07:47.000000000 -0500
++++ b/configure		2013-07-10 19:57:35.894457259 -0400
+@@ -10217,6 +10217,9 @@
+     with_libgmpxx_prefix="$with_libgmp_prefix"
+   fi
+ fi
++CPPFLAGS="$CPPFLAGS -I$with_libgmp_prefix/include"
++CXXFLAGS="$CXXFLAGS -I$with_libgmpxx_prefix/include"
++LDFLAGS="$CPPFLAGS -L$with_libgmpxx_prefix/lib -L$with_libgmp_prefix/lib"
+ 
+ 
+ # Check whether --with-gmp-build was given.