-
Notifications
You must be signed in to change notification settings - Fork 82
QML Modules defined in external crates don't work #1135
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
Comments
See: KDAB#1135 Note: This is not yet final, as this probably makes cxx_qt_import_qml_module redundant.
@akiselev Thank you for taking the time to report the issue and especially to create the reproducable example. That has really helped with troubleshooting. I was able to reproduce the issue and to find the root cause. With CMake, this isn't necessarily a problem, as you import the QML module separately via With Cargo-only builds, our assumption was that linking the object file directly would cause it to not be optimized out at the linking stage, even for dependencies. While the fix for cargo-only builds is quite simple (see: https://github.com/LeonMatthesKDAB/cxx-qt/tree/7952f55c1529df8d8a67b2278ea12d67f885412d ), a solution that also fixes the CMake integration needs a bit more thought. |
@LeonMatthesKDAB is there more to this fix than what I am seeing in the commit? When trying your modifications locally with my repro repo, I get the following error:
I get a similar error when building my main repo. Edit: I just cloned your fork to that commit and tried to build it, to the same result. I took a look using nm:
The linker stage links |
Hi @akiselev , thanks for pointing out that the link is wrong, I updated it to point to my fork instead. In your repro example, I'm on commit
So I just updated the cxx-qt repo to the commit I sent you. If I then do So that should work... |
I also added a fork of the repro example here: https://github.com/LeonMatthesKDAB/cxx-qt-module-repro You should just be able to clone it and do |
I tried building your repo and got the same error (cleaned up a little and added multilines):
Here's a little debug info dump about my OS:
Are you building on MacOS? Maybe the linker is less sensitive to the order of the object files? |
Switching the linker to For future reference, added this to the project [target.x86_64-unknown-linux-gnu]
linker = "clang"
rustflags = ["-C", "link-arg=-fuse-ld=/usr/bin/mold"] |
Yeah the link order of ld.bfd has caused lots of problems vs ld.gold / lld / mold :-/ We managed to fix things for a CMake build to have the right order and in theory cc/cargo internal steps should be avoiding ld.bfd, so maybe this is a subtly different case to before 😅 |
Oh no, @akiselev great that you figured out how to get it running, we can hopefully come up with a solution for 0.8 that doesn't have this issue. |
Repro: https://github.com/akiselev/cxx-qt-module-repro
Current output:
@LeonMatthes said in Zulip:
I think I've got all that covered but the repro still fails to load the module correct. In my own project, this works with CMake but not Cargo.
The text was updated successfully, but these errors were encountered: