Bug 400393 - When using cargo for compilation, the C++ standard lib is incorrect on Windows when linking but not compiling.
Summary: When using cargo for compilation, the C++ standard lib is incorrect on Window...
Status: RESOLVED UNMAINTAINED
Alias: None
Product: rust-qt-binding-generator
Classification: Unmaintained
Component: general (other bugs)
Version First Reported In: unspecified
Platform: Microsoft Windows Microsoft Windows
: NOR crash
Target Milestone: ---
Assignee: Jos van den Oever
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-10-28 02:49 UTC by jacobjm18
Modified: 2024-09-22 20:07 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description jacobjm18 2018-10-28 02:49:37 UTC
SUMMARY

When using cargo for compilation, such as with the "qt_quick_cargo" template, if the C++ library is already compiled, then rust-qt-bindings-generator will output linker information, including the standard library stdc++. When compiling with stdc++, this fails because stdc++.lib does not exist.

The relevant code is here: https://github.com/KDE/rust-qt-binding-generator/blob/master/src/build.rs#L241

rust-qt-bindings-generator should replicate the behavior of the cc crate, which can be found here: https://github.com/alexcrichton/cc-rs/blob/master/src/lib.rs#L928

STEPS TO REPRODUCE
1. Compile the qt_quick_cargo template
2. Change main.rs to trigger a recompile of the rust code but not the C++ library
3. Recompile

OBSERVED RESULT

MSVC fails to link stdc++

EXPECTED RESULT

It should not try to link to stdc++

SOFTWARE VERSIONS
commit ed2de054928db6f02a13c97afee789b1de1eebcd

ADDITIONAL INFORMATION
Comment 1 Jos van den Oever 2018-10-28 21:05:46 UTC
Git commit 89c86642f8e39c1906da72333b431e72ba8dc268 by Jos van den Oever.
Committed on 28/10/2018 at 21:05.
Pushed by vandenoever into branch 'master'.

Print the c++ library that cargo should link against

This is used when calling "cargo build" when no actual recompile is needed.

M  +19   -1    src/build.rs

https://commits.kde.org/rust-qt-binding-generator/89c86642f8e39c1906da72333b431e72ba8dc268
Comment 2 Jos van den Oever 2018-10-28 21:06:52 UTC
Thank you for the bug report and pointer.

Commit 89c86642f8e39c1906da72333b431e72ba8dc268 should fix it.
Comment 3 Christoph Cullmann 2024-09-22 20:07:53 UTC
rust-qt-binding-generator is no longer maintained, please try more recent alternatives like

https://github.com/KDAB/cxx-qt/