bugGforth - Bugs: bug #40978, Failed to compile GForth on MACOSX...


bug #40978: Failed to compile GForth on MACOSX 10.8.5

Submitted by:  None
Submitted on:  Fri 20 Dec 2013 06:43:45 AM UTC  
Category:  None Severity:  3 - Normal
Item Group:  None Status:  Fixed
Privacy:  Public Assigned to:  Bernd Paysan <paysan>
Open/Closed:  Closed

Add a New Comment(Rich Markup)

You are not logged in

Please log in, so followups can be emailed to you.


Sat 19 Dec 2015 11:27:21 PM UTC, comment #3:

Since per-thread variables can be really slow on some platforms (ok, here's the name: Windows), we use a per-thread structure initialized in the engine, and pass that pointer around. This makes the patch obsolete, but also makes sure Gforth compiles fine on Mac OS X.

I close the bug now.

Bernd Paysan <paysan>
Project AdministratorIn charge of this item.
Sat 21 Dec 2013 06:23:49 PM UTC, comment #2:

Attached the new version of the patch (see file compile-on-macosx-#40987.1.patch). Tested it with tests in unix/pthread.fs. It looks like __thread works on MacOSX 10.8.5.

Alexander Skobelev <ilowry>
Sat 21 Dec 2013 12:02:31 PM UTC, comment #1:

I have compiled it at last by wrapping gforth_[SFRLU]P, and throw-jmp_handler into functions of sort get_gforth_[SFRLU]PP() and get_throw_jmp_handler(). The patch is attached.

Alexander Skobelev <ilowry>
Fri 20 Dec 2013 06:43:45 AM UTC, original submission:

When run configure as:
./configure CC='gcc -v -arch x86_64' --build=x86_64-apple-darwin12.5.0

– libfcc interface failed to be compiled. Exactly, the building process failed for the all files in the lib/gforth/0.7.9_20130821/libcc-named directory.
The error message says (for all TLS variables):
/include/gforth/0.7.9_20130821/libcc.h:50:8: error: thread-local storage is unsupported for the current target
extern __thread Cell *gforth_SP;

Running gcc with -v flag shows that for some reason it runs clag with -triple x86_64-apple10.3.0 instead of x86_64-apple10.8.0.

Than, if to use the following line to run configure:
./configure CC='gcc -v -arch x86_64' --build=x86_64-apple-macosx10.8.0

– a linking stage fails with error message:
ld: illegal thread local variable reference to regular symbol _gforth_SP for architecture x86_64
Here the full otput from make for this case (I've also changed the glibtool script to use "gcc -v -arch x86_64" instead of default "cc"):

glibtool: compile: gcc -v -arch x86_64 -Wimplicit-function-declaration -O2 -pthread -I /Users/sasha/Src/3d-party/gforth.git/include -O -c /Users/sasha/Src/3d-party/gforth.git/lib/gforth/0.7.9_20130821/libcc-named/filestat.c -o /Users/sasha/Src/3d-party/gforth.git/lib/gforth/0.7.9_20130821/libcc-named/filestat.o >/dev/null 2>&1
glibtool: link: gcc -v -arch x86_64 -Wl,-undefined -Wl,dynamic_lookup -o /Users/sasha/Src/3d-party/gforth.git/lib/gforth/0.7.9_20130821/libcc-named/.libs/libgffilestat.0.so -bundle /Users/sasha/Src/3d-party/gforth.git/lib/gforth/0.7.9_20130821/libcc-named/.libs/filestat.o -arch x86_64 -O2 -pthread -pthread
Apple LLVM version 5.0 (clang-500.2.79) (based on LLVM 3.3svn)
Target: x86_64-apple-darwin12.5.0
Thread model: posix
clang: warning: argument unused during compilation: '-pthread'
clang: warning: argument unused during compilation: '-pthread'
"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld" -demangle -dynamic -arch x86_64 -bundle -macosx_version_min 10.8.0 -o /Users/sasha/Src/3d-party/gforth.git/lib/gforth/0.7.9_20130821/libcc-named/.libs/libgffilestat.0.so -undefined dynamic_lookup /Users/sasha/Src/3d-party/gforth.git/lib/gforth/0.7.9_20130821/libcc-named/.libs/filestat.o -lSystem /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/5.0/lib/darwin/libclang_rt.osx.a
ld: illegal thread local variable reference to regular symbol _gforth_SP for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

in file included from OS command line:-1
unix/filestat.fs:49: libtool link failed




(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:

Attached Files
file #30056:  compile-on-macosx-#40987.1.patch added by ilowry (10KiB - application/octet-stream - New version of compile-on-macosx-#40987.patch. )
file #30054:  compile-on-macosx-#40987.patch added by None (11KiB - application/octet-stream - Patch to fix compilation on MacOSX 10.8. It wraps thread local global variables in functions.)


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by paysan (Posted a comment)
  • -email is unavailable- added by ilowry (Posted a comment)

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.




    Follow 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2015-12-19 paysan StatusNone => Fixed
        Assigned toNone => paysan
        Open/ClosedOpen => Closed
    2013-12-21 ilowry Attached File- => Added compile-on-macosx-#40987.1.patch, #30056
    2013-12-21 None Attached File- => Added compile-on-macosx-#40987.patch, #30054

    Back to the top

    Powered by Savane 3.3