Opened 5 years ago

Last modified 5 years ago

#59220 assigned defect

git @ 2.23.0_1 +credential_osxkeychain "unexpected token: !tapi-tbd-v3" - build failure

Reported by: bjax (Bruce Jackson) Owned by: ci42
Priority: Normal Milestone:
Component: ports Version: 2.6.1
Keywords: Cc:
Port: git

Description (last modified by ryandesign (Ryan Carsten Schmidt))

Upgrading from @2.23.0_0 to _1 fails with ld: unexpected token: !tapi-tbd-v3 file '/System/Library/Frameworks//Security.framework/Security.tbd' for architecture x86_64.

Full variants selected appear to be +credential_osxkeychain+diff_highlight+doc+pcre+perl5_26 but I only asked to port install upgrade outdated when this occurred; I didn't specify these variants.

I tried uninstalling ld64 and reinstalling ld64 +ld64_xcode then cleaning and reinstalling git as described in comment:ticket:58333:8, but that didn't fix it.

I also confirmed xcode-select +p returns /Applications/Xcode.app/Contents/Developer as mentioned in several older tickets.

The "tbd" in the token string seems suspicious...

Running MacOSX 10.13.6 with Xcode 10.1.

Attachments (2)

main.log (458.5 KB) - added by bjax (Bruce Jackson) 5 years ago.
Main installation log file for git @ 2.23.0_1 with failure
191011_git_fail_main.log (458.4 KB) - added by bjax (Bruce Jackson) 5 years ago.
Second main.log attachment after replacing ld64 with ld64_xcode

Download all attachments as: .zip

Change History (13)

Changed 5 years ago by bjax (Bruce Jackson)

Attachment: main.log added

Main installation log file for git @ 2.23.0_1 with failure

comment:1 Changed 5 years ago by ryandesign (Ryan Carsten Schmidt)

Description: modified (diff)

comment:2 in reply to:  description Changed 5 years ago by ryandesign (Ryan Carsten Schmidt)

Cc: ci42 removed
Owner: set to ci42
Status: newassigned

Replying to bjax:

Full variants selected appear to be +credential_osxkeychain+diff_highlight+doc+pcre+perl5_26 but I only asked to port install upgrade outdated when this occurred; I didn't specify these variants.

I tried uninstalling ld64 and reinstalling ld64 +ld64_xcode then cleaning and reinstalling git as described in comment:ticket:58333:8, but that didn't fix it.

I also confirmed xcode-select +p returns /Applications/Xcode.app/Contents/Developer as mentioned in several older tickets.

The "tbd" in the token string seems suspicious...

Running MacOSX 10.13.6 with Xcode 10.1.

"tbd" is not suspicious; it refers to the new "text-based dylib" stub files Apple uses in recent SDK versions to save disk space. But the linker has to understand them. I'm not sure why yours appears not to understand them.

It builds for me on macOS 10.13.6, but I am using Xcode 9.4.1 with the matching command line tools. Using Xcode 10.1, which contains only the 10.14 SDK and not the 10.13 SDK like Xcode 9 does, may be contributing to the problem. Have you installed the command line tools, in addition to Xcode? If not, you should. To build things successfully with MacPorts, you need an SDK version that matches your OS version, and since you've upgraded to an Xcode version that no longer provides that, the command line tools are needed. Since your log says DEVELOPER_DIR='/Library/Developer/CommandLineTools' I assume you do have the command line tools installed, but this variable is new in MacPorts 2.6 so I'm just making sure.

What may be relevant is that the error only occurs as a result of the additional building done by the post-build block added by the credential_osxkeychain variant; the main building of the port worked fine. Maybe one of the environment variables that are set by MacPorts in the main build is what allows that to succeed, and the problem may be that the custom building in the post-build block does not propagate these environment variables. For example, the DEVELOPER_DIR variable may be relevant.

