Building on Mac with --enable-tls

Tom N nospam@codesniffer.com
Wed Mar 18 19:14:14 GMT 2020


I'm trying to build GCC from source on Mac (darwin) and keep getting this error when --enable-tls is specified:


/var/folders/cq/wx4ff_gd0xncqh9qnbzmt2w40000gp/T//ccS0vBm1.s:9:2: error: unsupported symbol modifier
in relocation
leaq __ZN3GTM12_gtm_thr_tlsE@tlsgd(%rip), %rdi
^
make[5]: *** [alloc_cpp.lo] Error 1


If I either omit --enable-tls or specify --disable-tls the build succeeds, but then I get synchronization problems in my code which uses std::unique_lock<std::mutex>  (namely it seems the synchronization isn't performed).

(Incidentally I've been building GCC for many years on Linux without issue so I'm not new to building GCC.)

I've tried on "fresh" (new system) Mac Yosemite (10.10), Sierra (10.12), and Catalina (10.15) (all having only XCode CLT, none have XCode itself), and GCC 4.9, 8.3, and 8.4.   All fail the same.   I've gleaned as much as I can from reading the Homebrew script that builds the same but still no luck.

I was hoping to find a build log from either GCC's own verification builds or Homebrew in order to compare against my own to find the problem but can't find it.

Here's the configure line from GCC 8.4 on Catalina (some of it may be unnecessary/redundant, it comes from my build toolchain):


cd ./build && CC=gcc CXX=g++ CFLAGS="" CXXFLAGS="" CPPFLAGS="" LDFLAGS="" BOOT_CFLAGS="-iframework /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks -mmacosx-version-min=10.15" CFLAGS_FOR_TARGET="-iframework /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Lib
rary/Frameworks -mmacosx-version-min=10.15" CXXFLAGS_FOR_TARGET="-iframework /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks -mmacosx-version-min=10.15" BOOT_LDFLAGS="-Wl,-headerpad_max_install_names" PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin /Users/me/gcc/gcc-8.4.0/configure --prefix=/Users/me/gcc_build --enable-languages=c,c++ --enable-threads=posix --enable-tls --disable-nls --enable-checking=release --disable-multilib --with-native-system-header-dir="/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include"


Happy to provide anything else that will help.

This has been beating me for a long time, appreciate anything.



More information about the Gcc-help mailing list