-
Notifications
You must be signed in to change notification settings - Fork 70
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
QtCore not found. #885
Comments
Thanks for taking the time to report this issue, are you able to provide your CMake file ? As note you need to ensure that the
Otherwise it could be one of the issues on macOS where libraries aren't where we are expecting. |
Thanks for replying ! All cmake file all original. The only change is I add a .vscode/settings.json under project root folder.
The mainly code block is this :
|
This is due to final running command |
Hi @dezbracaty , could you try modifying the You can do so by adding
Maybe that can help uncover what is going on... |
Of course.
|
Hm, I just noticed that this error already occurs when trying to link the build script itself. I was expecting it to be an issue caused by So this may indeed be a corrosion issue 🤔 |
By the way, @dezbracaty, if you don't necessarily need CMake, you could also try building the That doesn't need CMake, so might work for you for now. |
Thanks for your suggestion. In fact , I need use cmake because I want to use rust in a cmake-build qml project. I think this is a very awesome project and I think there are just a small step to success! |
I don't really find where the "clang xxx" command generated , I think the work flow is corrosion use cmake's add_custom_command call cargo ,and cargo call clang . |
I fixed this bug finally.
in /cxx-qt/crates/cxx-qt/build.rs But, the question is , this method I hard coding this line into build.rs , that not a good method to fix the issue . |
Thanks for finding the correct link search ! This is likely something missing in
cxx-qt/crates/qt-build-utils/src/parse_cflags.rs Lines 133 to 135 in d78c8cb
Are you able to see what the And note that it is called by cxx-qt/crates/qt-build-utils/src/lib.rs Lines 381 to 387 in d78c8cb
Note that this method is called by cxx-qt/crates/qt-build-utils/src/lib.rs Lines 465 to 469 in d78c8cb
|
Thanks for replying . And the whole output is :
So , maybe function not received any parameter with "-F" is key point? |
I have the same issue after updating to latest main. The issue seems to be commit 551800363671c511d783f7e4c465753a891c8c9a:
If I try the previous one it works: 77bef00f27bca231fe8b8376501d5ab8477fc793 macOS 14.4.1, AppleClang 15.0.0.15000309 (XCode 15.3) |
Interesting find ! That's when we starting building CXX bridges in the |
@dezbracaty, so from what you found out it looks like the Which is information that should be extracted from the prl file. @nikolaseu or @dezbracaty Could you share the contents of your prl file, so we can take a look ( @dezbracaty In case its not too much trouble, could you try the commit 77bef00f27bca231fe8b8376501d5ab8477fc793, as suggested by @nikolaseu . |
I'm using Qt6, these are the contents of
|
Some notes when looking initially at this, we have some cxx-qt/crates/qt-build-utils/src/lib.rs Line 439 in f82ab4e
Still need to investigate how to determine the right circumstances and the code change. |
Interesting so the docs state that when you don't specify a kind of link search it should try all, and from those logs above it looks like
https://doc.rust-lang.org/rustc/command-line-arguments.html#option-l-search-path |
I note that you needed to add this into the But i also note that this is also calling cargo_link_libraries and should be adding @dezbracaty Are you able to provide the output of |
Also @dezbracaty and @nikolaseu could you see if this change helps at all ? #913 |
It works for me! Thanks |
@nikolaseu awesome ! Do you know / are you able to show what the contents of QT_INSTALL_LIBS is ? This is the As i wondered if when you have Qt installed in a frameworks mode are there only frameworks in that folder ? As if we set But maybe this folder exclusively contains frameworks in your setup ? |
|
Interesting thanks ! So appears most are frameworks other than those last few static libraries (although most look like they are rarely used or linked from elsewhere) Wonder if us effectively calling the following means that the directory is still added as a normal search path as well as a frameworks one. println!("cargo:rustc-link-search=/opt/homebrew/Cellar/qt@5/5.15.12_1/lib");
println!("cargo:rustc-link-search=framework=/opt/homebrew/Cellar/qt@5/5.15.12_1/lib"); |
@ahayzen-kdab Can you test what happens if you just unconditionally emit the If your hunch is correct and it then searches for both, we could maybe just do that and not have to special-case the frameworks. |
@LeonMatthesKDAB seems to build on Linux doing this, i wonder if we just always enable this for apple targets? |
Appears there is even a unit test checking this And looks like this is the case in the parsing code too |
That test isn't exactly the same as our case, but you can see how library paths is a vector and not a set, so it should search for both |
@dezbracaty or @nikolaseu are you able to double check that the changes still work in #913 ? |
works for me |
Sorry I just look this message.
Do you found any question?
First of all, it specify a qt header directory as "-I" "/Users/allen/Soft/Qt/6.5.3/macos/include/QtCore", In my machine , it is "/Users/allen/Soft/Qt/6.5.3/macos/lib/QtCore.framework/Versions/A/Headers/QObject",So did it correct parse the header and lib path ??? |
So it looks like it's picked up the right link folder and linker arg?
But it's the include paths that are potentially wrong now, looking at this code it appears to naively add the Qt modules as the folder names to the include path when it could be a framework. Maybe we need some specific logic here as well for frameworks ? cxx-qt/crates/qt-build-utils/src/lib.rs Lines 520 to 530 in 309190a
@dezbracaty are you able to run the following commands so i can understand what this looks like on macOS? Reading around it appears we might want to add something like $ qmake -query
$ ls -la /Users/allen/Soft/Qt/6.5.3/macos/
$ ls -la /Users/allen/Soft/Qt/6.5.3/macos/include/
$ ls -la /Users/allen/Soft/Qt/6.5.3/macos/include/QtCore.framework
$ ls -la /Users/allen/Soft/Qt/6.5.3/macos/lib/
$ ls -la /Users/allen/Soft/Qt/6.5.3/macos/lib/QtCore.framework/
$ ls -la /Users/allen/Soft/Qt/6.5.3/macos/lib/QtCore.framework/Headers |
Hmm but also an |
So thinking about this more i think the issue is more subtle, we are telling cargo correctly where the framework folder is to include and link to (this can be seen by But we are not telling our inner |
@dezbracaty are you able to try out #970 and see if that changes anything? Could you also provide the output of the build again so i can see if it changes anything? |
Thanks for your replying ! |
Your changes is same as me. But if you fix this problem by using -F ,then there will be a @rpath error . |
system : macos
buildIDE: vscode
.vscode/settings.json:
The text was updated successfully, but these errors were encountered: