Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dyld library not loaded (QtWidgets); Reason: Image not found [macOS] [question] #1107

Open
apadmanabhan07 opened this issue Mar 18, 2021 · 10 comments
Labels
help wanted Extra attention is needed

Comments

@apadmanabhan07
Copy link

Bug report

Required Info:

  • Operating System:

    • MacOS Big Sur (11.2.3)
  • Installation type:

    • ROS2 Foxy (binary)

Steps to reproduce issue

Executing "ros2 run turtlesim turtlesim_node" results in the following error:

dyld: Library not loaded: /usr/local/opt/qt/lib/QtWidgets.framework/Versions/5/QtWidgets
Referenced from: /Path/to/directory/ros2_foxy/install/turtlesim/lib/turtlesim/turtlesim_node
Reason: image not found

Additional information

The same workspace and installation worked perfectly in the previous version of the OS (11.2.2) without any glitches. There was no update/changes, either to the ros2 or Qt directories, between the two versions. I understand Big Sur is not officially supported for Foxy, but since it worked well on one version (Rviz, Gazebo and all in 11.2.2) I'm just a little hopeful.

@apadmanabhan07 apadmanabhan07 changed the title dyld library not loaded (QtWidgets); Reason: Image not found dyld library not loaded (QtWidgets); Reason: Image not found [Macos] [question] Mar 18, 2021
@apadmanabhan07 apadmanabhan07 changed the title dyld library not loaded (QtWidgets); Reason: Image not found [Macos] [question] dyld library not loaded (QtWidgets); Reason: Image not found [macOS] [question] Mar 18, 2021
@clalancette clalancette added the help wanted Extra attention is needed label Mar 18, 2021
@clalancette
Copy link
Contributor

If you can identify and fix the issue, we're happy to review a patch for it. But given that it isn't one of the supported platforms, we won't likely be spending any time on it ourselves.

@Spicedwater
Copy link

Hi @AniPadmanabhan, I had this problem too and found this thread helpful:
https://stackoverflow.com/questions/17703510/dyld-library-not-loaded-reason-image-not-found

First I would make sure you have qt5 installed using brew list qt@5 and if you haven't, install it, brew install qt@5.

The installed packages should be located in /usr/local/Cellar/qt@5

Using otool -L /Path/to/directory/ros2_foxy/install/turtlesim/lib/turtlesim/turtlesim_node will show you where it is looking for the faulty image. Then use install_name_tool -change /old/path /new/path /path/to/exe to change the location ros2 searches for the image.

I had 3 errors when running this myself (QtWidgets, QtGUI, and QtCore)

I hope this helps!

@hk-zh
Copy link

hk-zh commented May 9, 2021

Yes, exactly @Spicedwater. It works for me. I just changed this path /usr/local/opt/qt/lib/QtWidgets.framework/Versions/5/QtWidgets to /usr/local/opt/qt@5/lib/QtWidgets.framework/Versions/5/QtWidgets with the command install_name_tool -change xxx xxx xxx

@chetanpm
Copy link

chetanpm commented Nov 24, 2021

Yes, exactly @Spicedwater. It works for me. I just changed this path /usr/local/opt/qt/lib/QtWidgets.framework/Versions/5/QtWidgets to /usr/local/opt/qt@5/lib/QtWidgets.framework/Versions/5/QtWidgets with the command install_name_tool -change xxx xxx xxx

What is the path to the executable? is it the Qt5 exec?

@wgrand
Copy link

wgrand commented Dec 29, 2021

Using otool -L /Path/to/directory/ros2_foxy/install/turtlesim/lib/turtlesim/turtlesim_node will show you where it is looking for the faulty image. Then use install_name_tool -change /old/path /new/path /path/to/exe to change the location ros2 searches for the image.

Certainly I am not understanding some fundamentals, but what is /path/to/exe in this case? On macOS Monterrey (12.1), I put in:

install_name_tool -change /usr/local/opt/qt/lib/QtWidgets.framework/Versions/5/QtWidgets /usr/local/opt/qt@5/lib/QtWidgets.framework/Versions/5/QtWidgets

But, I get:

Usage: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/install_name_tool [-change old new] ... [-rpath old new] ... [-add_rpath new] ... [-delete_rpath old] ... [-id name] input

@Spicedwater
Copy link

Spicedwater commented Dec 29, 2021

Yes, exactly @Spicedwater. It works for me. I just changed this path /usr/local/opt/qt/lib/QtWidgets.framework/Versions/5/QtWidgets to /usr/local/opt/qt@5/lib/QtWidgets.framework/Versions/5/QtWidgets with the command install_name_tool -change xxx xxx xxx

What is the path to the executable? is it the Qt5 exec?

Hi, the executable in this case is the ros2 executable. In my example that is the turtlesim_node exe. Change this for the executable that you are trying to run and hope for the best!

what this command is doing is changing where the executable is looking for it’s dependencies. The error arises when the executable looks where it has been told to look, but cannot find what it has been told to look for. We are just telling the executable to look in a new place.

If this doesn’t work, I will be back at my work computer in a few days and can look into it

good luck!

@Spicedwater
Copy link

Using otool -L /Path/to/directory/ros2_foxy/install/turtlesim/lib/turtlesim/turtlesim_node will show you where it is looking for the faulty image. Then use install_name_tool -change /old/path /new/path /path/to/exe to change the location ros2 searches for the image.

Certainly I am not understanding some fundamentals, but what is /path/to/exe in this case? On macOS Monterrey (12.1), I put in:

install_name_tool -change /usr/local/opt/qt/lib/QtWidgets.framework/Versions/5/QtWidgets /usr/local/opt/qt@5/lib/QtWidgets.framework/Versions/5/QtWidgets

But, I get:

Usage: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/install_name_tool [-change old new] ... [-rpath old new] ... [-add_rpath new] ... [-delete_rpath old] ... [-id name] input
“

Hi Wgrand,

I would see the above answer and make sure you are putting the executable in your command. The command as you have put it doesn’t make any sense as the command doesn’t know what executable to change.

@wgrand
Copy link

wgrand commented Dec 29, 2021

Yes, exactly @Spicedwater. It works for me. I just changed this path /usr/local/opt/qt/lib/QtWidgets.framework/Versions/5/QtWidgets to /usr/local/opt/qt@5/lib/QtWidgets.framework/Versions/5/QtWidgets with the command install_name_tool -change xxx xxx xxx

What is the path to the executable? is it the Qt5 exec?

Hi, the executable in this case is the ros2 executable. In my example that is the turtlesim_node exe. Change this for the executable that you are trying to run and hope for the best!

what this command is doing is changing where the executable is looking for it’s dependencies. The error arises when the executable looks where it has been told to look, but cannot find what it has been told to look for. We are just telling the executable to look in a new place.

If this doesn’t work, I will be back at my work computer in a few days and can look into it

good luck!

Thank you @Spicedwater! Here is what I did:

install_name_tool -change /usr/local/opt/qt/lib/QtWidgets.framework/Versions/5/QtWidgets /usr/local/opt/qt@5/lib/QtWidgets.framework/Versions/5/QtWidgets /path/to/turtlesim_node

And repeated the same command by replacing QtWidgets with QtGui and QtCore.

@wuyue92tree
Copy link

This work for me.

brew unlink qt
brew install qt@5
brew link --force qt@5

cd /usr/local/opt
rm qt
ln -s ../Cellar/qt@5/5.15.5 qt

@ifbbprochris
Copy link

@wuyue92tree it works for me, thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

8 participants