Opened 7 years ago

Closed 7 years ago

#53415 closed defect (fixed)

glpk 4.61 does not build on Mac OS X 10.6.8, Snow Leopard, because "Reentrancy needs complier support for TLS"

Reported by: ballapete (Peter "Pete" Dyballa) Owned by: dliessi (Davide Liessi)
Priority: Normal Milestone:
Component: ports Version:
Keywords: snowleopard Cc: Peter_Dyballa@…, Schamschula (Marius Schamschula), MarcusCalhoun-Lopez (Marcus Calhoun-Lopez), dliessi (Davide Liessi)
Port: glpk

Description

The failure happens during the configure stage:

checking whether to use GNU MP bignum library... yes
checking whether to enable shared library support... no
checking whether to enable MathProg ODBC support... no
checking whether to enable MathProg MySQL support... no
checking whether to enable reentrancy support... yes
checking for thread local storage (TLS) class specifier... none
configure: error: Reentrancy needs complier support for TLS
Command failed:  cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_nue.de.rsync.macports.org_macports_release_tarballs_ports_math_glpk/glpk/work/glpk-4.61" && ./configure --prefix=/opt/local --with-gmp 

config.log contains:

configure:11492: checking for thread local storage (TLS) class specifier
configure:11506: /usr/bin/llvm-gcc-4.2 -c -pipe -Os -arch x86_64 -I/opt/local/include conftest.c >&5
conftest.c: In function 'foo':
conftest.c:30: error: nested functions are disabled, use -fnested-functions to re-enable
conftest.c:30: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'int'
configure:11506: $? = 1
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "GLPK"
| #define PACKAGE_TARNAME "glpk"
| #define PACKAGE_VERSION "4.61"
| #define PACKAGE_STRING "GLPK 4.61"
| #define PACKAGE_BUGREPORT "bug-glpk@gnu.org"
| #define PACKAGE_URL ""
| #define PACKAGE "glpk"
| #define VERSION "4.61"
| #define STDC_HEADERS 1
| #define HAVE_SYS_TYPES_H 1
| #define HAVE_SYS_STAT_H 1
| #define HAVE_STDLIB_H 1
| #define HAVE_STRING_H 1
| #define HAVE_MEMORY_H 1
| #define HAVE_STRINGS_H 1
| #define HAVE_INTTYPES_H 1
| #define HAVE_STDINT_H 1
| #define HAVE_UNISTD_H 1
| #define HAVE_DLFCN_H 1
| #define LT_OBJDIR ".libs/"
| #define HAVE_LIBM 1
| #define HAVE_SYS_TIME_H 1
| #define HAVE_GETTIMEOFDAY 1
| #define HAVE_GMP 1
| /* end confdefs.h.  */
| 
|          #include <stdlib.h>
|          static void foo(void)
|          {  static  _Thread_local  int bar;
|             exit(1);
|          }
configure:11506: /usr/bin/llvm-gcc-4.2 -c -pipe -Os -arch x86_64 -I/opt/local/include conftest.c >&5
conftest.c: In function 'foo':
conftest.c:30: error: thread-local storage not supported for this target
configure:11506: $? = 1
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "GLPK"
| #define PACKAGE_TARNAME "glpk"
| #define PACKAGE_VERSION "4.61"
| #define PACKAGE_STRING "GLPK 4.61"
| #define PACKAGE_BUGREPORT "bug-glpk@gnu.org"
| #define PACKAGE_URL ""
| #define PACKAGE "glpk"
| #define VERSION "4.61"
| #define STDC_HEADERS 1
| #define HAVE_SYS_TYPES_H 1
| #define HAVE_SYS_STAT_H 1
| #define HAVE_STDLIB_H 1
| #define HAVE_STRING_H 1
| #define HAVE_MEMORY_H 1
| #define HAVE_STRINGS_H 1
| #define HAVE_INTTYPES_H 1
| #define HAVE_STDINT_H 1
| #define HAVE_UNISTD_H 1
| #define HAVE_DLFCN_H 1
| #define LT_OBJDIR ".libs/"
| #define HAVE_LIBM 1
| #define HAVE_SYS_TIME_H 1
| #define HAVE_GETTIMEOFDAY 1
| #define HAVE_GMP 1
| /* end confdefs.h.  */
| 
|          #include <stdlib.h>
|          static void foo(void)
|          {  static  __thread  int bar;
|             exit(1);
|          }
configure:11506: /usr/bin/llvm-gcc-4.2 -c -pipe -Os -arch x86_64 -I/opt/local/include conftest.c >&5
conftest.c: In function 'foo':
conftest.c:30: error: nested functions are disabled, use -fnested-functions to re-enable
conftest.c:30: error: invalid storage class for function '__declspec'
conftest.c: In function '__declspec':
conftest.c:31: error: expected declaration specifiers before 'exit'
conftest.c:32: error: expected declaration specifiers before '}' token
conftest.c:30: error: declaration for parameter 'bar' but no such parameter
conftest.c:32: error: expected '{' at end of input
conftest.c: In function 'foo':
conftest.c:32: error: expected declaration or statement at end of input
configure:11506: $? = 1
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "GLPK"
| #define PACKAGE_TARNAME "glpk"
| #define PACKAGE_VERSION "4.61"
| #define PACKAGE_STRING "GLPK 4.61"
| #define PACKAGE_BUGREPORT "bug-glpk@gnu.org"
| #define PACKAGE_URL ""
| #define PACKAGE "glpk"
| #define VERSION "4.61"
| #define STDC_HEADERS 1
| #define HAVE_SYS_TYPES_H 1
| #define HAVE_SYS_STAT_H 1
| #define HAVE_STDLIB_H 1
| #define HAVE_STRING_H 1
| #define HAVE_MEMORY_H 1
| #define HAVE_STRINGS_H 1
| #define HAVE_INTTYPES_H 1
| #define HAVE_STDINT_H 1
| #define HAVE_UNISTD_H 1
| #define HAVE_DLFCN_H 1
| #define LT_OBJDIR ".libs/"
| #define HAVE_LIBM 1
| #define HAVE_SYS_TIME_H 1
| #define HAVE_GETTIMEOFDAY 1
| #define HAVE_GMP 1
| /* end confdefs.h.  */
| 
|          #include <stdlib.h>
|          static void foo(void)
|          {  static  __declspec(thread)  int bar;
|             exit(1);
|          }
configure:11511: result: none
configure:11520: error: Reentrancy needs complier support for TLS

