tech-toolchain archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Cross-building NetBSD-current on Mac OS X 10.5 (Leopard)



The attached, horrible, crufty and utterly uncleaned up diff will
allow NetBSD-current to be cross-built on a Mac OS X Leopard machine
(and, I think, anything with an OLD gcc, but untested on the same).

The symptoms of the problem are that the configuration of mpfr during
the tools build stage will fail because a gmp library with mpz_init in
it cannot be found.  Having talked to Matt Green, he tells me that
this is because the version of libgmp that has just been built is for
64-bit, and a 32-bit tools binary is needed.  The three changes to the
gmp, mpfr and mpc Makefiles do this (very crudely).

After that's been fixed, the version of gcc that was available in the
tools build (i.e.  the native compiler, gcc 4.0.1 in my case) couldn't
handle extern inlines - I changed all occurrences to static inlines. 
Again, very crudely.

These changes were enough to get an amd64 release cross-built on Leopard.

Regards,
Alistair
Index: gmp/Makefile
===================================================================
RCS file: /cvsroot/src/tools/gmp/Makefile,v
retrieving revision 1.1
diff -u -r1.1 Makefile
--- gmp/Makefile        20 Jun 2011 05:56:46 -0000      1.1
+++ gmp/Makefile        15 Aug 2011 23:18:14 -0000
@@ -11,4 +11,4 @@
 # PATH needs special treating since "make" tries to expand $PATH
 # when variable is used.
 CONFIGURE_ENV:=        ${CONFIGURE_ENV:NPATH=*:NCFLAGS=*:NCXXFLAGS=*} \
-               PATH="${TOOLDIR:Q}/bin:$$$$PATH"
+               PATH="${TOOLDIR:Q}/bin:$$$$PATH" ABI=32
Index: mpfr/Makefile
===================================================================
RCS file: /cvsroot/src/tools/mpfr/Makefile,v
retrieving revision 1.1
diff -u -r1.1 Makefile
--- mpfr/Makefile       20 Jun 2011 05:56:45 -0000      1.1
+++ mpfr/Makefile       15 Aug 2011 23:18:14 -0000
@@ -8,3 +8,6 @@
 CONFIGURE_ARGS+=--disable-shared
 
 .include "${.CURDIR}/../Makefile.gnuhost"
+
+CONFIGURE_ENV:=        ${CONFIGURE_ENV:NPATH=*:NCFLAGS=*:NCXXFLAGS=*} \
+               PATH="${TOOLDIR:Q}/bin:$$$$PATH" ABI=32
Index: mpc/Makefile
===================================================================
RCS file: /cvsroot/src/tools/mpc/Makefile,v
retrieving revision 1.1
diff -u -r1.1 Makefile
--- mpc/Makefile        20 Jun 2011 05:56:46 -0000      1.1
+++ mpc/Makefile        15 Aug 2011 23:18:14 -0000
@@ -9,3 +9,6 @@
 CONFIGURE_ARGS+=--disable-shared
 
 .include "${.CURDIR}/../Makefile.gnuhost"
+
+CONFIGURE_ENV:=        ${CONFIGURE_ENV:NPATH=*:NCFLAGS=*:NCXXFLAGS=*} \
+               PATH="${TOOLDIR:Q}/bin:$$$$PATH" ABI=32
Index: gmp-h.in
===================================================================
RCS file: /cvsroot/src/external/lgpl3/gmp/dist/gmp-h.in,v
retrieving revision 1.2
diff -u -r1.2 gmp-h.in
--- gmp-h.in    2 Jul 2011 14:05:03 -0000       1.2
+++ gmp-h.in    15 Aug 2011 15:06:52 -0000
@@ -422,7 +422,8 @@
     inline semantics, unless -fgnu89-inline is used.  */
 #ifdef __GNUC__
 #if (defined __GNUC_STDC_INLINE__) || (__GNUC__ == 4 && __GNUC_MINOR__ == 2)
-#define __GMP_EXTERN_INLINE extern __inline__ __attribute__ ((__gnu_inline__))
+//#define __GMP_EXTERN_INLINE extern __inline__ __attribute__ 
((__gnu_inline__))
+#define __GMP_EXTERN_INLINE      static __inline__
 #else
 #define __GMP_EXTERN_INLINE      extern __inline__
 #endif
@@ -689,7 +690,7 @@
 
 #define mpz_abs __gmpz_abs
 #if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpz_abs)
