building freetype 2.3.11 on Mac OS X 10.6

View: New views
15 Messages — Rating Filter:   Alert me  

building freetype 2.3.11 on Mac OS X 10.6

by Sean McBride :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi all,

I just got around to trying 2.3.11 on 10.6, like so:

export CC=/Developer/usr/bin/clang
export CXX=/Developer/usr/bin/llvm-gcc-4.2
export CFLAGS="-Wall -Wextra -arch i386"
export CXXFLAGS="-Wall -Wextra -arch i386"

There are many messages like this:

ld: warning: in /Users/sean/Downloads/freetype-2.3.11/objs/.libs/
ftsystem.o, file is not of required architecture

If I instead use -arch x86_64 those warnings do not appear.  I suspect
that something is assuming architectures or something is not passing my
arch flag to something else.  Note that on 10.5 the compiler defaults to
i386 (32 bit) but on 10.6 it defaults to x86_64 (64 bit).

Other than that, there is only one compiler warning:

/Users/sean/Downloads/freetype-2.3.11/src/tools/apinames.c:268:39:
warning: field precision should have type 'int', but argument has type 'long'
      [-Wformat]
              fprintf( stderr, ">>> %.*s\n", p-name, name );
                                      ^      ~~~~~~
This surprised me, but the 'printf' man page does say that '*' expects
an int.  It doesn't seem likely that p-name would overflow an int, so I
guess a cast would be ok.

Cheers,

--
____________________________________________________________
Sean McBride, B. Eng                 sean@...
Rogue Research                        www.rogue-research.com
Mac Software Developer              Montréal, Québec, Canada




_______________________________________________
Freetype-devel mailing list
Freetype-devel@...
http://lists.nongnu.org/mailman/listinfo/freetype-devel

Re: building freetype 2.3.11 on Mac OS X 10.6

by Werner LEMBERG :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> [...], there is only one compiler warning:
>
> /Users/sean/Downloads/freetype-2.3.11/src/tools/apinames.c:268:39:
> warning: field precision should have type 'int', but argument has type 'long'
>       [-Wformat]
>               fprintf( stderr, ">>> %.*s\n", p-name, name );
>                                       ^      ~~~~~~
> This surprised me, but the 'printf' man page does say that '*'
> expects an int.  It doesn't seem likely that p-name would overflow
> an int, so I guess a cast would be ok.

Fixed in git, thanks.  Please test.


    Werner


_______________________________________________
Freetype-devel mailing list
Freetype-devel@...
http://lists.nongnu.org/mailman/listinfo/freetype-devel

Re: building freetype 2.3.11 on Mac OS X 10.6

by Sean McBride :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 11/4/09 12:19 PM, Werner LEMBERG said:

>> [...], there is only one compiler warning:
>>
>> /Users/sean/Downloads/freetype-2.3.11/src/tools/apinames.c:268:39:
>> warning: field precision should have type 'int', but argument has type
>'long'
>>       [-Wformat]
>>               fprintf( stderr, ">>> %.*s\n", p-name, name );
>>                                       ^      ~~~~~~
>> This surprised me, but the 'printf' man page does say that '*'
>> expects an int.  It doesn't seem likely that p-name would overflow
>> an int, so I guess a cast would be ok.
>
>Fixed in git, thanks.  Please test.

Thanks.

Did you also fix the "file is not of required architecture" message?
This is the more important one really.

Cheers,

--
____________________________________________________________
Sean McBride, B. Eng                 sean@...
Rogue Research                        www.rogue-research.com
Mac Software Developer              Montréal, Québec, Canada




_______________________________________________
Freetype-devel mailing list
Freetype-devel@...
http://lists.nongnu.org/mailman/listinfo/freetype-devel

Re: building freetype 2.3.11 on Mac OS X 10.6

by Werner LEMBERG :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> Did you also fix the "file is not of required architecture" message?
> This is the more important one really.

No.  Honestly, I don't think that this is a bug, but this is an
educated guess only since I've never worked with a Mac.  I rather
believe this is a problem with the `configure' script, passing wrong
or missing arguments to select the proper architecture.  Maybe it is
sufficient to use a recent development versions of `libtool', for
example.

Suzuki-san, can you comment?


    Werner


_______________________________________________
Freetype-devel mailing list
Freetype-devel@...
http://lists.nongnu.org/mailman/listinfo/freetype-devel

Re: building freetype 2.3.11 on Mac OS X 10.6

by Sean McBride :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 11/4/09 3:44 PM, Werner LEMBERG said:

>> Did you also fix the "file is not of required architecture" message?
>> This is the more important one really.
>
>No.  Honestly, I don't think that this is a bug, but this is an
>educated guess only since I've never worked with a Mac.  I rather
>believe this is a problem with the `configure' script, passing wrong
>or missing arguments to select the proper architecture.

I agree it is probably an issue with the 'configure' script.  Alas, I
know nothing about 'configure' scripts.

Cheers,

--
____________________________________________________________
Sean McBride, B. Eng                 sean@...
Rogue Research                        www.rogue-research.com
Mac Software Developer              Montréal, Québec, Canada




_______________________________________________
Freetype-devel mailing list
Freetype-devel@...
http://lists.nongnu.org/mailman/listinfo/freetype-devel

Re: building freetype 2.3.11 on Mac OS X 10.6

by mpsuzuki :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

I'm sorry, yet I have no access to Mac OS X 10.6 machines
and I could not reproduce the trouble at once.

Could you send me config.log, config.status, and the messages
you got in building (something like a file logged by
"make 2>&1 | tee make.log" )?

Regards,
mpsuzuki


_______________________________________________
Freetype-devel mailing list
Freetype-devel@...
http://lists.nongnu.org/mailman/listinfo/freetype-devel

Re: building freetype 2.3.11 on Mac OS X 10.6

by Sean McBride :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 11/5/09 10:26 AM, mpsuzuki@... said:

>I'm sorry, yet I have no access to Mac OS X 10.6 machines
>and I could not reproduce the trouble at once.
>
>Could you send me config.log, config.status, and the messages
>you got in building (something like a file logged by
>"make 2>&1 | tee make.log" )?

Attached are the 3 files you requested.  Please let me know if I can
help further.

Cheers,

--
____________________________________________________________
Sean McBride, B. Eng                 sean@...
Rogue Research                        www.rogue-research.com
Mac Software Developer              Montréal, Québec, Canada


_______________________________________________
Freetype-devel mailing list
Freetype-devel@...
http://lists.nongnu.org/mailman/listinfo/freetype-devel

Archive.zip (35K) Download Attachment

Parent Message unknown Re: building freetype 2.3.11 on Mac OS X 10.6

by Rowan Wookey :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Try adding the arch flag to LDFLAGS that worked for me.

~Rowan


_______________________________________________
Freetype-devel mailing list
Freetype-devel@...
http://lists.nongnu.org/mailman/listinfo/freetype-devel

Re: building freetype 2.3.11 on Mac OS X 10.6

by mpsuzuki :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

Thank you for helpful information. I will propose
improved configure script in next week...

Regards,
mpsuzuki

On Fri, 13 Nov 2009 08:16:03 +1300
Rowan Wookey <admin@...> wrote:

>
>Try adding the arch flag to LDFLAGS that worked for me.
>
>~Rowan
>
>
>_______________________________________________
>Freetype-devel mailing list
>Freetype-devel@...
>http://lists.nongnu.org/mailman/listinfo/freetype-devel


_______________________________________________
Freetype-devel mailing list
Freetype-devel@...
http://lists.nongnu.org/mailman/listinfo/freetype-devel

Re: building freetype 2.3.11 on Mac OS X 10.6

by mpsuzuki :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

Sorry for my lated homework. Attached is a proposal of
patch for Mac OS X 10.6. The patch itself is not easy
to read. The patched script would be like following.
It scans all token in CFLAGS, lookup -isysroot, -arch,
-m32 and -m64. If they are not included in LDFLAGS
(for -isysroot and -arch, arguments are also checked),
they are copied to LDFLAGS.

    # Some options handling SDKs/archs in CFLAGS should be copied
    # to LDFLAGS. Apple TechNote 2137 recommends to include these
    # options in CFLAGS but not in LDFLAGS.

    set dummy ${CFLAGS}
    i=1
    while test $i -lt $#
    do
      c=$1
   
      case "${c}" in
      -isysroot|-arch) # options taking 1 argument
        a=$2
        AC_MSG_CHECKING([whether CFLAGS and LDFLAGS share ${c} ${a}])
        if expr " ${LDFLAGS} " : ".* ${c} *${a}.*" > /dev/null
        then
          AC_MSG_RESULT([yes])
        else
          AC_MSG_RESULT([no, copy to LDFLAGS])
          LDFLAGS="${LDFLAGS} ${c} ${a}"
        fi
        shift 1
        ;;
      -m32|-m64) # options taking no argument
        AC_MSG_RESULT([whether CFLAGS and LDFLAGS share ${c}])
        if expr " ${LDFLAGS} " : ".* ${c} *${a}.*" > /dev/null
        then
          AC_MSG_RESULT([yes])
        else
          AC_MSG_RESULT([no, copy to LDFLAGS])
          LDFLAGS="${LDFLAGS} ${c}"
        fi
        ;;
      # *)
      #   AC_MSG_RESULT([${c} is not copied to LDFLAGS])
      #   ;;  
      esac
   
      shift 1
    done

At present, I didn't restrict this hook to specific
system. If it's better to restrict this hook to Mac OS X,
please let me know. I'm not sure if there is special
requirement to use different "-arch XXX" or "-m32/-m64"
options between CFLAGS & LDFLAGS.

Sean, could you review the patch? Yet I don't have access
to Mac OS X 10.6 machines, so I cannot check if this patch
solves the problem you reported.

Regards,
mpsuzuki


diff --git a/builds/unix/configure.raw b/builds/unix/configure.raw
index 8a99988..4ecd619 100644
--- a/builds/unix/configure.raw
+++ b/builds/unix/configure.raw
@@ -230,30 +230,48 @@ if test x$with_zlib != xno && test -n "$LIBZ"; then
 fi
 
 
-# check Apple's `-isysroot' option and duplicate it to LDFLAGS if required --
-# Apple TechNote 2137 recommends to include it in CFLAGS but not in LDFLAGS
-
-AC_MSG_CHECKING([whether CFLAGS includes -isysroot option])
-case "$CFLAGS" in
-*sysroot* )
-  AC_MSG_RESULT([yes])
-  AC_MSG_CHECKING([whether LDFLAGS includes -isysroot option])
-  case "$LDFLAGS" in
-  *sysroot* )
-    AC_MSG_RESULT([yes])
+# Some options handling SDKs/archs in CFLAGS should be copied
+# to LDFLAGS. Apple TechNote 2137 recommends to include these
+# options in CFLAGS but not in LDFLAGS.
+
+save_config_args=$*
+set dummy ${CFLAGS}
+i=1
+while test $i -lt $#
+do
+  c=$1
+
+  case "${c}" in
+  -isysroot|-arch) # options taking 1 argument
+    a=$2
+    AC_MSG_CHECKING([whether CFLAGS and LDFLAGS share ${c} ${a}])
+    if expr " ${LDFLAGS} " : ".* ${c} *${a}.*" > /dev/null
+    then
+      AC_MSG_RESULT([yes])
+    else
+      AC_MSG_RESULT([no, copy to LDFLAGS])
+      LDFLAGS="${LDFLAGS} ${c} ${a}"
+    fi
+    shift 1
     ;;
-  *)
-    AC_MSG_RESULT([no])
-    isysroot_dir=`echo ${CFLAGS} | tr '\t' ' ' | sed 's/^.*-isysroot *//;s/ .*//'`
-    AC_MSG_WARN(-isysroot ${isysroot_dir} is added to LDFLAGS)
-    LDFLAGS="-isysroot ${isysroot_dir} ${LDFLAGS}"
+  -m32|-m64) # options taking no argument
+    AC_MSG_RESULT([whether CFLAGS and LDFLAGS share ${c}])
+    if expr " ${LDFLAGS} " : ".* ${c} *${a}.*" > /dev/null
+    then
+      AC_MSG_RESULT([yes])
+    else
+      AC_MSG_RESULT([no, copy to LDFLAGS])
+      LDFLAGS="${LDFLAGS} ${c}"
+    fi
     ;;
+  # *)
+  #   AC_MSG_RESULT([${c} is not copied to LDFLAGS])
+  #   ;;
   esac
-  ;;
-*)
-  AC_MSG_RESULT([no])
-  ;;
-esac
+
+  shift 1
+done
+set ${save_config_args}
 
 
 # Whether to use Mac OS resource-based fonts.


_______________________________________________
Freetype-devel mailing list
Freetype-devel@...
http://lists.nongnu.org/mailman/listinfo/freetype-devel

Re: building freetype 2.3.11 on Mac OS X 10.6

by Werner LEMBERG :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> Attached is a proposal of patch for Mac OS X 10.6.

If you think this is the right way to go please commit.


    Werner


_______________________________________________
Freetype-devel mailing list
Freetype-devel@...
http://lists.nongnu.org/mailman/listinfo/freetype-devel

Re: building freetype 2.3.11 on Mac OS X 10.6

by Sean McBride :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 11/18/09 7:00 PM, mpsuzuki@... said:

>I'm not sure if there is special
>requirement to use different "-arch XXX" or "-m32/-m64"
>options between CFLAGS & LDFLAGS.
>
>Sean, could you review the patch? Yet I don't have access
>to Mac OS X 10.6 machines, so I cannot check if this patch
>solves the problem you reported.

Sorry for the delayed reply.

I don't know anything about autoconf/automake or even shell script, so
I'm not too sure. :(

But I do know that -m32 and -m64 are not used on OS X.  It's really just
-arch that controls that.

Thanks,

--
____________________________________________________________
Sean McBride, B. Eng                 sean@...
Rogue Research                        www.rogue-research.com
Mac Software Developer              Montréal, Québec, Canada




_______________________________________________
Freetype-devel mailing list
Freetype-devel@...
http://lists.nongnu.org/mailman/listinfo/freetype-devel

Re: building freetype 2.3.11 on Mac OS X 10.6

by Rowan Wookey :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I can confirm this works.

I configured as if building for OS X 10.5 as 32 bit, on  OS X 10.6 with the default compiler setting at 64 bit.

Here is the new output in the configure script

checking whether CFLAGS and LDFLAGS share -arch i386... no, copy to LDFLAGS
checking whether CFLAGS and LDFLAGS share -isysroot /Developer/SDKs/MacOSX10.5.sdk... no, copy to LDFLAGS

A few notes
1) I had to edit autogen.sh to allow autoconf 2.61 and aclocal 1.10 which are the versions supplied with OS X 10.6
2) The patch looks like it has been word wrapped on line 47 to have " .*//'`" (without quotes) just move this up to line 46 preserving the space at the beginning so line 46 should be:
-    isysroot_dir=`echo ${CFLAGS} | tr '\t' ' ' | sed 's/^.*-isysroot *//;s/ .*//'`
3)My CFLAGS were set to CFLAGS="-arch i386 -pipe -Os -isysroot /Developer/SDKs/MacOSX10.5.sdk -mmacosx-version-min=10.5"
4) file libfreetype.6.dylib outputs : "libfreetype.6.dylib: Mach-O dynamically linked shared library i386" which is correct.
5) I used the latest development version from git.

Regards

Rowan

On 26 Nov 2009, at 13:26, Sean McBride wrote:

> On 11/18/09 7:00 PM, mpsuzuki@... said:
>
>> I'm not sure if there is special
>> requirement to use different "-arch XXX" or "-m32/-m64"
>> options between CFLAGS & LDFLAGS.
>>
>> Sean, could you review the patch? Yet I don't have access
>> to Mac OS X 10.6 machines, so I cannot check if this patch
>> solves the problem you reported.
>
> Sorry for the delayed reply.
>
> I don't know anything about autoconf/automake or even shell script, so
> I'm not too sure. :(
>
> But I do know that -m32 and -m64 are not used on OS X.  It's really just
> -arch that controls that.
>
> Thanks,
>
> --
> ____________________________________________________________
> Sean McBride, B. Eng                 sean@...
> Rogue Research                        www.rogue-research.com
> Mac Software Developer              Montréal, Québec, Canada
>
>



_______________________________________________
Freetype-devel mailing list
Freetype-devel@...
http://lists.nongnu.org/mailman/listinfo/freetype-devel

Re: building freetype 2.3.11 on Mac OS X 10.6

by mpsuzuki :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Dear Rowan,

Great Thank you for spending time to confirm!

On Thu, 26 Nov 2009 15:04:26 +1300
Rowan Wookey <admin@...> wrote:
>Here is the new output in the configure script
>
>checking whether CFLAGS and LDFLAGS share -arch i386... no, copy to LDFLAGS
>checking whether CFLAGS and LDFLAGS share -isysroot /Developer/SDKs/MacOSX10.5.sdk... no, copy to LDFLAGS

Good, it's what I designed.

>2) The patch looks like it has been word wrapped on line 47 to have " .*//'`" (without quotes) just move this up to line 46 preserving the space at the beginning so line 46 should be:
>-    isysroot_dir=`echo ${CFLAGS} | tr '\t' ' ' | sed 's/^.*-isysroot *//;s/ .*//'`

Oops, I should not put the patch in the text
which can be folded by some MUA. I'm sorry
for troubling you.

Regards,
mpsuzuki


_______________________________________________
Freetype-devel mailing list
Freetype-devel@...
http://lists.nongnu.org/mailman/listinfo/freetype-devel

Re: building freetype 2.3.11 on Mac OS X 10.6

by mpsuzuki :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Wed, 25 Nov 2009 19:26:05 -0500
"Sean McBride" <sean@...> wrote:
>On 11/18/09 7:00 PM, mpsuzuki@... said:
>>Sean, could you review the patch? Yet I don't have access
>>to Mac OS X 10.6 machines, so I cannot check if this patch
>>solves the problem you reported.

>I don't know anything about autoconf/automake or even shell script, so
>I'm not too sure. :(

Oh, I'm sorry. I uploaded a tarball with improved configure at

  http://home.hiroshima-u.ac.jp/mpsuzuki/freetype2-20091126_macslfix.tar.gz 

  * it digs "freetype2" directory. please be careful not
  * to overwrite your existing "freetype2" directory.

Please test it.

Regards,
mpsuzuki


_______________________________________________
Freetype-devel mailing list
Freetype-devel@...
http://lists.nongnu.org/mailman/listinfo/freetype-devel