Closed nbigaouette closed 6 years ago
I was able to build tweaking the build.rs
file:
diff --git a/qmetaobject/build.rs b/qmetaobject/build.rs
index 8942f89..45e43c5 100644
--- a/qmetaobject/build.rs
+++ b/qmetaobject/build.rs
@@ -32,10 +36,10 @@ fn main() {
.include(qt_include_path.trim())
.build("src/lib.rs");
- println!("cargo:rustc-link-search={}", qt_library_path.trim());
- println!("cargo:rustc-link-lib=Qt5Widgets");
- println!("cargo:rustc-link-lib=Qt5Gui");
- println!("cargo:rustc-link-lib=Qt5Core");
- println!("cargo:rustc-link-lib=Qt5Quick");
- println!("cargo:rustc-link-lib=Qt5Qml");
+ println!("cargo:rustc-link-search=framework={}", qt_library_path.trim());
+ println!("cargo:rustc-link-lib=framework=QtWidgets");
+ println!("cargo:rustc-link-lib=framework=QtGui");
+ println!("cargo:rustc-link-lib=framework=QtCore");
+ println!("cargo:rustc-link-lib=framework=QtQuick");
+ println!("cargo:rustc-link-lib=framework=QtQml");
}
I'll submit a PR with a cleanup version.
The problem with /home/rust seems to lie in the fact that there is a benchmark that tries to reference hardcoded paths: https://github.com/woboq/qmetaobject-rs/blob/72baa6dc53a74bb152e53fda280bab9ba97c5406/benchmark/qml-rust/Cargo.toml#L7 and cargo tries to build it.
The problem is that the version on crates.io is too lod for my system.
I guess i'll just remove these benchmarks.
I'd like to explore this crate but I have trouble building a hello world (or even the provided examples) on macOS High Sierra 10.13.5 (17F77).
Cargo.toml
First issue is providing a
Cargo.toml
with git dependency. I have the followin dependencies section:but getting this error:
Could it be a cargo bug? Why would it want to clone the repo into
/home/rust
?The only way to pass this step is to manually clone the repo and use
path
instead:Linking
On macOS, I've installed Qt 5.11 through hombrew:
This installs Qt in
/usr/local/Cellar/qt/5.11.0
, which is symlinked to/usr/local/opt/qt
. Looking at the crate'sbuild.rs
it seemsqmake
needs to be in thePATH
to find everything, so I run cargo like this:but I get a linking error:
I think it could be related to
println!("cargo:rustc-link-lib=Qt5Widgets");
being used instead of macOS framework. I'll try to plain with this...