dyld: Library not loaded: /usr/local/opt/gtk+3/lib/libgtk-3.0.dylib
huangyehui opened this issue · comments
when I use 'cargo build --release' build exe. I can not excute on anther pc which did not install gtk.The error info showed as title.
I try to copy all the dependency libraries in the exe`s directory. But still not work.Is someone know the reson? need help:)
You need to install GTK into the same directory as on the machine where you built it, or use otool
to relocate things. This is unrelated to GTK or the bindings but a generic macOS development question.
Generally it's a better idea to install GTK next to your application so that you can bundle both together and use otool
to have the dynamic library loader search for the libraries relative to the executable.
Just installing gtk through homebrew worked fine for me. No idea otherwise.
Yes but you need to install it via homebrew on both sides then.
You need to install GTK into the same directory as on the machine where you built it, or use
otool
to relocate things. This is unrelated to GTK or the bindings but a generic macOS development question.Generally it's a better idea to install GTK next to your application so that you can bundle both together and use
otool
to have the dynamic library loader search for the libraries relative to the executable.
thanks for reply. I am a newbie in rust. I am still confuse that how to produce a release application with gtk in a easy way。A c/c++ application can bundle dynamic lib if lib exist in the same directory . so that the application can run on a pc without install dependency libs。
So I guess gtk lib also can be bundled easily by assign path in cargo.toml. But I have not find the right way.
If develop a application with gtk-rs and send it to users. My I have a common way to do that? as I know it is easy to bundle dependency libraries on Android,MFC...
It's the same with C/C++ on macOS. Linking is by default always with the full absolute path, which you can adjust afterwards with otool
.
My suggestion would be to have GTK and its dependencies as part of application installation directory, and adjust the library paths to be relative via otool
. That's (from my understanding) the normal approach to do things on macOS.
It's the same with C/C++ on macOS. Linking is by default always with the full absolute path, which you can adjust afterwards with
otool
.My suggestion would be to have GTK and its dependencies as part of application installation directory, and adjust the library paths to be relative via
otool
. That's (from my understanding) the normal approach to do things on macOS.
Thansk a lot, I will try :)