Opened 19 months ago

Closed 7 months ago

Last modified 7 months ago

#67221 closed defect (fixed)

luajit fails on 10.5, needs TLS

Reported by: rmottola (Riccardo) Owned by: catap (Kirill A. Korinsky)
Priority: Normal Milestone:
Component: ports Version:
Keywords: leopard haspatch Cc:
Port: luajit

Description

luajit refuses to compile with apple's gcc 4.0 because it needs thread-local-storage

forcing macports gcc 7 had it build

Change History (7)

comment:1 Changed 19 months ago by ryandesign (Ryan Carsten Schmidt)

Does adding compiler.thread_local_storage yes to the Portfile cause the correct compiler to be selected?

comment:2 Changed 10 months ago by rmottola (Riccardo)

@ryandesign sorry for the late answer, didn't read it! Since I hit the issue again, I tried.

Your suggestion works.

Also, in the portfile I see:

compiler.blacklist  {clang < 700} *gcc-4.2 macports-clang-3.3 macports-clang-3.4

But 10.5 has both 4.0 and 4.2 gcc, so paradoxically blacklisting 4.2 probably selects 4.0. I tried and it is enough to add *gcc-4.0 there

So both ways work, I think that your suggestion is conceptually cleaner, but the other follows the existing path (maybe could even be substituted).

This leads to cleang-11 being used on intel(instead of forced gcc7) which I think is what macports prefers.

Clang gives:

./lj_arch.h:127:5: error: 'TARGET_OS_IPHONE' is not defined, evaluates to 0 [-Werror,-Wundef-prefix=TARGET_OS_]
#if TARGET_OS_IPHONE

which I think should be written

#ifdef TARGET_OS_IPHONE)

or pedantically as

#if defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE

and we are done on 10.5 intel, both 32bit and 64bit.

comment:3 Changed 7 months ago by rmottola (Riccardo)

I hit this again... gcc4.0 being selected, this time I just forced gcc6 and it also worked. Didn't check this issue so I did not remember.

comment:4 in reply to:  1 ; Changed 7 months ago by rmottola (Riccardo)

Replying to ryandesign:

Does adding compiler.thread_local_storage yes to the Portfile cause the correct compiler to be selected?

yes it works, can it go in? also probably that makes the blacklist at least partially obsolete, since 4.2 was being blocked that way.

comment:5 in reply to:  4 Changed 7 months ago by ryandesign (Ryan Carsten Schmidt)

Keywords: haspatch added
Owner: set to catap
Status: newassigned

Replying to rmottola:

Clang gives:

./lj_arch.h:127:5: error: 'TARGET_OS_IPHONE' is not defined, evaluates to 0 [-Werror,-Wundef-prefix=TARGET_OS_]
#if TARGET_OS_IPHONE

which I think should be written

#ifdef TARGET_OS_IPHONE)

No, that would not be correct. TARGET_OS_ macros are always defined by the SDK to either 0 or 1. Checking if it is defined is not equivalent to checking if it is truthy.

or pedantically as

#if defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE

Yes, that would be the way to do it, now that projects are checking new TARGET_OS_ macros that are not defined in old SDKs and now that clang considers it an error to check undefined TARGET_OS_ macros.

I've submitted this fix to the developers of luajit here: https://github.com/LuaJIT/LuaJIT/pull/1189

Replying to rmottola:

Replying to ryandesign:

Does adding compiler.thread_local_storage yes to the Portfile cause the correct compiler to be selected?

yes it works, can it go in? also probably that makes the blacklist at least partially obsolete, since 4.2 was being blocked that way.

Here's a pull request containing both fixes: https://github.com/macports/macports-ports/pull/23655

For faster service for future issues, you can submit pull requests yourself!

comment:6 Changed 7 months ago by ryandesign (Ryan Carsten Schmidt)

Resolution: fixed
Status: assignedclosed

In 65cb338d6f49bde683989d90049864c53c44c072/macports-ports (master):

luajit: Requires thread-local storage

Closes: #67221

comment:7 Changed 7 months ago by ryandesign (Ryan Carsten Schmidt)

In 49f859291762e2c555fdc782ebc67d9e6fb2f956/macports-ports (master):

luajit: Fix build if TARGET_OS_IPHONE not defined

Closes: #67221

Note: See TracTickets for help on using tickets.