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
Re: ld: waning messages -- Frameworks out of sync.
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 on behalf of Robert Kennedy Sent: August 16, 2022 7:17 PM To: 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
Re: ld: waning messages -- Frameworks out of sync.
> 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 If you do that, you will possibly override MacPorts setting of SDKROOT, and this is likely to cause you many problems when building ports. I would suggest you just ignore the warning -- the linker knows to use the library if the TBD file is out of sync, as it has said in it's message. Otherwise, you can fix the TBD file (which is what I did) by using the tapi tool: $ tapi OVERVIEW: Text-based Stubs Tool USAGE: tapi [--version][--help] tapi [] Commands: archive Merge or thin text-based stub files stubify Create a text-based stub file from a library installapi Create a text-based stub file by scanning the header files reexportCreate a linker reexport file by scanning the header files See 'tapi --help' to read more about a specific command. Of course, you may not want to do that -- but that is less intrusive than setting the SDKROOT I would say, if the warnings are really bothersome to you. Best, Ken
Re: ld: waning messages -- Frameworks out of sync.
Thanks Ken! Letting me know that the "tapi" command is the key to the fix was a big help. I did a quick google search for "tapi stubify" and found that someone has already created a ruby script to fix the problem. But one needs to disable System Integrity Protection (SIP) first before running the script. Once the script is run, one can re-enable SIP. See https://gist.github.com/sv99/c9d8c155db7db83325847bd33b25e1d0 I assume you used tapi stubify and did manually what was in this script. If you used a different approach, please let me know. Rob From: macports-dev on behalf of Ken Cunningham Sent: August 18, 2022 2:34 PM To: MacPorts Developers Subject: Re: ld: waning messages -- Frameworks out of sync. > 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 If you do that, you will possibly override MacPorts setting of SDKROOT, and this is likely to cause you many problems when building ports. I would suggest you just ignore the warning -- the linker knows to use the library if the TBD file is out of sync, as it has said in it's message. Otherwise, you can fix the TBD file (which is what I did) by using the tapi tool: $ tapi OVERVIEW: Text-based Stubs Tool USAGE: tapi [--version][--help] tapi [] Commands: archive Merge or thin text-based stub files stubify Create a text-based stub file from a library installapi Create a text-based stub file by scanning the header files reexportCreate a linker reexport file by scanning the header files See 'tapi --help' to read more about a specific command. Of course, you may not want to do that -- but that is less intrusive than setting the SDKROOT I would say, if the warnings are really bothersome to you. Best, Ken
Re: ld: waning messages -- Frameworks out of sync.
Yes, exactly -- I made a new TBD file for the library using "tapi stubify" and replaced the old TBD file with it, for the ones that were outdated. The script seems like a nice way to automate the process -- thanks for finding that. K On Thu, Aug 18, 2022 at 1:32 PM Robert Kennedy wrote: > Thanks Ken! > > Letting me know that the "tapi" command is the key to the fix was a big > help. > > I did a quick google search for "tapi stubify" and found that someone has > already created a ruby script to fix the problem. But one needs to disable > System Integrity Protection (SIP) first before running the script. Once > the script is run, one can re-enable SIP. > > See > https://gist.github.com/sv99/c9d8c155db7db83325847bd33b25e1d0 > > I assume you used *tapi stubify *and did manually what was in this script. > > If you used a different approach, please let me know. > > Rob > -- > *From:* macports-dev on behalf > of Ken Cunningham > *Sent:* August 18, 2022 2:34 PM > *To:* MacPorts Developers > *Subject:* Re: ld: waning messages -- Frameworks out of sync. > > > 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 > > If you do that, you will possibly override MacPorts setting of SDKROOT, and > this is likely to cause you many problems when building ports. > > I would suggest you just ignore the warning -- the linker knows to use the > library if the TBD file is out of sync, as it has said in it's message. > > Otherwise, you can fix the TBD file (which is what I did) by using the tapi > tool: > > $ tapi > OVERVIEW: Text-based Stubs Tool > > USAGE: tapi [--version][--help] >tapi [] > > Commands: > archive Merge or thin text-based stub files > stubify Create a text-based stub file from a library > installapi Create a text-based stub file by scanning the header files > reexportCreate a linker reexport file by scanning the header files > > See 'tapi --help' to read more about a specific command. > > Of course, you may not want to do that -- but that is less intrusive than > setting the SDKROOT I would say, if the warnings are really bothersome to you. > > Best, > > Ken > >