Opened 4 years ago

Last modified 4 years ago

#62708 assigned defect

tmux crashes when building with macOS SDK 11.0 on macOS 10.15

Reported by: tgyurci (Teubel György) Owned by: tessus (Helmut K. C. Tessarek)
Priority: Normal Milestone:
Component: ports Version:
Keywords: Cc:
Port: tmux

Description

The macOS SDK 11.0 provides the function strtonum but it is not implemented in macOS 10.15.

When using the latest Xcode (12.4) on macOS 10.15, configure detects that strtonum is available, but it does not check whether it's really usable or not. This results that tmux is built, but it crashes when tries to call strtonum with crash log:

Dyld Error Message:
  Symbol not found: _strtonum

I have created an upstream fix for this, but it would be good to not wait for the next release and the fix would be included in the current port:

https://github.com/tmux/tmux/commit/b2588eed03640dc74ffdbebd10c719064b575291

Change History (9)

comment:1 Changed 4 years ago by mf2k (Frank Schima)

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

comment:2 in reply to:  description ; Changed 4 years ago by jmroot (Joshua Root)

Replying to tgyurci:

When using the latest Xcode (12.4) on macOS 10.15, configure detects that strtonum is available, but it does not check whether it's really usable or not.

Even when building against the 10.15 SDK, as MacPorts does by default?

comment:3 in reply to:  2 Changed 4 years ago by tgyurci (Teubel György)

Replying to jmroot:

Replying to tgyurci:

When using the latest Xcode (12.4) on macOS 10.15, configure detects that strtonum is available, but it does not check whether it's really usable or not.

Even when building against the 10.15 SDK, as MacPorts does by default?

I can't test it, but I'm guessing that it works with 10.15 SDK, because strtonum is not detected (because it's missing).

The root of the problem is that I'm using a version of Xcode which has only SDK 11.x on macOS 10.15.

comment:4 Changed 4 years ago by jmroot (Joshua Root)

If you have the Command Line Tools, you should have the 10.15 SDK as well.

comment:5 Changed 4 years ago by tgyurci (Teubel György)

I have installed Command Line Tools, so port could find the 10.15 SDK from it. Using the corresponding SDK for the base OS, tmux has been built and working without crash.

I thought that it is supported to target 10.15 with 11.0 SDK, are there any "official" intention about this by MacPorts?

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

open source software does not always do a robust check for functions it uses. Often the best you can expect is a test that the function definition exists in the headers.

When using a newer SDK to build software on or for an older system than the SDK, it is common to have the function found in the sdk but not available on the target system.

MacPorts tries to use the sdk that matches the system to minimize this. And we have a process to add symbols to older systems that is also handy. So that is the official intention, to date.

If you have software skills and a better, more robust idea, please join us in making this better for everyone!

comment:7 in reply to:  6 Changed 4 years ago by tgyurci (Teubel György)

Replying to kencu:

If you have software skills and a better, more robust idea, please join us in making this better for everyone!

I have no comprehensive idea about making this work in all circumstances, beyond fixing the check locally (which I did).

According to this table: https://developer.apple.com/support/xcode/ Xcode 12.4 with SDK 11.1 can be used to target 10.15. I was just curious whether these kinds of patches are generally acceptable to fix SDK and base OS incompatibilities, or just use the corresponding SDK to avoid that.

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

The 11.1 SDK can target all the way back to 10.7 (or even earlier, I think).

You just have to make adjustments for symbols that don't exist in os versions < 11.1, which most open source software does not do (and really, can't be expected to do).

Last edited 4 years ago by kencu (Ken) (previous) (diff)

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

here's a nice blurb about Apple's current approach to this.

https://stackoverflow.com/questions/57825757/obj-c-has-available-swift-has-available-what-can-i-use-in-c-c

Some open-source tool that scanned the code and pointed out the potentially troublesome functions would be useful!

Note: See TracTickets for help on using tickets.