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

Julien Fischer juliensf at csse.unimelb.edu.au
Wed May 23 01:10:51 AEST 2012


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
--------------------------------------------------------------------------



More information about the users mailing list