Opened 10 months ago

Closed 7 months ago

#60893 closed defect (worksforme)

gcc5 unusable on Catalina: ld: unsupported tapi file type '!tapi-tbd' in YAML file

Reported by: chrstphrchvz (Christopher Chavez) Owned by: macports-tickets@…
Priority: Normal Milestone:
Component: ports Version: 2.6.3
Keywords: Cc: mascguy (Christopher Nielsen)
Port: gcc5

Description (last modified by chrstphrchvz (Christopher Chavez))

Edit: ticket was originally for mysql8, but other simpler ports (e.g. pv) appear to be affected.

Using compiler.whitelist macports-gcc-5 to force compiling with gcc5, a port fails to configure/build using trace mode. Example with mysql8:

--->  Configuring mysql8
        (using ccache)
Executing:  cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_github.com_macports_macports-ports_databases_mysql8/mysql8/work/build" && /opt/local/bin/cmake -G "CodeBlocks - Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="/opt/local" -DCMAKE_INSTALL_NAME_DIR="/opt/local/lib" -DCMAKE_SYSTEM_PREFIX_PATH="/opt/local;/usr" -DCMAKE_C_COMPILER_LAUNCHER=/opt/local/bin/ccache -DCMAKE_CXX_COMPILER_LAUNCHER=/opt/local/bin/ccache -DCMAKE_C_COMPILER="$CC" -DCMAKE_CXX_COMPILER="$CXX" -DCMAKE_POLICY_DEFAULT_CMP0025=NEW -DCMAKE_POLICY_DEFAULT_CMP0060=NEW -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_COLOR_MAKEFILE=ON -DCMAKE_FIND_FRAMEWORK=LAST -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_MAKE_PROGRAM=/usr/bin/make -DCMAKE_MODULE_PATH="/opt/local/share/cmake/Modules" -DCMAKE_PREFIX_PATH="/opt/local/share/cmake/Modules" -DCMAKE_INSTALL_RPATH=";/opt/local/lib" -Wno-dev -DWITH_DEBUG=OFF -DWITH_DTRACE:BOOL=OFF -DWITH_UNIT_TESTS=OFF -DCMAKE_BUILD_WITH_INSTALL_RPATH:BOOL=OFF -DCMAKE_INSTALL_NAME_DIR:PATH="/opt/local/lib/mysql8/mysql" -DFORCE_UNSUPPORTED_COMPILER=ON -DDOWNLOAD_BOOST=0 -DENABLE_DOWNLOADS:BOOL=OFF -DINSTALL_LAYOUT:STRING=MACPORTS -DMYSQL_DATADIR:PATH="/opt/local/var/db/mysql8" -DMYSQL_UNIX_ADDR:PATH="/opt/local/var/run/mysql8/mysqld.sock" -DSYSCONFDIR:PATH="/opt/local/etc/mysql8" -DWITH_BOOST:PATH="/opt/local/var/macports/build/_opt_local_var_macports_sources_github.com_macports_macports-ports_databases_mysql8/mysql8/work/mysql-8.0.21/../boost_1_72_0" -DWITH_ICU:PATH="/opt/local" -DWITH_INNODB_MEMCACHED=1 -DWITH_PROTOBUF=bundled -DWITH_SASL:PATH="/opt/local" -DWITH_SSL:PATH="/opt/local" -DWITH_ZLIB:PATH="/opt/local" -DWITH_ZSTD=system -DWITH_ROUTER:BOOL=OFF -DCMAKE_OSX_ARCHITECTURES="x86_64" -DCMAKE_OSX_DEPLOYMENT_TARGET="10.15" -DCMAKE_OSX_SYSROOT="/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk" /opt/local/var/macports/build/_opt_local_var_macports_sources_github.com_macports_macports-ports_databases_mysql8/mysql8/work/mysql-8.0.21
-- Running cmake version 3.17.3
-- Found Git: /usr/bin/git (found version "2.24.3 (Apple Git-128)")
-- MySQL 8.0.21
-- The C compiler identification is GNU 5.5.0
-- The CXX compiler identification is GNU 5.5.0
-- Checking whether C compiler has -isysroot
-- Checking whether C compiler has -isysroot - yes
-- Checking whether C compiler supports OSX deployment target flag
-- Checking whether C compiler supports OSX deployment target flag - yes
-- Check for working C compiler: /opt/local/bin/gcc-mp-5
-- Check for working C compiler: /opt/local/bin/gcc-mp-5 - broken
CMake Error at /opt/local/share/cmake-3.17/Modules/CMakeTestCCompiler.cmake:60 (message):
  The C compiler

    "/opt/local/bin/gcc-mp-5"

  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: /opt/local/var/macports/build/_opt_local_var_macports_sources_github.com_macports_macports-ports_databases_mysql8/mysql8/work/build/CMakeFiles/CMakeTmp

    Run Build Command(s):/usr/bin/make cmTC_4632c/fast && /Library/Developer/CommandLineTools/usr/bin/make  -f CMakeFiles/cmTC_4632c.dir/build.make CMakeFiles/cmTC_4632c.dir/build
    Building C object CMakeFiles/cmTC_4632c.dir/testCCompiler.c.o
    /opt/local/bin/gcc-mp-5   -pipe -Os -DNDEBUG -I/opt/local/include -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk  -arch x86_64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk -mmacosx-version-min=10.15   -o CMakeFiles/cmTC_4632c.dir/testCCompiler.c.o   -c /opt/local/var/macports/build/_opt_local_var_macports_sources_github.com_macports_macports-ports_databases_mysql8/mysql8/work/build/CMakeFiles/CMakeTmp/testCCompiler.c
    Linking C executable cmTC_4632c
    /opt/local/bin/cmake -E cmake_link_script CMakeFiles/cmTC_4632c.dir/link.txt --verbose=1
    /opt/local/bin/gcc-mp-5 -pipe -Os -DNDEBUG -I/opt/local/include -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk  -arch x86_64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk -mmacosx-version-min=10.15 -Wl,-search_paths_first -Wl,-headerpad_max_install_names -L/opt/local/lib -Wl,-headerpad_max_install_names -Wl,-syslibroot,/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk  CMakeFiles/cmTC_4632c.dir/testCCompiler.c.o  -o cmTC_4632c
    collect2: fatal error: close: Bad file descriptor
    compilation terminated.
    make[1]: *** [cmTC_4632c] Error 1
    make[1]: *** Deleting file `cmTC_4632c'
    make: *** [cmTC_4632c/fast] Error 2





  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  CMakeLists.txt:354 (PROJECT)


-- Configuring incomplete, errors occurred!

Attachments (2)

mysql8-gcc5-tracemode.log.xz (9.0 KB) - added by chrstphrchvz (Christopher Chavez) 10 months ago.
main.log for configuring with tracemode
pv-gcc5-tracemode.log.xz (5.6 KB) - added by chrstphrchvz (Christopher Chavez) 10 months ago.

Download all attachments as: .zip

Change History (16)

Changed 10 months ago by chrstphrchvz (Christopher Chavez)

main.log for configuring with tracemode

comment:1 Changed 10 months ago by kencu (Ken)

maybe first try to build anything with gcc5 to see if it is totally busted on whatever OS you're on here.

Last edited 10 months ago by kencu (Ken) (previous) (diff)

comment:2 Changed 10 months ago by chrstphrchvz (Christopher Chavez)

Description: modified (diff)
Owner: changed from herbygillot to macports-tickets@…
Port: gcc5 added; mysql8 removed
Summary: mysql8: can't configure with gcc5 under tracemodegcc5 unusable in trace mode

gcc5 seemed to work without trace mode (see #60894). However trying to compile another simple port pv in trace mode fails, so this issue might indeed have nothing to do with mysql8. I'm not sure if this issue is in gcc5 or possibly in trace mode itself (base).

--->  Configuring pv
Executing:  cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_github.com_macports_macports-ports_sysutils_pv/pv/work/pv-1.6.6" && ./configure --prefix=/opt/local --mandir=/opt/local/share/man --infodir=/opt/local/share/info
checking for gcc... /opt/local/bin/gcc-mp-5
checking for C compiler default output file name...
configure: error: in `/opt/local/var/macports/build/_opt_local_var_macports_sources_github.com_macports_macports-ports_sysutils_pv/pv/work/pv-1.6.6':
configure: error: C compiler cannot create executables

