build legacy-support for an older OS than the host OS?
Fred Wright
fw at fwright.net
Wed Jun 4 20:44:31 UTC 2025
On Wed, 4 Jun 2025, René J.V. Bertin wrote:
> On Wednesday June 04 2025 12:13:28 Fred Wright wrote:
>
>> __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ all over the place. Your
>> setting two lines above should have done this, anyway, if it works as
>> expected.
>
> I'll try to remember to test that.
>
>> larger as the version mismatch grows). This is why static linking should
>> be avoided like the plague. As long as you use dynamic linking, then at
>> runtime it will use the normal installed legacy-support library, which is
>> presumably matched to the OS where it's running. It's perfectly OK that
>> this isn't the one it linked with.
>
> You did say earlier that this means you'd have to link with the library
> that re-exports libSystem, otherwise it's probably not going to be
> perfectly OK if a symbol is provided by a different library.
The linking with the "reexport" library that I mentioned earlier is just
because that's the only version of the library that has the extra
conditional symbols inflicted upon it, and needed when one is using the
OS-version-mismatched library (in the cases where it actually works).
The linker records which dynamic libraries are used, and which symbols are
used, but AFAIK it doesn't record which combinations thereof are used.
Hence, it may be that a given symbol is provided by the legacy-support
library when linking, but by the system library when running.
The *real* purpose of the "reexport" library is for cases where a
precompiled binary is being used almost as is but with a binary patch.
This allows the legacy-support library to be patched into the executable
*instead of* (rather than in addition to) the system library, with the
reexport allowing it to use the system library anyway.
> There's another reason for static linking in my particular test case.
> OpenWV is a browser plugin (alternative to libwidevine) that runs in a
> very strict sandbox. It cannot have dependencies in non-sanctioned
> places. For now it's in a testing phase anyway, and there's of course no
> need to make any big changes to legacy-support that would only benefit
> this particular project.
It must have a way to use libSystem, or it wouldn't work very well at all.
You should look into a way to poke another hole in the sandbox.
Fred Wright
More information about the macports-dev
mailing list