slint-ui / slint-cpp-template

A template for a C++ Application using Slint
https://slint.dev
MIT License
45 stars 11 forks source link

Launch directory in the README gives error #12

Closed suarezvictor closed 1 year ago

suarezvictor commented 1 year ago

There's an error with the command line to run the example

$ ./build/my_application
./build/my_application: error while loading shared libraries: _deps/slint-build/libslint_cpp.so: cannot open shared object file: No such file or directory

Workaround

$ cd build
$ ./my_application

Tested on Debian 11

tronical commented 1 year ago

This is fixed now in the master branch of slint and will be part of the next release. As a temporary workaround, you could set your GIT_TAG in CMakeLists.txt to master.

Before the build with master:

$ patchelf --print-needed build/my_application
_deps/slint-build/libslint_cpp.so
libstdc++.so.6
libgcc_s.so.1
libc.so.6
$ patchelf --print-rpath build/my_application
/home/slint/src/slint-cpp-template/build/_deps/slint-build

After the build with master:

$ patchelf --print-needed build/my_application
libslint_cpp.so
libstdc++.so.6
libgcc_s.so.1
libc.so.6
$ patchelf --print-rpath build/my_application
/home/slint/src/slint-cpp-template/build/_deps/slint-build

So libslint_cpp.so is a dependency that has no slash in its name, therefore ld.so uses the usual mechanisms such as LD_LIBRARY_PATH, DT_RPATH, etc. - and rpath is now set to where the library is located.