Closed DerKleinePunk closed 1 year ago
Hi,
The log doesn't seem to contain the actual error. Is there more to it before?
I can't reproduce this either. Could you try running with build with ninja -v
?
[0/7] cd /home/punky/develop/EvaluationSlintUi/build/Debug/_deps/slint-src/api/cpp && /usr/local/bin/cmake -E env SLINT_GENERATED_INCLUDE_DIR=/home/punky/develop/Evalu
ationSlintUi/build/Debug/_deps/slint-build/generated_include/ SLINT_NO_QT=1 CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_LINKER=/usr/bin/x86_64-linux-gnu-g++-10 CC_x86_64-unknown-linux-gnu=/usr/bin/x86_64-linux-gnu-gcc-10 CXX_x86_64-unknown-linux-gnu=/usr/bin/x86_64-linux-gnu-g++-10 CORROSION_BUILD_DIR=/home/punky/develop/EvaluationSlintUi/build/Debug/_deps/slint-build CARGO_BUILD_RUSTC=/home/punky/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/rustc /home/punky/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/cargo rustc --lib --target=x86_64-unknown-linux-gnu --no-default-features --features=interpreter,backend-winit,renderer-winit-femtovg --package slint-cpp --manifest-path /home/punky/develop/EvaluationSlintUi/build/Debug/_deps/slint-src/api/cpp/Cargo.toml --target-dir /home/punky/develop/EvaluationSlintUi/build/Debug/./cargo/build -- -Cdefault-linker-libraries=yes Finished dev [unoptimized + debuginfo] target(s) in 0.26s
[1/7] cd /home/punky/develop/EvaluationSlintUi/build/Debug/_deps/slint-src/tools/compiler && /usr/local/bin/cmake -E env CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_LINKER=/
usr/bin/x86_64-linux-gnu-g++-10 CC_x86_64-unknown-linux-gnu=/usr/bin/x86_64-linux-gnu-gcc-10 CXX_x86_64-unknown-linux-gnu=/usr/bin/x86_64-linux-gnu-g++-10 CORROSION_BUILD_DIR=/home/punky/develop/EvaluationSlintUi/build/Debug/_deps/slint-build CARGO_BUILD_RUSTC=/home/punky/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/rustc /home/punky/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/cargo rustc --bin=slint-compiler --target=x86_64-unknown-linux-gnu --package slint-compiler --manifest-path /home/punky/develop/EvaluationSlintUi/build/Debug/_deps/slint-src/tools/compiler/Cargo.toml --target-dir /home/punky/develop/EvaluationSlintUi/build/Debug/./cargo/build -- -Cdefault-linker-libraries=yes Finished dev [unoptimized + debuginfo] target(s) in 0.19s
[2/7] cd /home/punky/develop/EvaluationSlintUi/build/Debug/_deps/slint-build && /usr/local/bin/cmake -E make_directory /home/punky/develop/EvaluationSlintUi/build/Debu
g/_deps/slint-build && /usr/local/bin/cmake -E copy_if_different /home/punky/develop/EvaluationSlintUi/build/Debug/./cargo/build/x86_64-unknown-linux-gnu/debug/libslint_cpp.so /home/punky/develop/EvaluationSlintUi/build/Debug/_deps/slint-build [4/7] cd /home/punky/develop/EvaluationSlintUi/build/Debug/_deps/slint-build && /usr/local/bin/cmake -E make_directory /home/punky/develop/EvaluationSlintUi/build/Debu
g/_deps/slint-build && /usr/local/bin/cmake -E copy_if_different /home/punky/develop/EvaluationSlintUi/build/Debug/./cargo/build/x86_64-unknown-linux-gnu/debug/slint-compiler /home/punky/develop/EvaluationSlintUi/build/Debug/_deps/slint-build [5/7] cd /home/punky/develop/EvaluationSlintUi/build/Debug && /home/punky/develop/EvaluationSlintUi/build/Debug/_deps/slint-build/slint-compiler /home/punky/develop/Ev
aluationSlintUi/src/ui/mainWindow.slint -o src/TestApp/mainWindow.h --depfile src/TestApp/mainWindow.d --style fluent --embed-resources=as-absolute-path && /usr/local/bin/cmake -E cmake_transform_depfile Ninja gccdepfile /home/punky/develop/EvaluationSlintUi /home/punky/develop/EvaluationSlintUi/src/TestApp /home/punky/develop/EvaluationSlintUi/build/Debug /home/punky/develop/EvaluationSlintUi/build/Debug/src/TestApp /home/punky/develop/EvaluationSlintUi/build/Debug/src/TestApp/mainWindow.d /home/punky/develop/EvaluationSlintUi/build/Debug/CMakeFiles/d/8f95644e58f18a99ff162d2792d2da53bacea92e8d2ac4a377c38039aab95a7c.d FAILED: src/TestApp/mainWindow.h /home/punky/develop/EvaluationSlintUi/build/Debug/src/TestApp/mainWindow.h
cd /home/punky/develop/EvaluationSlintUi/build/Debug && /home/punky/develop/EvaluationSlintUi/build/Debug/_deps/slint-build/slint-compiler /home/punky/develop/Evaluati
onSlintUi/src/ui/mainWindow.slint -o src/TestApp/mainWindow.h --depfile src/TestApp/mainWindow.d --style fluent --embed-resources=as-absolute-path && /usr/local/bin/cmake -E cmake_transform_depfile Ninja gccdepfile /home/punky/develop/EvaluationSlintUi /home/punky/develop/EvaluationSlintUi/src/TestApp /home/punky/develop/EvaluationSlintUi/build/Debug /home/punky/develop/EvaluationSlintUi/build/Debug/src/TestApp /home/punky/develop/EvaluationSlintUi/build/Debug/src/TestApp/mainWindow.d /home/punky/develop/EvaluationSlintUi/build/Debug/CMakeFiles/d/8f95644e58f18a99ff162d2792d2da53bacea92e8d2ac4a377c38039aab95a7c.d ninja: build stopped: subcommand failed.
ninja -v
unky@linux-dell-9010:~/develop/EvaluationSlintUi/build/Debug/_deps/slint-build$ ./slint-compiler --version slint-compiler 1.0.0
I Think the Lint Compiler has an Problem but say noting
So what does this do:
cd /home/punky/develop/EvaluationSlintUi/build/Debug && \
/home/punky/develop/EvaluationSlintUi/build/Debug/_deps/slint-build/slint-compiler \
/home/punky/develop/EvaluationSlintUi/src/ui/mainWindow.slint -o src/TestApp/mainWindow.h \
--depfile src/TestApp/mainWindow.d --style fluent \
--embed-resources=as-absolute-path
What is the exit code? Any errors?
What about the second part of the failing command line:
/usr/local/bin/cmake -E cmake_transform_depfile Ninja gccdepfile \
/home/punky/develop/EvaluationSlintUi \
/home/punky/develop/EvaluationSlintUi/src/TestApp \
/home/punky/develop/EvaluationSlintUi/build/Debug \
/home/punky/develop/EvaluationSlintUi/build/Debug/src/TestApp \
/home/punky/develop/EvaluationSlintUi/build/Debug/src/TestApp/mainWindow.d \
/home/punky/develop/EvaluationSlintUi/build/Debug/CMakeFiles/d/8f95644e58f18a99ff162d2792d2da53bacea92e8d2ac4a377c38039aab95a7c.d
The last is in one line just in case github messed this up...
I tried to reproduce with your repository, but it compile fine. It looks like the Slint compiler fails, but doesn't display any warning or error. Perhaps it crashed, but even then it should have printed something. The log your pasting is difficult to read. Are you using a particular IDE that would perhaps report error elsewhere?
Can you try passing -j1
to ninja so it doesn't do things in parallel.
punky@linux-dell-9010:~/develop/EvaluationSlintUi/build/Debug$ /usr/local/bin/cmake -E cmake_transform_depfile Ninja gccdepfile \
/home/punky/develop/EvaluationSlintUi \
/home/punky/develop/EvaluationSlintUi/src/TestApp \
/home/punky/develop/EvaluationSlintUi/build/Debug \
/home/punky/develop/EvaluationSlintUi/build/Debug/src/TestApp \
/home/punky/develop/EvaluationSlintUi/build/Debug/src/TestApp/mainWindow.d \
/home/punky/develop/EvaluationSlintUi/build/Debug/CMakeFiles/d/8f95644e58f18a99ff162d2792d2da53bacea92e8d2ac4a377c38039aab95a7c.d
punky@linux-dell-9010:~/develop/EvaluationSlintUi/build/Debug$ echo $?
2
punky@linux-dell-9010:~/develop/EvaluationSlintUi/build/Debug$ /home/punky/develop/EvaluationSlintUi/build/Debug/_deps/slint-build/slint-compiler /home/punky/develop/EvaluationSlintUi/src/ui/mainWindow.slint -o src/TestApp/mainWindow.h --depfile src/TestApp/mainWindow.d --style fluent --embed-resources=as-absolute-path
punky@linux-dell-9010:~/develop/EvaluationSlintUi/build/Debug$ echo $?
0
punky@linux-dell-9010:~/develop/EvaluationSlintUi/build/Debug$ cmake --build . -v
[0/7] cd /home/punky/develop/EvaluationSlintUi/build/Debug/_deps/slint-src/api/cpp && /usr/local/bin/cmake -E env SLINT_GENERATED_INCLUDE_DIR=/home/punky/develop/EvaluationSlintUi/build/Debug/_deps/slint-build/generated_include/ SLINT_NO_QT=1 CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_LINKER=/usr/bin/x86_64-linux-gnu-g++-10 CC_x86_64-unknown-linux-gnu=/usr/bin/x86_64-linux-gnu-gcc-10 CXX_x86_64-unknown-linux-gnu=/usr/bin/x86_64-linux-gnu-g++-10 CORROSION_BUILD_DIR=/home/punky/develop/EvaluationSlintUi/build/Debug/_deps/slint-build CARGO_BUILD_RUSTC=/home/punky/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/rustc /home/punky/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/cargo rustc --lib --target=x86_64-unknown-linux-gnu --no-default-features --features=interpreter,backend-winit,renderer-winit-femtovg --package slint-cpp --manifest-path /home/punky/develop/EvaluationSlintUi/build/Debug/_deps/slint-src/api/cpp/Cargo.toml --target-dir /home/punky/develop/EvaluationSlintUi/build/Debug/./cargo/build -- -Cdefault-linker-libraries=yes
Finished dev [unoptimized + debuginfo] target(s) in 0.25s
[1/7] cd /home/punky/develop/EvaluationSlintUi/build/Debug/_deps/slint-src/tools/compiler && /usr/local/bin/cmake -E env CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_LINKER=/usr/bin/x86_64-linux-gnu-g++-10 CC_x86_64-unknown-linux-gnu=/usr/bin/x86_64-linux-gnu-gcc-10 CXX_x86_64-unknown-linux-gnu=/usr/bin/x86_64-linux-gnu-g++-10 CORROSION_BUILD_DIR=/home/punky/develop/EvaluationSlintUi/build/Debug/_deps/slint-build CARGO_BUILD_RUSTC=/home/punky/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/rustc /home/punky/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/cargo rustc --bin=slint-compiler --target=x86_64-unknown-linux-gnu --package slint-compiler --manifest-path /home/punky/develop/EvaluationSlintUi/build/Debug/_deps/slint-src/tools/compiler/Cargo.toml --target-dir /home/punky/develop/EvaluationSlintUi/build/Debug/./cargo/build -- -Cdefault-linker-libraries=yes
Finished dev [unoptimized + debuginfo] target(s) in 0.18s
[2/7] cd /home/punky/develop/EvaluationSlintUi/build/Debug/_deps/slint-build && /usr/local/bin/cmake -E make_directory /home/punky/develop/EvaluationSlintUi/build/Debug/_deps/slint-build && /usr/local/bin/cmake -E copy_if_different /home/punky/develop/EvaluationSlintUi/build/Debug/./cargo/build/x86_64-unknown-linux-gnu/debug/libslint_cpp.so /home/punky/develop/EvaluationSlintUi/build/Debug/_deps/slint-build
[4/7] cd /home/punky/develop/EvaluationSlintUi/build/Debug/_deps/slint-build && /usr/local/bin/cmake -E make_directory /home/punky/develop/EvaluationSlintUi/build/Debug/_deps/slint-build && /usr/local/bin/cmake -E copy_if_different /home/punky/develop/EvaluationSlintUi/build/Debug/./cargo/build/x86_64-unknown-linux-gnu/debug/slint-compiler /home/punky/develop/EvaluationSlintUi/build/Debug/_deps/slint-build
[5/7] cd /home/punky/develop/EvaluationSlintUi/build/Debug && /home/punky/develop/EvaluationSlintUi/build/Debug/_deps/slint-build/slint-compiler /home/punky/develop/EvaluationSlintUi/src/ui/mainWindow.slint -o src/TestApp/mainWindow.h --depfile src/TestApp/mainWindow.d --style fluent --embed-resources=as-absolute-path && /usr/local/bin/cmake -E cmake_transform_depfile Ninja gccdepfile /home/punky/develop/EvaluationSlintUi /home/punky/develop/EvaluationSlintUi/src/TestApp /home/punky/develop/EvaluationSlintUi/build/Debug /home/punky/develop/EvaluationSlintUi/build/Debug/src/TestApp /home/punky/develop/EvaluationSlintUi/build/Debug/src/TestApp/mainWindow.d /home/punky/develop/EvaluationSlintUi/build/Debug/CMakeFiles/d/8f95644e58f18a99ff162d2792d2da53bacea92e8d2ac4a377c38039aab95a7c.d
FAILED: src/TestApp/mainWindow.h /home/punky/develop/EvaluationSlintUi/build/Debug/src/TestApp/mainWindow.h
cd /home/punky/develop/EvaluationSlintUi/build/Debug && /home/punky/develop/EvaluationSlintUi/build/Debug/_deps/slint-build/slint-compiler /home/punky/develop/EvaluationSlintUi/src/ui/mainWindow.slint -o src/TestApp/mainWindow.h --depfile src/TestApp/mainWindow.d --style fluent --embed-resources=as-absolute-path && /usr/local/bin/cmake -E cmake_transform_depfile Ninja gccdepfile /home/punky/develop/EvaluationSlintUi /home/punky/develop/EvaluationSlintUi/src/TestApp /home/punky/develop/EvaluationSlintUi/build/Debug /home/punky/develop/EvaluationSlintUi/build/Debug/src/TestApp /home/punky/develop/EvaluationSlintUi/build/Debug/src/TestApp/mainWindow.d /home/punky/develop/EvaluationSlintUi/build/Debug/CMakeFiles/d/8f95644e58f18a99ff162d2792d2da53bacea92e8d2ac4a377c38039aab95a7c.d
ninja: build stopped: subcommand failed.
Display no Error or Warning is my Problem to find an solution.
Great, so the Slint compiler runs fine, cmake fails afterwards when trying to process the files.
In CMake 3.26 I can not find any docs on what that command does, only hints about that it changed in version 3.20. So maybe this is one of those areas in flux in CMake at this time? Which version of CMake are you using?
Debian 11 apparently has cmake version 3.18.4, which is too old for us. I assume you use a newer one? Maybe it is due to cmake 3.20+ generating the build system and then somehow cmake 3.18 ends up driving the build? CMake should catch that though.
Your demo project builds fine on Windows 11 using cmake 3.26.2, but that does of course not help you on Debian 11 ;-)
On my Debian the CMake version is 3.21.3
On Windows 10 With CMake 3.26.3 and VS 2022 Compiler it also can Compile.
On Debian with CMake 3.26.3 is also Compiling now but the path to libslint_cpp.so is hardcoded why ?
punky@linux-dell-9010:~/develop/EvaluationSlintUi/bin/Linux$ ./SlintUiTestApp.bin
./SlintUiTestApp.bin: error while loading shared libraries: _deps/slint-build/libslint_cpp.so: cannot open shared object file: No such file or directory
Do you happen to know what you did to make your code build on Debian 11? Anything we can try to handle/document for the next user?
I don't know what the problem is in CMake. I have Updated the CMake to 3.26.3 and run Build now is building with the Last Problem that the Path ist hardcoded in the Binary that ist not good.
I don't understand this
So I can close this issue :-) Please feel free to open another one about your linking issue.
You asked CMake to fetch and build Slint in your CMakeLists.txt. It did and put it into _deps/
and made sure that library will be found by hard-coding that path into the binary. The surprising part is that apparently that library is not where CMake expects it to be.
Last Problem that the Path ist hardcoded in the Binary that ist not good.
Can you explain a little what the problem is? Does it not find the library when running, or do you want to prepare your binary for distribution and therefore replace the absolute path with a path relative to the binary?
If it's the latter, then perhaps you may want to run chrpath on the binary and change the rpath to be relative, like this: chrpath -r “\$\ORIGIN/libslint_cpp.so.1.0.0” <executable>
punky@linux-dell-9010:~/develop/EvaluationSlintUi/bin/Linux$ chrpath -l SlintUiTestApp.bin
SlintUiTestApp.bin: no rpath or runpath tag found.
punky@linux-dell-9010:~/develop/EvaluationSlintUi/bin/Linux$ ./SlintUiTestApp.bin
./SlintUiTestApp.bin: error while loading shared libraries: _deps/slint-build/libslint_cpp.so: cannot open shared object file: No such file or directory
punky@linux-dell-9010:~/develop/EvaluationSlintUi/bin/Linux$
It do not Work my Build Dir is bin/Linux
Do you have libslint_cpp.so somewhere below your build directory?
I can reproduce the problem trying to build your app from your repository with make.
if i do VERBOSE=1 make
the link command appear to be:
cd /tmp/EvaluationSlintUi/build/src/TestApp && /usr/bin/cmake -E cmake_link_script CMakeFiles/SlintUiTestApp.bin.dir/link.txt --verbose=1
/usr/bin/c++ CMakeFiles/SlintUiTestApp.bin.dir/main.cpp.o -o /tmp/EvaluationSlintUi/bin/Linux/SlintUiTestApp.bin -Wl,-rpath,"\$ORIGIN/../lib:\$ORIGIN/" ../../_deps/slint-build/libslint_cpp.so
And the relative rpath path seems indeed a bad idea.
I see this in CMakeLists.txt
:
set(CMAKE_SKIP_BUILD_RPATH TRUE)
set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH FALSE)
SET(CMAKE_INSTALL_RPATH "$ORIGIN/../lib:$ORIGIN/")
This instructs CMake to generate a relative rpath for the artifacts in the build directory as well as for what's installed.
To be able to run the resulting binary from the build directory, the slint library would then have to be placed in the build directory relative to the application binary, but I don't see any instructions in CMakeLists.txt for that.
@DerKleinePunk what's the desired setup you'd like to have for the binary after it's being built and after being installed?
Sorry for late Response After Build not after Install
in .vscode dir is an lauch.json i will use this to Debug the Application
I can reproduce this issue locally now. I think https://github.com/slint-ui/slint/pull/2731 fixes this. I'll check.
So with https://github.com/slint-ui/slint/pull/2731 and the following patch below I get what I think is the correct initial result:
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f766fde..db24132 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -5,8 +5,6 @@ SET(SLINT_FEATURE_BACKEND_QT OFF)
#Set CMake variables to disable rpath
-#set(CMAKE_SKIP_BUILD_RPATH TRUE)
-set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH FALSE)
SET(CMAKE_INSTALL_RPATH "$ORIGIN/../lib:$ORIGIN/")
@@ -16,13 +14,11 @@ FetchContent_Declare(
GIT_REPOSITORY https://github.com/slint-ui/slint.git
# `release/1` will auto-upgrade to the latest Slint >= 1.0.0 and < 2.0.0
# `release/1.0` will auto-upgrade to the latest Slint >= 1.0.0 and < 1.1.0
- GIT_TAG release/1
+ GIT_TAG master
SOURCE_SUBDIR api/cpp
)
FetchContent_MakeAvailable(Slint)
-SET_TARGET_PROPERTIES(Slint PROPERTIES NO_SONAME 1)
-
SET (MAINFOLDER ${PROJECT_SOURCE_DIR})
IF("${TARGET}" STREQUAL "")
Correct dependency without slashes in the path:
$ patchelf --print-needed bin/Linux/SlintUiTestApp.bin
libslint_cpp.so
libstdc++.so.6
libgcc_s.so.1
libc.so.6
Rpath on the build artefact set correctly:
$ patchelf --print-rpath bin/Linux/SlintUiTestApp.bin
/home/slint/src/EvaluationSlintUi/build/_deps/slint-build
What's needed next is support for installation. I think this should be tracked in https://github.com/slint-ui/slint-cpp-template/issues/14 .
No idea fix this Error
https://github.com/DerKleinePunk/EvaluationSlintUi