The credential_osxkeychain variant is enabled by default but if you don't care about the macOS Keychain integration functionality, you could bypass the problem by deselecting that variant, which I think can be done with:

sudo port clean git
sudo port upgrade --enforce-variants git -credential_osxkeychain

comment:3 Changed 5 years ago by bjax (Bruce Jackson)

Thanks, Ryan,

I appreciate decoding the "tbd" for me!

I do indeed have the command line tools install for Xcode 10.1...

I had uninstalled MacPort's git versions entirely and instead added lfs to Xcode's git due to an urgent need to use git on a daily basis for work, so I have to use 'port install git' now (vs. upgrade). Unfortunately the --enforce-variants switch doesn't work with port install.

I tried again to install git via MacPorts and got the same error (of course).

Manually defining DEVELOPER_DIR (via export DEVELOPER_DIR='/Library/Developer/CommandLineTools') prior to running sudo port install git did not clear the problem; same error in the log.

I understand about the lack of older SDKs and have addressed that before by downloading older copies of MacOS-SDKs from https://github.com/phracker/MacOSX-SDKs; but now I don't remember how to add them properly :(

Thanks for your quick response!

comment:4 Changed 5 years ago by kencu (Ken)

Bruce, I think this really should fix your problem:

sudo port -f uninstall ld64
sudo port -v install ld64 +ld64_xcode

please confirm that it has worked, by showing the output of:

port -v installed | grep ld64

and if you see the proper ld64 installed, clean and try your install again without changing anything else fancy:

sudo port clean git 
sudo -v install git

and if it fails, please post up a new log, and also the results of

port -v installed | grep ld64

Changed 5 years ago by bjax (Bruce Jackson)

Attachment: 191011_git_fail_main.log added

Second main.log attachment after replacing ld64 with ld64_xcode

comment:5 Changed 5 years ago by bjax (Bruce Jackson)

Thanks, Ken,

I had seen that suggestion on another ticket on a similar error for another port, and had previously replaced ld64 with ld64 +ld64_xcode.

The results of port -v installed | grep ld64 is

  ld64 @3_1+ld64_xcode (active) platform='darwin 17' archs='x86_64' date='2019-10-11T12:44:48-0400'
  ld64-xcode @2_1 (active) platform='darwin 17' archs='x86_64' date='2019-04-01T09:57:02-0400'

but the attempt to reinstall git after cleaning yields the same error ld: unexpected token: !tapi-tbd-v3 file '/System/Library/Frameworks//Security.framework/Security.tbd' for architecture x86_64 .

I've attached the second installation log here (191011_git_fail_main.log)

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

This unexpected token: !tapi-tbd-v3 means that the ld64 that looked at the tbd file didn't know what it was.

That means, usually, that the ld64 is too old. All of our ld64 versions on MacPorts are too old to know what to do with a tbd file, so we either have to uninstall them or have them pass through to the ld64 in xcode; we chose the latter. Homebrew doesn't use ld64 or cctools on any recent os versions (ie any of the versions they support). Simpler, but less flexible.

Now - with that background - why is an ld64 being called in that doesn't know what to do with a tbd file?

Next thing I personally would do is go into the build folder and run that link command manually, but I'm not sure if you're up for that. Or otherwise ponder your installation, multiple xcode version?, some symlinks you made once upon a time?, any other weirdness?

comment:7 Changed 5 years ago by bjax (Bruce Jackson)

I followed the port build procedure to the line where it attempts to build git-credential-osxkeychain. When I manually tried running the Makefile therein using

$ make CFLAGS="-I. -Wall -O2 -I/opt/local/include -arch x86_64" LDFLAGS="-L/opt/local/lib -arch x86_64" CC=/usr/bin/clang prefix=/opt/local CURLDIR=/opt/local OPENSSLDIR=/opt/local ICONVDIR=/opt/local PERL_PATH="/opt/local/bin/perl5.26" PYTHON_PATH="/opt/local/bin/python2.7" NO_FINK=1 NO_DARWIN_PORTS=1 NO_R_TO_GCC_LINKER=1 NO_PERL_CPAN_FALLBACK=1 V=1 LIBPCREDIR=/opt/local USE_LIBPCRE2=1

