I think I found the answer to my own question.

The problem with the linker warning messages regarding the Frameworks are "out 
of sync" appears to plague only Mac users running High Sierra or Mojave 
especially after they have upgraded XCode.

Sometimes the problem can be solved by reinstalling the XCode Command Line 
Tools.  (That did not work for me).

Otherwise, one needs to set SDKROOT as follows:

export SDKROOT=$(xcrun --show-sdk-path)

It is best to set SDKROOT in one's ~/.bash_profile

See

https://stackoverflow.com/questions/51314888/ld-warning-text-based-stub-file-are-out-of-sync-falling-back-to-library-file

In any event, without setting SDKROOT, it appears that the fallback "to library 
file for linking" does work and the linker can finish doing its job.

One can try to fix it in the Portfile like I did by setting -isysroot etc but 
that appears to interfere with MacPorts trace mode.  When installing a port in 
trace mode with -sysroot set, the linker will be unable to find common headers 
like stdio.h.  At least that is my experience.

I will just ignore these linker warning messages that get genearted on High 
Sierra or Mojave.  It is really not a Macports issue but a macOS issue.

Rob

________________________________
From: macports-dev <macports-dev-boun...@lists.macports.org> on behalf of 
Robert Kennedy <am...@hotmail.com>
Sent: August 16, 2022 7:17 PM
To: macports-dev@lists.macports.org <macports-dev@lists.macports.org>
Subject: ld: waning messages -- Frameworks out of sync.

I have been experimenting with building my M2VDownsizer port on other Macs 
running newer MacOS.  M2VDownsizer uses a Makefile to build the binary from 
source code written in C.  (see PR  
https://github.com/macports/macports-ports/pull/15636 )


I find that on newer Macs (e.g. 10.13), the following linker warning messages 
are often generated:

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

I can get rid of these warning messages if I include the following in the 
Portfile:

set MAJOR_MACOS_VERSION       [ exec sh -c { sw_vers -productVersion | cut -d 
'.' -f 1,2 } ]

set SDK_PATH       [ exec xcrun --show-sdk-path ]

configure.cflags-append     -mmacosx-version-min=${MAJOR_MACOS_VERSION}

configure.cflags-append     -isysroot ${SDK_PATH}

The port builds just fine unless one uses trace mode.
i.e. sudo port -vst install M2VDwnsizer

I suspect that setting SYSROOT using -isysroot interferes with MacPorts trace 
mode.

I will probably just delete the extra statements above from the Portfile and 
just live with the warning messages.

Has anyone else dealt with this issue?

Rob


Reply via email to