cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: fat binary for Mac OSX 10.5.X

From: john blair <mailtome200420032002_at_yahoo.com>
Date: Thu, 30 Apr 2009 16:12:55 -0700 (PDT)

Thanks Yang, and Toby. Both methods work fine.
I ended up using the single pass method. I had to do the following changes:
Changed the contents of include/curl/curlbuild.h to
#ifdef __LP64__
#include "curlbuild64.h"
#else
#include "curlbuild32.h"
#endif

where curlbuild64.h and curlbuild32.h were created by running configure separately for x86_64 and i386 architecture. Also, applied the following patch:
diff -Naur curl-7.19.4-old/lib/config.h curl-7.19.4/lib/config.h
--- curl-7.19.4-old/lib/config.h 2009-04-30 15:37:28.000000000 -0700
+++ curl-7.19.4/lib/config.h 2009-04-30 15:20:10.000000000 -0700
@@ -848,19 +848,35 @@
 #define SIZEOF_INT 4

 /* The size of `long', as computed by sizeof. */
+#ifdef __LP64__
 #define SIZEOF_LONG 8
+#else /* !__LP64__ */
+#define SIZEOF_LONG 4
+#endif /* __LP64__ */

 /* The size of `off_t', as computed by sizeof. */
 #define SIZEOF_OFF_T 8

 /* The size of `size_t', as computed by sizeof. */
+#ifdef __LP64__
 #define SIZEOF_SIZE_T 8
+#else /* !__LP64__ */
+#define SIZEOF_SIZE_T 4
+#endif /* __LP64__ */

 /* The size of `time_t', as computed by sizeof. */
+#ifdef __LP64__
 #define SIZEOF_TIME_T 8
+#else /* !__LP64__ */
+#define SIZEOF_TIME_T 4
+#endif /* __LP64__ */

 /* The size of `void*', as computed by sizeof. */
+#ifdef __LP64__
 #define SIZEOF_VOIDP 8
+#else /* !__LP64__ */
+#define SIZEOF_VOIDP 4
+#endif /* __LP64__ */

 /* Define to 1 if you have the ANSI C header files. */
 #define STDC_HEADERS 1
diff -Naur curl-7.19.4-old/src/config.h curl-7.19.4/src/config.h
--- curl-7.19.4-old/src/config.h 2009-04-30 15:37:18.000000000 -0700
+++ curl-7.19.4/src/config.h 2009-04-30 15:19:58.000000000 -0700
@@ -848,19 +848,39 @@
 #define SIZEOF_INT 4

 /* The size of `long', as computed by sizeof. */
+#ifdef __LP64__
 #define SIZEOF_LONG 8
+#else /* !__LP64__ */
+#define SIZEOF_LONG 4
+#endif /* __LP64__ */
+

 /* The size of `off_t', as computed by sizeof. */
 #define SIZEOF_OFF_T 8

 /* The size of `size_t', as computed by sizeof. */
+#ifdef __LP64__
 #define SIZEOF_SIZE_T 8
+#else /* !__LP64__ */
+#define SIZEOF_SIZE_T 4
+#endif /* __LP64__ */
+

 /* The size of `time_t', as computed by sizeof. */
+#ifdef __LP64__
 #define SIZEOF_TIME_T 8
+#else /* !__LP64__ */
+#define SIZEOF_TIME_T 4
+#endif /* __LP64__ */
+

 /* The size of `void*', as computed by sizeof. */
+#ifdef __LP64__
 #define SIZEOF_VOIDP 8
+#else /* !__LP64__ */
+#define SIZEOF_VOIDP 4
+#endif /* __LP64__ */
+

 /* Define to 1 if you have the ANSI C header files. */
 #define STDC_HEADERS 1

--- On Fri, 5/1/09, Toby Peterson <toby_at_apple.com> wrote:

> From: Toby Peterson <toby_at_apple.com>
> Subject: Re: fat binary for Mac OSX 10.5.X
> To: mailtome200420032002_at_yahoo.com, "libcurl development" <curl-library_at_cool.haxx.se>
> Date: Friday, May 1, 2009, 2:19 AM
> On Apr 30, 2009, at 11:44 AM, john blair wrote:
>
> > I am trying to build a fat binary(for i386 and x86_64)
> for curl-7.19.4. I tried building it with
> > --disable-dependency-tracking \
> > CFLAGS="-arch i386 -arch x86_64" \
> > LDFLAGS="-arch i386 -arch x86_64"
> >
> > but got
> > ../include/curl/curlrules.h:134: error: size of array
> ‘__curl_rule_01__’ is negative
> >
> >
> > I have successfully built a fat binary for curl
> 7.18.2. Has any one tried building it with 7.19.4?
>
> If you're trying to do a single-pass universal build,
> you need to edit the following files:
>
> include/curl/curlbuild.h
> lib/config.h
> src/config.h
>
> Fix the following defines and it should work correctly:
>
> CURL_SIZEOF_LONG
> SIZEOF_LONG
> SIZEOF_SIZE_T
> SIZEOF_TIME_T
> SIZEOF_VOID_P
>
> If you want to see why this is necessary, just run the
> configure script for each individual arch and compare the
> results.
>
> Not sure why it worked for you on 7.18.4. If I had to
> guess, I'd think that a newer macro is generating that
> error in 7.19.x, but your 7.18.4 build was still broken (for
> one architecture or the other, depending on the answers the
> configure script got).
>
> - Toby

      
Received on 2009-05-01