cyndis / qmlrs

QtQuick interface for Rust
Apache License 2.0
437 stars 43 forks source link

os x can't find qmlrswrapper #14

Closed jxs closed 9 years ago

jxs commented 9 years ago

on os x 10.10 trying to compile qmlrs i get the following output:

   Compiling pkg-config v0.3.4 (https://github.com/alexcrichton/pkg-config-rs#9c3ba519)
     Running `rustc /Users/jxs/.cargo/git/checkouts/pkg-config-rs-330bae725d3e2739/master/src/lib.rs --crate-name pkg_config --crate-type lib -g -C metadata=b24ff58b6efa7118 -C extra-filename=-b24ff58b6efa7118 --out-dir /Volumes/data/dev/jxs/qmlrs/target/debug/deps --emit=dep-info,link -L dependency=/Volumes/data/dev/jxs/qmlrs/target/debug/deps -L dependency=/Volumes/data/dev/jxs/qmlrs/target/debug/deps -Awarnings`
   Compiling libc v0.1.8
     Running `rustc /Users/jxs/.cargo/registry/src/github.com-1ecc6299db9ec823/libc-0.1.8/rust/src/liblibc/lib.rs --crate-name libc --crate-type lib -g --cfg feature="cargo-build" --cfg feature="default" -C metadata=2eda841eb12a3090 -C extra-filename=-2eda841eb12a3090 --out-dir /Volumes/data/dev/jxs/qmlrs/target/debug/deps --emit=dep-info,link -L dependency=/Volumes/data/dev/jxs/qmlrs/target/debug/deps -L dependency=/Volumes/data/dev/jxs/qmlrs/target/debug/deps -Awarnings`
   Compiling qmlrs v0.0.1 (file:///Volumes/data/dev/jxs/qmlrs)
     Running `rustc build.rs --crate-name build_script_build --crate-type bin -C prefer-dynamic -g --out-dir /Volumes/data/dev/jxs/qmlrs/target/debug/build/qmlrs-0e9eee83d78ff0e8 --emit=dep-info,link -L dependency=/Volumes/data/dev/jxs/qmlrs/target/debug -L dependency=/Volumes/data/dev/jxs/qmlrs/target/debug/deps --extern pkg_config=/Volumes/data/dev/jxs/qmlrs/target/debug/deps/libpkg_config-b24ff58b6efa7118.rlib`
     Running `/Volumes/data/dev/jxs/qmlrs/target/debug/build/qmlrs-0e9eee83d78ff0e8/build-script-build`
     Running `rustc src/lib.rs --crate-name qmlrs --crate-type lib -g --out-dir /Volumes/data/dev/jxs/qmlrs/target/debug --emit=dep-info,link -L dependency=/Volumes/data/dev/jxs/qmlrs/target/debug -L dependency=/Volumes/data/dev/jxs/qmlrs/target/debug/deps --extern libc=/Volumes/data/dev/jxs/qmlrs/target/debug/deps/liblibc-2eda841eb12a3090.rlib -L native=/Volumes/data/dev/jxs/qmlrs/ext/libqmlrswrapper/build -L framework=/usr/local/Cellar/qt5/5.4.1/lib -L framework=/usr/local/Cellar/qt5/5.4.1/lib -L framework=/usr/local/Cellar/qt5/5.4.1/lib -L framework=/usr/local/Cellar/qt5/5.4.1/lib -L framework=/usr/local/Cellar/qt5/5.4.1/lib -l static=qmlrswrapper -l dylib=stdc++ -l framework=QtQuick -l framework=QtGui -l framework=QtQml -l framework=QtNetwork -l framework=QtCore`
error: could not find native static library `qmlrswrapper`, perhaps an -L flag is missing?
Could not compile `qmlrs`.

and if i list /Volumes/data/dev/jxs/qmlrs/ext/libqmlrswrapper/build folder i get:

.
├── CMakeCache.txt
└── CMakeFiles
    ├── 3.2.2
    │   ├── CMakeCCompiler.cmake
    │   ├── CMakeCXXCompiler.cmake
    │   ├── CMakeDetermineCompilerABI_C.bin
    │   ├── CMakeDetermineCompilerABI_CXX.bin
    │   ├── CMakeSystem.cmake
    │   ├── CompilerIdC
    │   │   ├── CMakeCCompilerId.c
    │   │   └── a.out
    │   └── CompilerIdCXX
    │       ├── CMakeCXXCompilerId.cpp
    │       └── a.out
    ├── CMakeOutput.log
    ├── CMakeTmp
    ├── cmake.check_cache
    ├── feature_tests.bin
    ├── feature_tests.c
    └── feature_tests.cxx

thanks

liamsi commented 9 years ago

Hi, what was is the exact command you have used for compiling? The folder listing should look like this:

ext/libqmlrswrapper/
├── build
│   ├── CMakeCache.txt
│   ├── CMakeFiles
│   │   ├── 3.2.3
│   │   │   ├── CMakeCCompiler.cmake
│   │   │   ├── CMakeCXXCompiler.cmake
│   │   │   ├── CMakeDetermineCompilerABI_C.bin
│   │   │   ├── CMakeDetermineCompilerABI_CXX.bin
│   │   │   ├── CMakeSystem.cmake
│   │   │   ├── CompilerIdC
│   │   │   │   ├── a.out
│   │   │   │   └── CMakeCCompilerId.c
│   │   │   └── CompilerIdCXX
│   │   │       ├── a.out
│   │   │       └── CMakeCXXCompilerId.cpp
│   │   ├── cmake.check_cache
│   │   ├── CMakeDirectoryInformation.cmake
│   │   ├── CMakeOutput.log
│   │   ├── CMakeRuleHashes.txt
│   │   ├── CMakeTmp
│   │   ├── feature_tests.bin
│   │   ├── feature_tests.c
│   │   ├── feature_tests.cxx
│   │   ├── Makefile2
│   │   ├── Makefile.cmake
│   │   ├── progress.marks
│   │   ├── qmlrswrapper_automoc.dir
│   │   │   ├── AutogenInfo.cmake
│   │   │   ├── AutomocOldMocDefinitions.cmake
│   │   │   ├── build.make
│   │   │   ├── cmake_clean.cmake
│   │   │   ├── DependInfo.cmake
│   │   │   ├── depend.internal
│   │   │   ├── depend.make
│   │   │   └── progress.make
│   │   ├── qmlrswrapper.dir
│   │   │   ├── build.make
│   │   │   ├── cmake_clean.cmake
│   │   │   ├── cmake_clean_target.cmake
│   │   │   ├── CXX.includecache
│   │   │   ├── DependInfo.cmake
│   │   │   ├── depend.internal
│   │   │   ├── depend.make
│   │   │   ├── flags.make
│   │   │   ├── libqmlrswrapper.cpp.o
│   │   │   ├── link.txt
│   │   │   ├── progress.make
│   │   │   ├── qmlrswrapper_automoc.cpp.o
│   │   │   ├── qrsdynamicobject_capi.cpp.o
│   │   │   └── qrsdynamicobject.cpp.o
│   │   └── TargetDirectories.txt
│   ├── cmake_install.cmake
│   ├── libqmlrswrapper.a
│   ├── Makefile
│   ├── moc_libqmlrswrapper.cpp
│   └── qmlrswrapper_automoc.cpp
├── CMakeLists.txt
├── libqmlrswrapper.cpp
├── libqmlrswrapper.h
├── qrsdynamicobject_capi.cpp
├── qrsdynamicobject.cpp
└── qrsdynamicobject.h
liamsi commented 9 years ago

and which rust version did you use?

jxs commented 9 years ago

oh sorry, i used rustc 1.0.0 (built 2015-05-16) also, i am able to compile it on linux without problems, my directory tree is

.
├── CMakeLists.txt
├── build
│   ├── CMakeCache.txt
│   └── CMakeFiles
│       ├── 3.2.2
│       │   ├── CMakeCCompiler.cmake
│       │   ├── CMakeCXXCompiler.cmake
│       │   ├── CMakeDetermineCompilerABI_C.bin
│       │   ├── CMakeDetermineCompilerABI_CXX.bin
│       │   ├── CMakeSystem.cmake
│       │   ├── CompilerIdC
│       │   │   ├── CMakeCCompilerId.c
│       │   │   └── a.out
│       │   └── CompilerIdCXX
│       │       ├── CMakeCXXCompilerId.cpp
│       │       └── a.out
│       ├── CMakeOutput.log
│       ├── CMakeTmp
│       ├── cmake.check_cache
│       ├── feature_tests.bin
│       ├── feature_tests.c
│       └── feature_tests.cxx
├── libqmlrswrapper.cpp
├── libqmlrswrapper.h
├── qrsdynamicobject.cpp
├── qrsdynamicobject.h
└── qrsdynamicobject_capi.cpp

but on linux is the same as yours

liamsi commented 9 years ago

And which commands did you use exactly to compile (like cargo run ..., cargo build ...). Try cargo build --verbose instead to see what is wrong. If that did not help you: I think you'll find an error message in the file CMakeOutput.log to see what is missing on your mac.

If that did not help you either. Try the following (step by step) and post the output:

Post the output of the last step.

jxs commented 9 years ago

apparently the extension builds ok, it's rust who cannot find it? here's CMakeOutput.log

patchfx commented 9 years ago

I had the same issue and had to add the following line to my .zshrc. Just point it to the directory where you installed Qt.

export CMAKE_PREFIX_PATH="$HOME/Qt/5.5/clang_64"

Hope that helps!

SirVer commented 9 years ago

When using homebrew, you need to export CMAKE_PREFIX_PATH=$(brew --prefix qt5)/lib/cmake/ before running cargo. Building the wrapper library then seems to succeed.

jxs commented 9 years ago

fixed with the instruction above, also if having:

       Fresh pkg-config v0.3.5 (https://github.com/alexcrichton/pkg-config-rs#42f1704b)
failed to run custom build command for `qmlrs v0.0.1 (file:///Volumes/data/dev/jxs/qmlrs)`
Process didn't exit successfully: `/Volumes/data/dev/jxs/qmlrs/target/debug/build/qmlrs-1d1b2e9aa4373dd1/build-script-build` (exit code: 101)
--- stdout
cargo:rustc-link-lib=static=qmlrswrapper
cargo:rustc-link-lib=dylib=stdc++
cargo:rustc-link-search=native=/Volumes/data/dev/jxs/qmlrs/ext/libqmlrswrapper/build

--- stderr
thread '<main>' panicked at 'called `Result::unwrap()` on an `Err` value: "`\"pkg-config\" \"--libs\" \"--cflags\" \"Qt5Core Qt5Gui Qt5Qml Qt5Quick\"` did not exit successfully: exit code: 1\n--- stderr\nPackage Qt5Core was not found in the pkg-config search path.\nPerhaps you should add the directory containing `Qt5Core.pc\'\nto the PKG_CONFIG_PATH environment variable\nNo package \'Qt5Core\' found\nPackage Qt5Gui was not found in the pkg-config search path.\nPerhaps you should add the directory containing `Qt5Gui.pc\'\nto the PKG_CONFIG_PATH environment variable\nNo package \'Qt5Gui\' found\nPackage Qt5Qml was not found in the pkg-config search path.\nPerhaps you should add the directory containing `Qt5Qml.pc\'\nto the PKG_CONFIG_PATH environment variable\nNo package \'Qt5Qml\' found\nPackage Qt5Quick was not found in the pkg-config search path.\nPerhaps you should add the directory containing `Qt5Quick.pc\'\nto the PKG_CONFIG_PATH environment variable\nNo package \'Qt5Quick\' found\n"', src/libcore/result.rs:731

export PKG_CONFIG_PATH=/usr/local/opt/qt5/lib/pkgconfig/ fixes it