Changed 10 months ago by chrstphrchvz (Christopher Chavez)

Attachment: pv-gcc5-tracemode.log.xz added

comment:3 Changed 10 months ago by kencu (Ken)

please show result of a "hello_world.c" compile with gcc5.

comment:4 Changed 10 months ago by chrstphrchvz (Christopher Chavez)

% echo "#include <stdio.h>\nint main(void){printf(\"Hello world\\\n\");}"
#include <stdio.h>
int main(void){printf("Hello world\n");}

% echo "#include <stdio.h>\nint main(void){printf(\"Hello world\\\n\");}" | /opt/local/bin/gcc-mp-5 -xc -
ld: unsupported tapi file type '!tapi-tbd' in YAML file '/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/lib/libSystem.tbd' for architecture x86_64
collect2: error: ld returned 1 exit status

It turns out configuring pv in trace mode had the same error (which it buried in a config.log):

configure:2302: checking for C compiler default output file name
configure:2324: /opt/local/bin/gcc-mp-5 -pipe -Os -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk -arch x86_64 -I/opt/local/include -Wno-deprecated -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk -L/opt/local/lib -Wl,-headerpad_max_install_names -Wl,-syslibroot,/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk -arch x86_64 conftest.c  >&5
ld: unsupported tapi file type '!tapi-tbd' in YAML file '/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/lib/libSystem.tbd' for architecture x86_64
collect2: error: ld returned 1 exit status

