Opened 2 years ago

Closed 18 months ago

#65550 closed defect (fixed)

julia: link fails for 10.14 and earlier: ld: unsupported tapi file type '!tapi-tbd' in YAML file

Reported by: githubbjs (BJS) Owned by: essandess (Steve Smith)
Priority: Normal Milestone:
Component: ports Version: 2.7.2
Keywords: Cc: githubbjs (BJS), flwyd (Trevor Stone), mascguy (Christopher Nielsen), petrrr
Port: julia

Description (last modified by mascguy (Christopher Nielsen))

This port is failing to build for 10.14 and earlier, with the following link error:

ld: unsupported tapi file type '!tapi-tbd' in YAML file 'work/julia-1.8.0/src/mach_dyld_atfork.tbd' for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

https://ports.macports.org/port/julia/details/

Attachments (5)

main.log (259.3 KB) - added by githubbjs (BJS) 2 years ago.
log file
julia-build1.log (152.1 KB) - added by flwyd (Trevor Stone) 2 years ago.
error after clean
julia-build2.log (267.5 KB) - added by flwyd (Trevor Stone) 2 years ago.
Error on second try without cleaning
main.2.log (142.2 KB) - added by petrrr 2 years ago.
A more recent log: sudo port install julia
main.3.log (47.8 KB) - added by petrrr 2 years ago.
from a recent julia @1.8.3 build

Download all attachments as: .zip

Change History (24)

comment:1 Changed 2 years ago by githubbjs (BJS)

Cc: githubbjs added

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

will need a log please

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

Port: julia added
Summary: Julia cannot be installed with gcc12ulia-1.7.3_0+gcc12: build fails on High Sierra

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

Owner: set to essandess
Status: newassigned
Summary: ulia-1.7.3_0+gcc12: build fails on High Sierrajulia-1.7.3_0+gcc12: build fails on High Sierra

Changed 2 years ago by githubbjs (BJS)

Attachment: main.log added

log file

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

kind of an unusual error:

Failed to build julia: ln: /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_lang_julia/julia/work/bin/gfortran: File exists

comment:6 Changed 2 years ago by flwyd (Trevor Stone)

I'm also getting an error on Mojave (10.14.6). I first saw this with port upgrade outdated but the error continues after an uninstall/reinstall cycle. I don't think the gfortran message is the root cause. In my log and the log from githubbjs I see:

:info:build ld: warning: text-based stub file /opt/local/var/macports/build/_opt_local_var_macports_
sources_rsync.macports.org_macports_release_tarballs_ports_lang_julia/julia/work/julia-1.8.0/src/mach_dyld_atfork.tbd and library file /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_julia/julia/work/julia-1.8.0/src/mach_dyld_atfork.tbd are out of sync. Falling back to library file for linking.
:info:build ld: unsupported tapi file type '!tapi-tbd' in YAML file '/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_julia/julia/work/julia-1.8.0/src/mach_dyld_atfork.tbd' for architecture x86_64
:info:build clang: error: linker command failed with exit code 1 (use -v to see invocation)

My first attempt doesn't have a gfortran error, but if I run port install julia a second time without port clean julia then I get the following error:

--->  Attempting to fetch julia-1.8.0_0+gcc12.darwin_18.x86_64.tbz2 from http://packages.macports.org/julia
--->  Attempting to fetch julia-1.8.0_0+gcc12.darwin_18.x86_64.tbz2 from http://ywg.ca.packages.macports.org/mirror/macports/packages/julia
--->  Attempting to fetch julia-1.8.0_0+gcc12.darwin_18.x86_64.tbz2 from http://mse.uk.packages.macports.org/julia
--->  Building julia
Error: Failed to build julia: ln: /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_julia/julia/work/bin/gfortran: File exists
Error: See /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_julia/julia/main.log for details.

gfortran in the work/bin directory is a symlink to /opt/local/bin/gfortran-mp-12.

Changed 2 years ago by flwyd (Trevor Stone)

Attachment: julia-build1.log added

