Closed ahayzen-kdab closed 6 months ago
Unsure why this fails to link with eg
Compiling qml-minimal-no-cmake v0.1.0 (/var/home/andrew/Projects/cxx-qt/examples/cargo_without_cmake)
error: linking with `cc` failed: exit status: 1
|
= note: LC_ALL="C" PATH="/var/home/andrew/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin:/var/home/andrew/.var/Qt/6.5.0/gcc_64/bin:/var/home/andrew/.var/Qt/Tools/CMake/bin:/var/home/andrew/.l
ocal/bin:/var/home/andrew/bin:/var/home/andrew/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" VSLANG="1033" "cc" "-m64" "/tmp/rustcDzIRfA/symbols.o" "/var/home/andrew/Projects/cxx-qt/target/debug/deps/qml_minimal
_no_cmake-5e59b5d1551b4925.1aei28r5x22rbock.rcgu.o" "/var/home/andrew/Projects/cxx-qt/target/debug/deps/qml_minimal_no_cmake-5e59b5d1551b4925.1qpbr42de1tbh23w.rcgu.o" "/var/home/andrew/Projects/cxx-qt/target/debug/deps/qml_minimal_no_cmak
e-5e59b5d1551b4925.1r6z2jyjlg0fqtv6.rcgu.o" "/var/home/andrew/Projects/cxx-qt/target/debug/deps/qml_minimal_no_cmake-5e59b5d1551b4925.1z5rc86a7rebnnst.rcgu.o" "/var/home/andrew/Projects/cxx-qt/target/debug/deps/qml_minimal_no_cmake-5e59b5
d1551b4925.2a663t0btpsbxg59.rcgu.o" "/var/home/andrew/Projects/cxx-qt/target/debug/deps/qml_minimal_no_cmake-5e59b5d1551b4925.2aqy5ww82rzii52i.rcgu.o" "/var/home/andrew/Projects/cxx-qt/target/debug/deps/qml_minimal_no_cmake-5e59b5d1551b49
25.2j4jit3gtpdpkwd2.rcgu.o" "/var/home/andrew/Projects/cxx-qt/target/debug/deps/qml_minimal_no_cmake-5e59b5d1551b4925.391uj5qopy7pla6e.rcgu.o" "/var/home/andrew/Projects/cxx-qt/target/debug/deps/qml_minimal_no_cmake-5e59b5d1551b4925.3bsem
7kfgfrjn7ad.rcgu.o" "/var/home/andrew/Projects/cxx-qt/target/debug/deps/qml_minimal_no_cmake-5e59b5d1551b4925.3d3mh748hc6pfrua.rcgu.o" "/var/home/andrew/Projects/cxx-qt/target/debug/deps/qml_minimal_no_cmake-5e59b5d1551b4925.3jdk67nfihw21
gmu.rcgu.o" "/var/home/andrew/Projects/cxx-qt/target/debug/deps/qml_minimal_no_cmake-5e59b5d1551b4925.3jm5si1sip7dh5n7.rcgu.o" "/var/home/andrew/Projects/cxx-qt/target/debug/deps/qml_minimal_no_cmake-5e59b5d1551b4925.3v0aszst4noequi3.rcgu
.o" "/var/home/andrew/Projects/cxx-qt/target/debug/deps/qml_minimal_no_cmake-5e59b5d1551b4925.3v1w9hxywcrq05l.rcgu.o" "/var/home/andrew/Projects/cxx-qt/target/debug/deps/qml_minimal_no_cmake-5e59b5d1551b4925.3ys8bn278s6yzzyf.rcgu.o" "/var
/home/andrew/Projects/cxx-qt/target/debug/deps/qml_minimal_no_cmake-5e59b5d1551b4925.4aruy5ahp6mqw9ft.rcgu.o" "/var/home/andrew/Projects/cxx-qt/target/debug/deps/qml_minimal_no_cmake-5e59b5d1551b4925.4kvcg711htd6jqa0.rcgu.o" "/var/home/an
drew/Projects/cxx-qt/target/debug/deps/qml_minimal_no_cmake-5e59b5d1551b4925.4nu6sikl6s04om5f.rcgu.o" "/var/home/andrew/Projects/cxx-qt/target/debug/deps/qml_minimal_no_cmake-5e59b5d1551b4925.4x49utpvcrzkklb4.rcgu.o" "/var/home/andrew/Pro
jects/cxx-qt/target/debug/deps/qml_minimal_no_cmake-5e59b5d1551b4925.4xnppnr3tyryi633.rcgu.o" "/var/home/andrew/Projects/cxx-qt/target/debug/deps/qml_minimal_no_cmake-5e59b5d1551b4925.4y7bfel4djaamicf.rcgu.o" "/var/home/andrew/Projects/cx
x-qt/target/debug/deps/qml_minimal_no_cmake-5e59b5d1551b4925.51qrv6v41tty902j.rcgu.o" "/var/home/andrew/Projects/cxx-qt/target/debug/deps/qml_minimal_no_cmake-5e59b5d1551b4925.532uwnnjcudb6fnb.rcgu.o" "/var/home/andrew/Projects/cxx-qt/tar
get/debug/deps/qml_minimal_no_cmake-5e59b5d1551b4925.tl55cbj0erh6ewf.rcgu.o" "/var/home/andrew/Projects/cxx-qt/target/debug/deps/qml_minimal_no_cmake-5e59b5d1551b4925.4i0q6qqnqc8adrfl.rcgu.o" "-Wl,--as-needed" "-L" "/var/home/andrew/Proje
cts/cxx-qt/target/debug/deps" "-L" "/var/home/andrew/.var/Qt/6.5.0/gcc_64/lib" "-L" "/var/home/andrew/.var/Qt/6.5.0/gcc_64/lib" "-L" "/var/home/andrew/.var/Qt/6.5.0/gcc_64/lib" "-L" "/var/home/andrew/.var/Qt/6.5.0/gcc_64/lib" "-L" "/var/h
ome/andrew/.var/Qt/6.5.0/gcc_64/lib" "-L" "/var/home/andrew/Projects/cxx-qt/target/debug/build/qml-minimal-no-cmake-3780e10cfff20fd9/out" "-L" "/var/home/andrew/Projects/cxx-qt/target/debug/build/qml-minimal-no-cmake-3780e10cfff20fd9/out"
"-L" "/var/home/andrew/Projects/cxx-qt/target/debug/build/cxx-ec4889ed1ae54acf/out" "-L" "/var/home/andrew/Projects/cxx-qt/target/debug/build/link-cplusplus-f6a88aeab92a1866/out" "-L" "/var/home/andrew/.var/Qt/6.5.0/gcc_64/lib" "-L" "/va
r/home/andrew/.var/Qt/6.5.0/gcc_64/lib" "-L" "/var/home/andrew/.var/Qt/6.5.0/gcc_64/lib" "-L" "/var/home/andrew/.var/Qt/6.5.0/gcc_64/lib" "-L" "/var/home/andrew/Projects/cxx-qt/target/debug/build/cxx-qt-lib-96c685259d922ea1/out" "-L" "/va
r/home/andrew/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-Wl,-Bdynamic" "-lQt6Gui" "-lGL" "-lpthread" "-lQt6Qml" "-lQt6Network" "-lQt6Core" "-Wl,-Bstatic" "-Wl,--whole-archive" "-lqt-stat
ic-initializers" "-Wl,--no-whole-archive" "-lcxx-qt-generated" "-Wl,-Bdynamic" "-lstdc++" "-Wl,-Bstatic" "/var/home/andrew/Projects/cxx-qt/target/debug/deps/libcxx_qt-4f3c41bd4b5c6d39.rlib" "/var/home/andrew/Projects/cxx-qt/target/debug/d
eps/libstatic_assertions-06b6572b5d394a0a.rlib" "/var/home/andrew/Projects/cxx-qt/target/debug/deps/libcxx_qt_lib-10421dd2d6f24338.rlib" "/var/home/andrew/Projects/cxx-qt/target/debug/deps/libcxx_qt_build-4e40f63f31951f62.rlib" "/var/home
/andrew/Projects/cxx-qt/target/debug/deps/libversion_check-62890ea9e694c9a3.rlib" "/var/home/andrew/Projects/cxx-qt/target/debug/deps/libqt_build_utils-95c2ae5f2a22d739.rlib" "/var/home/andrew/Projects/cxx-qt/target/debug/deps/libversions
-8690278912ea8109.rlib" "/var/home/andrew/Projects/cxx-qt/target/debug/deps/libnom-3e37996d74807c2b.rlib" "/var/home/andrew/Projects/cxx-qt/target/debug/deps/libmemchr-ee1d365d27dccfd9.rlib" "/var/home/andrew/Projects/cxx-qt/target/debug/
deps/libitertools-b8e1a115d94f05b9.rlib" "/var/home/andrew/Projects/cxx-qt/target/debug/deps/libeither-133233cc595b9fa0.rlib" "/var/home/andrew/Projects/cxx-qt/target/debug/deps/libcc-b95fa74fb02a4625.rlib" "/var/home/andrew/Projects/cxx-
qt/target/debug/deps/libjobserver-077b2f1b7c6395de.rlib" "/var/home/andrew/Projects/cxx-qt/target/debug/deps/liblibc-a9a2a17e1d19328b.rlib" "/var/home/andrew/Projects/cxx-qt/target/debug/deps/libcxx_gen-8b185f4ba5bcd5c2.rlib" "/var/home/a
ndrew/Projects/cxx-qt/target/debug/deps/libcxx_qt_gen-cadb6180218c98b6.rlib" "/var/home/andrew/Projects/cxx-qt/target/debug/deps/libclang_format-fb30abc562bd91ce.rlib" "/var/home/andrew/Projects/cxx-qt/target/debug/deps/libthiserror-22005
bfc2049801e.rlib" "/var/home/andrew/Projects/cxx-qt/target/debug/deps/libsyn-1cf469b811f9e508.rlib" "/var/home/andrew/Projects/cxx-qt/target/debug/deps/libquote-170c1be2419aee34.rlib" "/var/home/andrew/Projects/cxx-qt/target/debug/deps/li
bconvert_case-60e36560ada539e9.rlib" "/var/home/andrew/Projects/cxx-qt/target/debug/deps/libunicode_segmentation-7a669f4e93299c6a.rlib" "/var/home/andrew/Projects/cxx-qt/target/debug/deps/libcodespan_reporting-59f5065d168d3658.rlib" "/var
/home/andrew/Projects/cxx-qt/target/debug/deps/libunicode_width-a645f17db2f885de.rlib" "/var/home/andrew/Projects/cxx-qt/target/debug/deps/libtermcolor-6dec0f4bbbe42dd1.rlib" "/var/home/andrew/Projects/cxx-qt/target/debug/deps/libproc_mac
ro2-f7abf32b162d970b.rlib" "/var/home/andrew/Projects/cxx-qt/target/debug/deps/libunicode_ident-a986a3b551bfd407.rlib" "/var/home/andrew/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libproc_m
acro-67a55db9939ddb4c.rlib" "/var/home/andrew/Projects/cxx-qt/target/debug/deps/libcxx-83eaec3fafa8031e.rlib" "/var/home/andrew/Projects/cxx-qt/target/debug/deps/liblink_cplusplus-2d0c398e5cd5a9b4.rlib" "/var/home/andrew/.rustup/toolchain
s/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-90f6ddbf82de36ec.rlib" "/var/home/andrew/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libpanic_unwind-480c41e
9d4e1f677.rlib" "/var/home/andrew/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libobject-db744c0ca03eed1d.rlib" "/var/home/andrew/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustli
b/x86_64-unknown-linux-gnu/lib/libmemchr-8ba652dc7d4b285a.rlib" "/var/home/andrew/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libaddr2line-d5f4520a9ebc0d58.rlib" "/var/home/andrew/.rustup/to
olchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libgimli-4ad84de58f0cb463.rlib" "/var/home/andrew/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_deman
gle-0d10aae2e0f38735.rlib" "/var/home/andrew/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd_detect-0c17cff739e6745b.rlib" "/var/home/andrew/.rustup/toolchains/stable-x86_64-unknown-linux
-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libhashbrown-b29e17139dde1aa8.rlib" "/var/home/andrew/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_alloc-1f975299829cc7bd.
rlib" "/var/home/andrew/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libminiz_oxide-86bae3bc3079f89b.rlib" "/var/home/andrew/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86
_64-unknown-linux-gnu/lib/libadler-321b82c30dffdf5f.rlib" "/var/home/andrew/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libunwind-3dd8a6810a0bdfef.rlib" "/var/home/andrew/.rustup/toolchains/
stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcfg_if-eb39a61c0c879984.rlib" "/var/home/andrew/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liblibc-aa769569f91c35
48.rlib" "/var/home/andrew/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc-510a192a50a983ed.rlib" "/var/home/andrew/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64
-unknown-linux-gnu/lib/librustc_std_workspace_core-0577018320f99037.rlib" "/var/home/andrew/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore-193cf992125ccd4c.rlib" "/var/home/andrew/.rust
up/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcompiler_builtins-8e138eaf26ebb4a8.rlib" "-Wl,-Bdynamic" "-lQt6Gui" "-lGL" "-lQt6Qml" "-lQt6Network" "-lQt6Core" "-lpthread" "-lstdc++" "-lstdc++" "
-lgcc_s" "-lutil" "-lrt" "-lpthread" "-lm" "-ldl" "-lc" "-Wl,--eh-frame-hdr" "-Wl,-z,noexecstack" "-L" "/var/home/andrew/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-o" "/var/home/andrew/P
rojects/cxx-qt/target/debug/deps/qml_minimal_no_cmake-5e59b5d1551b4925" "-Wl,--gc-sections" "-pie" "-Wl,-z,relro,-z,now" "-nodefaultlibs" "-fuse-ld=gold"
= note: crates/cxx-qt-lib/src/core/qbytearray.rs:38: error: undefined reference to 'rust$cxxqtlib1$cxxbridge1$qbytearray_drop'
...
I can see those symbols in the rlib
$ nm /var/home/andrew/Projects/cxx-qt/target/debug/deps/libcxx_qt_lib-10421dd2d6f24338.rlib |c++filt |grep -i qbytearray_drop
nm: lib.rmeta: no symbols
U cxx_qt_lib::core::qbytearray::ffi::qbytearray_drop::hb1c670ca3850ce36
0000000000000000 T cxx_qt_lib::core::qbytearray::ffi::qbytearray_drop::hb1c670ca3850ce36
U rust$cxxqtlib1$cxxbridge1$qbytearray_drop
I've tried manually linking and adjusting the output names so we don't collide, but it doesn't seem to help.
What is curious is that all of the failures are templates but the CXX generated part for them :thinking:
Figured it out, cxx-qt-build was using the module name rather than file stem for cxx::bridge like we do for cxx_qt::bridge, this caused all the bridges to use the same output C++ file names and therefore clashing.
Note changing a #[cxx::bridge]
to #[cxx_qt::bridge(cxx_file_stem = "qbytearray")]
in qbytearray.rs
fails with
error: couldn't read crates/cxx-qt-lib/src/core/cxx-qt-lib/qbytearray.h: No such file or directory (os error 2)
--> crates/cxx-qt-lib/src/core/qbytearray.rs:11:9
|
11 | include!("cxx-qt-lib/qbytearray.h");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: this error originates in the macro `include` (in Nightly builds, run with -Z macro-backtrace for more info)
Note changing a
#[cxx::bridge]
to#[cxx_qt::bridge(cxx_file_stem = "qbytearray")]
inqbytearray.rs
fails witherror: couldn't read crates/cxx-qt-lib/src/core/cxx-qt-lib/qbytearray.h: No such file or directory (os error 2) --> crates/cxx-qt-lib/src/core/qbytearray.rs:11:9 | 11 | include!("cxx-qt-lib/qbytearray.h"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: this error originates in the macro `include` (in Nightly builds, run with -Z macro-backtrace for more info)
OK so this was just missing cxx_qt
in the Cargo.toml
:sweat_smile: ... however we can't yet use signals in cxx-qt-lib due to ConnectionType not being split to cxx-qt.
Folded into #764
Requires #764