Following instructions at ticket:58333#comment:8 allows building a working hello world program. But configuring pv does not get much further:

configure:2302: checking for C compiler default output file name
configure:2324: /opt/local/bin/gcc-mp-5 -pipe -Os -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk -arch x86_64 -I/opt/local/include -Wno-deprecated -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk -L/opt/local/lib -Wl,-headerpad_max_install_names -Wl,-syslibroot,/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk -arch x86_64 conftest.c  >&5
collect2: fatal error: close: Bad file descriptor
compilation terminated.

I apologize for not understanding this issue very well, but working on it is becoming more effort than I'm currently interested in making. The goal was merely to document why gcc5 and clang < 900 (otherwise C++14-capable compilers) are blacklisted in mysql8: https://github.com/macports/macports-ports/pull/7774#discussion_r456882956. I personally do not use mysql8, and there would appear to be a number of other compilers to choose from instead.

comment:5 Changed 10 months ago by kencu (Ken)

That is what I thought might be the case.

So the issue at present seems to have nothing to do with mysql8, but your installation of gcc5 is using a linker that can't support your SDK, and is just broken.

you can get more information from adding some "verbose" flags:

/opt/local/bin/gcc-mp-5 -v -Wl,-v  hello.c

but which installation of ld64 do you presently have?

port -v installed | grep ld64

should tell you.

Until you get gcc5 actually working, mysql8 with gcc5 is a total non-starter, of course.

Last edited 10 months ago by kencu (Ken) (previous) (diff)

comment:6 Changed 10 months ago by kencu (Ken)

Summary: gcc5 unusable in trace modegcc5 unusable on Catalina: ld: unsupported tapi file type '!tapi-tbd' in YAML file

comment:7 Changed 10 months ago by chrstphrchvz (Christopher Chavez)

All I currently know is that I originally had ld64 @3_3 (no variants) and ld64-latest @450.3_0+llvm90; then, after finding ticket:58333#comment:8, I installed ld64 @3_3 +ld64_xcode which also installed ld64-xcode @2_3, and had not observed the ld: unsupported tapi file type '!tapi-tbd' error since doing so.

comment:8 Changed 10 months ago by kencu (Ken)

I'm confused; isn't the error in comment 4 from now? It shows you are having that tapi error right now...

anyway, I can't sort it out without the details from comment 5, if you want to sort it out.

comment:9 Changed 10 months ago by kencu (Ken)

I just installed a new macports installation onto Catalina, and then installed gcc5. During that, macports automatically installs ld64 and automatically installs the ld64_xcode variant. It works correctly out of the box, without any interventions, to build a hello.c test program, and has no troubles when linking with TAPI.

So that part at least, out of the box, works fine for people.

I'll try with mysql8 with gcc next.

comment:10 Changed 10 months ago by kencu (Ken)

No I won't try with gcc -- mysql8 requires linking to libraries that use libc++.dylib, and so gcc should never be used to build it on systems that are configured to use libc++.dylib.

macports will never try to use gcc5 to build this on any such system, so that is a non-issue.

the only time this gcc5 thing comes into play would be on systems that are configured to use libstdc++.dylib, like 10.4 and 10.5 PPC, and 10.4 and 10.5 Intel (presently).

So to test whether gcc5 can build mysql8 or not, one would have to be on one of those systems.

Those systems are already configured by default to build with gcc7, and a user would have to specifically go out of his/her way to try to force mysql8 to build with gcc5 -- for what reason, who can say.

I would say this ticket is a pretty-much lost cause at this point in time. IF I ever sit down for an afternoon to try to get mysql8 building on 10.5 PPC, I doubt if I'll try to build it with anything beyond the default gcc7 compiler (or newer, once I launch gcc8 or gcc9 on PPC).

What say we close this ticket?

comment:11 Changed 10 months ago by chrstphrchvz (Christopher Chavez)

I'm fine with this ticket being closed.

comment:12 Changed 8 months ago by mascguy (Christopher Nielsen)

Cc: mascguy added

comment:13 Changed 8 months ago by mascguy (Christopher Nielsen)

I'm seeing a similar link-time issue when building OpenBLAS +native on MacOS 10.15.6, albeit using the version of 'ld' that ships with the Xcode 12.0 command-line tools:

https://trac.macports.org/ticket/61236

Not sure whether this is notable for your folks' case, but just figured I'd mention it...

Last edited 8 months ago by mascguy (Christopher Nielsen) (previous) (diff)

comment:14 Changed 7 months ago by kencu (Ken)

Resolution: worksforme
Status: assignedclosed
Note: See TracTickets for help on using tickets.