Bug 433407 - install_name_tool failures make builds unusable
Summary: install_name_tool failures make builds unusable
Status: RESOLVED FIXED
Alias: None
Product: Craft
Classification: Developer tools
Component: Core (show other bugs)
Version: master
Platform: macOS (DMG) macOS
: NOR normal
Target Milestone: ---
Assignee: Hannah von Reth
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-02-21 21:42 UTC by Dawid Wróbel
Modified: 2021-06-08 05:40 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dawid Wróbel 2021-02-21 21:42:04 UTC
SUMMARY

KMyMoney app crashes when launched, most likely due to install_name_tool failing with exit code 1 and, as such, not fixing paths properly.

See the output for some details: https://binary-factory.kde.org/view/MacOS/job/KMyMoney_Release_macos/929/console

Also, install_name_tool failing should fail the whole build, as it currently yields a false-positive result.
Comment 1 Hannah von Reth 2021-02-21 22:16:57 UTC
If you mean delete rpath, you can ignore errors for that call.
Comment 2 Dawid Wróbel 2021-03-09 17:20:57 UTC
OK, so I suppose I jumped into conclusion here about install_name_tool failures causing the issue we're seeing (https://forum.kde.org/viewtopic.php?f=69&t=167626) in KMyMoney builds, which causes the App to fail to start due to missing QtTextToSpeech library:

Dyld Error Message:
  dyld: Using shared cache: 331D32F2-DC75-3EDE-91BC-EDC4B036B5C0
Library not loaded: @rpath/QtTextToSpeech.framework/Versions/5/QtTextToSpeech
  Referenced from: /Applications/kmymoney.app/Contents/Frameworks/libKF5TextWidgets.5.dylib
  Reason: image not found
Comment 3 Dawid Wróbel 2021-03-09 18:30:19 UTC
The libKF5TextWidgets.5.dylib links against QtTextToSpeech using rpath: 
~ otool -L /Applications/kmymoney.app/Contents/Frameworks/libKF5TextWidgets.5.dylib                                        
/Applications/kmymoney.app/Contents/Frameworks/libKF5TextWidgets.5.dylib:
	@executable_path/../Frameworks/libKF5TextWidgets.5.dylib (compatibility version 5.0.0, current version 5.79.0)
	@loader_path/libKF5SonnetUi.5.dylib (compatibility version 5.0.0, current version 5.79.0)
	@loader_path/libKF5SonnetCore.5.dylib (compatibility version 5.0.0, current version 5.79.0)
	@loader_path/libKF5ConfigWidgets.5.dylib (compatibility version 5.0.0, current version 5.79.0)
	@loader_path/libKF5Completion.5.dylib (compatibility version 5.0.0, current version 5.79.0)
	@rpath/QtTextToSpeech.framework/Versions/5/QtTextToSpeech (compatibility version 5.15.0, current version 5.15.2)
	@loader_path/libKF5I18n.5.dylib (compatibility version 5.0.0, current version 5.79.0)
	@loader_path/libKF5Codecs.5.dylib (compatibility version 5.0.0, current version 5.79.0)
	@loader_path/libKF5Auth.5.dylib (compatibility version 5.0.0, current version 5.79.0)
	@loader_path/libKF5AuthCore.5.dylib (compatibility version 5.0.0, current version 5.79.0)
	@loader_path/libKF5CoreAddons.5.dylib (compatibility version 5.0.0, current version 5.79.0)
	@loader_path/libKF5WidgetsAddons.5.dylib (compatibility version 5.0.0, current version 5.79.0)
	@rpath/QtWidgets.framework/Versions/5/QtWidgets (compatibility version 5.15.0, current version 5.15.2)
	@loader_path/libKF5ConfigGui.5.dylib (compatibility version 5.0.0, current version 5.79.0)
	@rpath/QtGui.framework/Versions/5/QtGui (compatibility version 5.15.0, current version 5.15.2)
	@rpath/QtXml.framework/Versions/5/QtXml (compatibility version 5.15.0, current version 5.15.2)
	@loader_path/libKF5ConfigCore.5.dylib (compatibility version 5.0.0, current version 5.79.0)
	@rpath/QtCore.framework/Versions/5/QtCore (compatibility version 5.15.0, current version 5.15.2)
	/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 800.7.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1281.0.0)

However, no LC_RPATH are set in the binary:

~ otool -l /Applications/kmymoney.app/Contents/MacOS/kmymoney | grep LC_RPATH
~ 

So the @rpaths cannot work as expected. Therefore I'd say that the "delete rpath" issues I originally reported *are*, in fact, relevant.
Comment 4 Dawid Wróbel 2021-03-09 19:50:03 UTC
Just to add evidence to my conclusion, I replaced the QtTextToSpeech rpath with an absolute path with:

install_name_tool -change @rpath/QtTextToSpeech.framework/Versions/5/QtTextToSpeech /Applications/kmymoney.app/Contents/Frameworks/QtTextToSpeech.framework/Versions/5/QtTextToSpeech /Applications/kmymoney.app/Contents/Frameworks/libKF5TextWidgets.5.dylib

Once done, it moved on until it stopped at another @rpath Qt lib. Replacing it with an absolute one again made it move on further. Rinse, repeat.

The rpaths don't work and AFIK this is expected if LC_RPATH is not defined in the executable.
Comment 5 Dawid Wróbel 2021-06-08 05:40:55 UTC
This has been fixed at some point during last month or so.