-__GMP_DECLSPEC void mpz_abs __GMP_PROTO ((mpz_ptr, mpz_srcptr));
+static __GMP_DECLSPEC void mpz_abs __GMP_PROTO ((mpz_ptr, mpz_srcptr));
 #endif
 
 #define mpz_add __gmpz_add
@@ -856,17 +857,17 @@
 
 #define mpz_fits_uint_p __gmpz_fits_uint_p
 #if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpz_fits_uint_p)
-__GMP_DECLSPEC int mpz_fits_uint_p __GMP_PROTO ((mpz_srcptr)) __GMP_NOTHROW 
__GMP_ATTRIBUTE_PURE;
+static __GMP_DECLSPEC int mpz_fits_uint_p __GMP_PROTO ((mpz_srcptr)) 
__GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
 #endif
 
 #define mpz_fits_ulong_p __gmpz_fits_ulong_p
 #if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpz_fits_ulong_p)
-__GMP_DECLSPEC int mpz_fits_ulong_p __GMP_PROTO ((mpz_srcptr)) __GMP_NOTHROW 
__GMP_ATTRIBUTE_PURE;
+static __GMP_DECLSPEC int mpz_fits_ulong_p __GMP_PROTO ((mpz_srcptr)) 
__GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
 #endif
 
 #define mpz_fits_ushort_p __gmpz_fits_ushort_p
 #if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpz_fits_ushort_p)
-__GMP_DECLSPEC int mpz_fits_ushort_p __GMP_PROTO ((mpz_srcptr)) __GMP_NOTHROW 
__GMP_ATTRIBUTE_PURE;
+static __GMP_DECLSPEC int mpz_fits_ushort_p __GMP_PROTO ((mpz_srcptr)) 
__GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
 #endif
 
 #define mpz_gcd __gmpz_gcd
@@ -892,12 +893,12 @@
 
 #define mpz_get_ui __gmpz_get_ui
 #if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpz_get_ui)
-__GMP_DECLSPEC unsigned long int mpz_get_ui __GMP_PROTO ((mpz_srcptr)) 
__GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
+static __GMP_DECLSPEC unsigned long int mpz_get_ui __GMP_PROTO ((mpz_srcptr)) 
__GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
 #endif
 
 #define mpz_getlimbn __gmpz_getlimbn
 #if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpz_getlimbn)
-__GMP_DECLSPEC mp_limb_t mpz_getlimbn __GMP_PROTO ((mpz_srcptr, mp_size_t)) 
__GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
+static __GMP_DECLSPEC mp_limb_t mpz_getlimbn __GMP_PROTO ((mpz_srcptr, 
mp_size_t)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
 #endif
 
 #define mpz_hamdist __gmpz_hamdist
@@ -999,7 +1000,7 @@
 
 #define mpz_neg __gmpz_neg
 #if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpz_neg)
-__GMP_DECLSPEC void mpz_neg __GMP_PROTO ((mpz_ptr, mpz_srcptr));
+static __GMP_DECLSPEC void mpz_neg __GMP_PROTO ((mpz_ptr, mpz_srcptr));
 #endif
 
 #define mpz_nextprime __gmpz_nextprime
@@ -1020,12 +1021,12 @@
 
 #define mpz_perfect_square_p __gmpz_perfect_square_p
 #if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpz_perfect_square_p)
-__GMP_DECLSPEC int mpz_perfect_square_p __GMP_PROTO ((mpz_srcptr)) 
__GMP_ATTRIBUTE_PURE;
+static __GMP_DECLSPEC int mpz_perfect_square_p __GMP_PROTO ((mpz_srcptr)) 
__GMP_ATTRIBUTE_PURE;
 #endif
 
 #define mpz_popcount __gmpz_popcount
 #if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpz_popcount)
-__GMP_DECLSPEC mp_bitcnt_t mpz_popcount __GMP_PROTO ((mpz_srcptr)) 
__GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
+static __GMP_DECLSPEC mp_bitcnt_t mpz_popcount __GMP_PROTO ((mpz_srcptr)) 
__GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
 #endif
 
 #define mpz_pow_ui __gmpz_pow_ui
@@ -1081,7 +1082,7 @@
 
 #define mpz_set_q __gmpz_set_q
 #if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpz_set_q)
-__GMP_DECLSPEC void mpz_set_q __GMP_PROTO ((mpz_ptr, mpq_srcptr));
+static __GMP_DECLSPEC void mpz_set_q __GMP_PROTO ((mpz_ptr, mpq_srcptr));
 #endif
 
 #define mpz_set_si __gmpz_set_si
@@ -1098,7 +1099,7 @@
 
 #define mpz_size __gmpz_size
 #if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpz_size)
-__GMP_DECLSPEC size_t mpz_size __GMP_PROTO ((mpz_srcptr)) __GMP_NOTHROW 
__GMP_ATTRIBUTE_PURE;
+static __GMP_DECLSPEC size_t mpz_size __GMP_PROTO ((mpz_srcptr)) __GMP_NOTHROW 
__GMP_ATTRIBUTE_PURE;
 #endif
 
 #define mpz_sizeinbase __gmpz_sizeinbase
@@ -1176,7 +1177,7 @@
 
 #define mpq_abs __gmpq_abs
 #if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpq_abs)
-__GMP_DECLSPEC void mpq_abs __GMP_PROTO ((mpq_ptr, mpq_srcptr));
+static __GMP_DECLSPEC void mpq_abs __GMP_PROTO ((mpq_ptr, mpq_srcptr));
 #endif
 
 #define mpq_add __gmpq_add
@@ -1243,7 +1244,7 @@
 
 #define mpq_neg __gmpq_neg
 #if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpq_neg)
-__GMP_DECLSPEC void mpq_neg __GMP_PROTO ((mpq_ptr, mpq_srcptr));
+static __GMP_DECLSPEC void mpq_neg __GMP_PROTO ((mpq_ptr, mpq_srcptr));
 #endif
 
 #define mpq_out_str __gmpq_out_str
@@ -1498,12 +1499,12 @@
 
 #define mpn_add __MPN(add)
 #if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpn_add)
-__GMP_DECLSPEC mp_limb_t mpn_add __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, 
mp_srcptr,mp_size_t));
+static __GMP_DECLSPEC mp_limb_t mpn_add __GMP_PROTO ((mp_ptr, mp_srcptr, 
mp_size_t, mp_srcptr,mp_size_t));
 #endif
 
 #define mpn_add_1 __MPN(add_1)
 #if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpn_add_1)
-__GMP_DECLSPEC mp_limb_t mpn_add_1 __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, 
mp_limb_t)) __GMP_NOTHROW;
+static __GMP_DECLSPEC mp_limb_t mpn_add_1 __GMP_PROTO ((mp_ptr, mp_srcptr, 
mp_size_t, mp_limb_t)) __GMP_NOTHROW;
 #endif
 
 #define mpn_add_n __MPN(add_n)
@@ -1514,7 +1515,7 @@
 
 #define mpn_cmp __MPN(cmp)
 #if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpn_cmp)
-__GMP_DECLSPEC int mpn_cmp __GMP_PROTO ((mp_srcptr, mp_srcptr, mp_size_t)) 
__GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
+static __GMP_DECLSPEC int mpn_cmp __GMP_PROTO ((mp_srcptr, mp_srcptr, 
mp_size_t)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
 #endif
 
 #define mpn_divexact_by3(dst,src,size) \
@@ -1573,7 +1574,7 @@
 
 #define mpn_neg __MPN(neg)
 #if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpn_neg)
-__GMP_DECLSPEC mp_limb_t mpn_neg __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t));
+static __GMP_DECLSPEC mp_limb_t mpn_neg __GMP_PROTO ((mp_ptr, mp_srcptr, 
mp_size_t));
 #endif
 
 #define mpn_com __MPN(com)
@@ -1620,12 +1621,12 @@
 
 #define mpn_sub __MPN(sub)
 #if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpn_sub)
-__GMP_DECLSPEC mp_limb_t mpn_sub __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, 
mp_srcptr,mp_size_t));
+static __GMP_DECLSPEC mp_limb_t mpn_sub __GMP_PROTO ((mp_ptr, mp_srcptr, 
mp_size_t, mp_srcptr,mp_size_t));
 #endif
 
 #define mpn_sub_1 __MPN(sub_1)
 #if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpn_sub_1)
-__GMP_DECLSPEC mp_limb_t mpn_sub_1 __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, 
mp_limb_t)) __GMP_NOTHROW;
+static __GMP_DECLSPEC mp_limb_t mpn_sub_1 __GMP_PROTO ((mp_ptr, mp_srcptr, 
mp_size_t, mp_limb_t)) __GMP_NOTHROW;
 #endif
 
 #define mpn_sub_n __MPN(sub_n)


Home | Main Index | Thread Index | Old Index