it successfully built the git-credential-osxkeychain.o object file, but issued the following warning:

ld: warning: text-based stub file /System/Library/Frameworks//Security.framework/Security.tbd and library file
 /System/Library/Frameworks//Security.framework/Security are out of sync. Falling back to library file for linking.

and the next step,

/usr/bin/clang -I. -Wall -O2 -I/opt/local/include -arch x86_64 -o git-credential-osxkeychain git-credential-osxkeychain.o -L/opt/local/lib -arch x86_64 -Wl,-framework -Wl,Security

emits the same error (but does builds the git-credential-osxkeychain executable).

I don't see (in main.log) the invocation of the ld command that is generating the ld: unexpected token error. Is it in the port file, or some MacPort specific Makefile?

-- Bruce

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

The invocation of ld is done implicitly inside this command:

/usr/bin/clang -I. -Wall -O2 -I/opt/local/include -arch x86_64 -o git-credential-osxkeychain git-credential-osxkeychain.o -L/opt/local/lib -arch x86_64 -Wl,-framework -Wl,Security

To break it out to be more visible, you add -Wl,-v to the build line to push the linker into verbose mode.

/usr/bin/clang -I. -Wall -Wl,-v -O2 -I/opt/local/include -arch x86_64 -o git-credential-osxkeychain git-credential-osxkeychain.o -L/opt/local/lib -arch x86_64 -Wl,-framework -Wl,Security

comment:9 Changed 5 years ago by bjax (Bruce Jackson)

Ken,

Thank you for your patience and advice.

I ran the command you suggested from within the /opt/local/ ... credential/osxkeychain directory and got the same warning as before, with only slightly more information:

/usr/bin/clang -I. -Wall -Wl,-v -O2 -I/opt/local/include -arch x86_64 -o git-credential-osxkeychain git-credential-osxkeychain.o \
    -L/opt/local/lib -arch x86_64 -Wl,-framework -Wl,Security
@(#)PROGRAM:ld  PROJECT:ld64-409.12
BUILD 17:47:51 Sep 25 2018
configured to support archs: armv6 armv7 armv7s arm64 i386 x86_64 x86_64h armv6m armv7k armv7m armv7em arm64e arm64_32
Library search paths:
	/opt/local/lib
	/usr/lib
Framework search paths:
	/Library/Frameworks/
	/System/Library/Frameworks/
ld: warning: text-based stub file /System/Library/Frameworks//Security.framework/Security.tbd and library file 
     /System/Library/Frameworks//Security.framework/Security are out of sync. Falling back to library file for linking.

As I reported previously, this successfully builds the git-credential-osxkeychain program in that directory.

Is that the command that is throwing the original error, ld: unexpected token: !tapi-tbd-v3 file '/System/Library/Frameworks//Security.framework/Security.tbd? If so, I'm getting a different result when invoking that build command from the command line than from the sudo post install git| invocation.

Perhaps now that osx-credential-osxkeychain is built, I can complete the installation by hand?

If I'm the only one having this problem, it may not be worth your time to help me figure this out!

-- Bruce

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

I think at this point I'd do what Ryan suggested; clean, try one last install; if that fails again disable the default keychoin variant as he describes, and move on. Leave the ticket open until someone on the dev team runs into and sorts it out. If others have this issue, we'll spend more time on it.

comment:11 Changed 5 years ago by bjax (Bruce Jackson)

I repeated the sudo port clean git; sudo port install git but got the same error.

I was able to install git successfully by bypassing the osx credentials option by using

sudo port install git -credential_osxkeychain as suggested.

Thanks,

-- Bruce

Note: See TracTickets for help on using tickets.