[mercury-users] Problem building on Mac OS X / Xcode 4 / clang

Sean Johnson sean at snootymonkey.com
Wed May 23 02:58:58 AEST 2012


Julien,

Thanks for the quick fix on this. I'm having trouble applying the patch though. I tried applying it to 1.0.17.1 and to the rotd for 2012-05-21 and neither would go. 

The change is small enough just patched 1.0.17.1 by hand and the new build attempt is running now. But just so I know, what version was the patch meant to work on?

Cheers,
Sean

On May 22, 2012, at 11:10 AM, Julien Fischer wrote:

> 
> On Tue, 22 May 2012, Julien Fischer wrote:
> 
>>> 	Without parallel, the make completed. The make install then failed with:
>>> /Users/sean/build/mercury-compiler-11.07.1/install_grade_dir.hlc.par.gc/scripts/mgnuc --grade hlc.par.gc      --c-debug --no-ansi   --       -c mercury.c -o mercury.o
>>> /Users/sean/build/mercury-compiler-11.07.1/install_grade_dir.hlc.par.gc/scripts/mgnuc --grade hlc.par.gc      --c-debug --no-ansi   --       -c mercury_accurate_gc.c -o mercury_accurate_gc.o
>>> In file included from mercury_accurate_gc.c:42:
>>> In file included from ./mercury_imp.h:62:
>>> ./mercury_engine.h:465:12: error: thread-local storage is unsupported for the current target
>>>   extern __thread MercuryEngine *MR_thread_engine_base;
>>>          ^
>> 
>> It appears that clang does not support GCC's __thread extension on Mac
>> OS X (or more specifically on platforms that don't use ELF).
>> Annoyingly, the configure script's test for this feature passes even
>> though it doesn't appear to work with clang.  I think I have a fix for
>> this one - I will test it and get back to you.
> 
> The following patch to the configure script should fix the above -- I
> haven't been able to test it on Mac OS 10.7 however and the problem
> doesn't appear to show up with versions before that.
> 
> Julien.
> 
> Index: configure.in
> ===================================================================
> RCS file: /home/mercury/mercury1/repository/mercury/configure.in,v
> retrieving revision 1.614
> diff -u -r1.614 configure.in
> --- configure.in	19 May 2012 13:24:32 -0000	1.614
> +++ configure.in	22 May 2012 15:06:56 -0000
> @@ -3141,8 +3141,18 @@
>     case "$host" in
>         *-solaris2.*)
>             ;;
> +        *apple*darwin*)
> +            # XXX only attempt to use __thread with GCC on Mac OS X.
> +            # clang does not support it, although the above test "passes"
> +            # with some versions of clang.
> +            case "$C_COMPILER_TYPE" in
> +                gcc*)
> +                    AC_DEFINE([MR_THREAD_LOCAL_STORAGE])
> +                    ;;
> +            esac
> +            ;;
>         *)
> -            AC_DEFINE(MR_THREAD_LOCAL_STORAGE)
> +            AC_DEFINE([MR_THREAD_LOCAL_STORAGE])
>             ;;
>     esac
> fi
> --------------------------------------------------------------------------
> mercury-users mailing list
> Post messages to:       mercury-users at csse.unimelb.edu.au
> Administrative Queries: owner-mercury-users at csse.unimelb.edu.au
> Subscriptions:          mercury-users-request at csse.unimelb.edu.au
> --------------------------------------------------------------------------

__________
Sean Johnson - Founder
sean at snootymonkey.com, @snootymonkey on Twitter

BubbleTimer - Time Well Spent
http://bubbletimer.com/ @bubbletimer on Twitter




--------------------------------------------------------------------------
mercury-users mailing list
Post messages to:       mercury-users at csse.unimelb.edu.au
Administrative Queries: owner-mercury-users at csse.unimelb.edu.au
Subscriptions:          mercury-users-request at csse.unimelb.edu.au
--------------------------------------------------------------------------



More information about the users mailing list