error after clean

Changed 2 years ago by flwyd (Trevor Stone)

Attachment: julia-build2.log added

Error on second try without cleaning

comment:7 Changed 2 years ago by flwyd (Trevor Stone)

Cc: flwyd added

comment:8 Changed 2 years ago by mascguy (Christopher Nielsen)

Cc: mascguy added

comment:9 Changed 2 years ago by mascguy (Christopher Nielsen)

Description: modified (diff)
Summary: julia-1.7.3_0+gcc12: build fails on High Sierrajulia: link fails for 10.14 and earlier: ld: unsupported tapi file type '!tapi-tbd' in YAML file
Version: 2.7.2

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

the julia project has done something kind of unique here, copying in a part of a recent MacOS system tbd file:

https://github.com/JuliaLang/julia/commit/2939272af2ef3fe9d8921f7ed0a6500e31a550c9

The tbd file they copied appears to be too new for the ld64/libtapi on the older systems to process, I believe.

Possibly our newer ld64/libtapi might work on older systems.

It might be their tbd file could be replaced with a similar but older version tbd file to be used on older systems.

Or perhaps the linked tbd file could be removed completely on older systems (and likely ifdef out the functions in the code that look for it, possibly using the previous implementation). That would be rather messier to maintain.

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

Has duplicate 65916

comment:12 Changed 2 years ago by flwyd (Trevor Stone)

The same error occurs with the new julia-1.8.2 package as well, with the same error.

What needs to happen to resolve this issue? Is this something that should be patched on the MacPorts side, or would it make sense to commit something upstream?

I'd be happy to help, though I have no idea what any of the changes in the referenced github commit are doing.

comment:13 Changed 2 years ago by petrrr

Cc: petrrr added

Changed 2 years ago by petrrr

Attachment: main.2.log added

A more recent log: sudo port install julia

comment:14 Changed 2 years ago by petrrr

The build fails for me as well, the problem seems to be identical to the one described here. I added a new log for version julia @1.8.2 in the hope that it might help to solve this.

comment:15 Changed 2 years ago by petrrr

Same issue with julia @1.8.3 I'll share an updated main.log.

Changed 2 years ago by petrrr

Attachment: main.3.log added

from a recent julia @1.8.3 build

comment:16 Changed 21 months ago by quentinmit (Quentin Smith)

I was able to get julia to build on Mojave with a simple Makefile patch; I replaced

OSLIBS += $(SRCDIR)/mach_dyld_atfork.tbd

with

CLANG_LDFLAGS += -Wl,-U,__dyld_atfork_prepare -Wl,-U,__dyld_atfork_parent

and added $(CLANG_LDFLAGS) to the rules building libjulia-internal and libjulia-internal-debug. The latter is probably safe on every platform but the former needs a guard for older OS versions, of course.

It's possible that the additional -U flags are unnecessary, but I didn't test that (the previous line sets a different flag that theoretically should allow unknown symbols as well).

comment:17 Changed 18 months ago by benz0li (Olivier Benz)

@quentinmit It might be worth to discuss your patch upstream (https://github.com/JuliaLang/julia) and get feedback from Julia developers.

IMHO It is rather quirky what they do by copying part of a recent Xcode libSystem.tbd file.

Please mention this trac ticket when you do so.

comment:18 Changed 18 months ago by benz0li (Olivier Benz)

Cross reference: https://github.com/JuliaLang/julia/issues/49976 (Alternative to copying part of a recent Xcode libSystem.tbd to src/mach_dyld_atfork.tbd)

comment:19 Changed 18 months ago by benz0li (Olivier Benz)

Resolution: fixed
Status: assignedclosed

In 56bf1a482dc03faffd6dc7e5b3bd3f9858851ce9/macports-ports (master):

julia: Patch Makefile if darwin version < 19

  • Closes: #65550
  • Specify minimal platform version
  • Remove p7zip dependency
    • 7z is installed to private libexec/julia directory
Note: See TracTickets for help on using tickets.