I presume this functionality does not exist in Snow Leopard

Presumingly --disable-reentrant has to used – which I'll try soon!

Attachments (1)

main.log (13.1 KB) - added by ballapete (Peter "Pete" Dyballa) 7 years ago.
main.log from Snow Leopard

Download all attachments as: .zip

Change History (16)

Changed 7 years ago by ballapete (Peter "Pete" Dyballa)

Attachment: main.log added

main.log from Snow Leopard

comment:1 Changed 7 years ago by ballapete (Peter "Pete" Dyballa)

With --disable-reentrant it builds.

comment:2 Changed 7 years ago by kencu (Ken)

Snow Leopard has no thread-local storage with libc++ or with the standard stdlibc++ that you get to with llvm-gcc-4.2. So on those build systems, you would need to use --disable-reentrant.

However, Snow Leopard does support thread-local storage with the newer libgcc that you can access with gcc5+ (or with Marcus' recent clang-3.9 macports-libstdc++ shenanigans)

checking whether to enable reentrancy support... yes
checking for thread local storage (TLS) class specifier... _Thread_local
checking if libtool needs -no-undefined flag to build shared libraries... no

and in that configuration, glpk will build without modification. So it's not trivial to make a hard and fast rule about this.

Brainless approach -- just --disable-reentrant on 10.6 and be done with it.

Artistic approach - check for the build system and disable it selectively, if cxx_stdlib ne macports-libstdc++. May be more trouble than it's worth?

comment:3 Changed 7 years ago by Schamschula (Marius Schamschula)

Cc: Schamschula added

comment:4 Changed 7 years ago by Schamschula (Marius Schamschula)

Given that Leopard (and older) also has the same issue, I'd go with --disable-reentrant

comment:5 Changed 7 years ago by mf2k (Frank Schima)

Keywords: snowleopard added

comment:6 Changed 7 years ago by kencu (Ken)

I forget exactly when tls came in to macOS...10.9 I think.

comment:7 in reply to:  2 Changed 7 years ago by ballapete (Peter "Pete" Dyballa)

Replying to kencu:

Artistic approach - check for the build system and disable it selectively, if cxx_stdlib ne macports-libstdc++. May be more trouble than it's worth?

I have no idea what thread local storage means (no use of clouds and rain banks?) and am not sure what you mean here – is it to try to use GCC6 instead of other compilers?

comment:8 Changed 7 years ago by kencu (Ken)

it's a bit complicated, Pete. See this <https://en.wikipedia.org/wiki/Thread-local_storage> for an overview. On 10.6 (and for that matter on 10.4 - 10.8, I think) the only way to get it is to use the new versions of libstdc++ provided by gcc5+ (which can also be used by clang-3.9+ with the new enhancements that are in the pipeline).

This requires a WHOLESALE change in the settings, however, and needs to be done with care and finesse to have a hope of working.

comment:9 Changed 7 years ago by MarcusCalhoun-Lopez (Marcus Calhoun-Lopez)

Cc: MarcusCalhoun-Lopez added

comment:10 Changed 7 years ago by ballapete (Peter "Pete" Dyballa)

On PPC Leopard, Mac OS X 10.5.8, the default compiler had no TLS support. Using the newly installed GCC 6.3.0, glpk 4.61 built with it.

Glpk is needed by gmp which is only needed by lbzip2. So it's quite easy to get rid of this dependency.

comment:11 Changed 7 years ago by kencu (Ken)

Don't forget, if you're going to mix software built with gcc5+ (which links against libstdc++ from libgcc) with software built with gcc-4.2 (which links against the system's /usr/lib/libstdc++), you'll need to do the same trick Marcus is doing with the ABI-compatability trick with the cxx11 portgroup to make it compatible.

comment:12 Changed 7 years ago by dliessi (Davide Liessi)

Cc: dliessi added

comment:13 Changed 7 years ago by dliessi (Davide Liessi)

Any news about this?

I understand that the best solution would be to check the compiler and disable the feature only when needed, but instead of leaving the port broken, I would --disable-reentrant on 10.6 and previous and leave the compiler check for future improvements.

If no one complains I will file a pull request in the next days.

comment:14 Changed 7 years ago by mojca (Mojca Miklavec)

comment:15 Changed 7 years ago by dliessi (Davide Liessi)

Owner: set to dliessi
Resolution: fixed
Status: newclosed

In f4f8a278ff52a3751e5542b62e9ea3fce804c589/macports-ports:

glpk: disable reentrancy support for <=10.6

Closes: #53415

Note: See TracTickets for help on using tickets.