White-Oak / qml-rust

QML (Qt Quick) bindings for Rust language
MIT License
205 stars 18 forks source link

Doesn't build on Win7 67bit #31

Open IvankoB opened 7 years ago

IvankoB commented 7 years ago

The build script:

set CMAKE_PREFIX_PATH="c:\msys64\mingw64\qt5-static" set RUST_BACKTRACE=1 cargo.exe build --verbose

The error log:

   Fresh lazy_static v0.2.2
   Fresh libc v0.2.20

Compiling qml v0.0.9 (file:///C:/Users/Vano/.cargo/registry/src/github.com-1ecc6299db9ec823/qml-0.0.9) Running C:\Users\Vano\.cargo\registry\src\github.com-1ecc6299db9ec823\qml-0.0.9\target\debug\build\qml-a381d2022eef86b2\build-script-build error: failed to run custom build command for qml v0.0.9 (file:///C:/Users/Vano/.cargo/registry/src/github.com-1ecc6299db9ec823/qml-0.0.9) process didn't exit successfully: C:\Users\Vano\.cargo\registry\src\github.com-1ecc6299db9ec823\qml-0.0.9\target\debug\build\qml-a381d2022eef86b2\build-script-build (exit code: 101) --- stderr thread 'main' panicked at 'Cannot build qrc resource: "-- The C compiler identification is GNU 6.2.0\n-- The CXX compiler identification is GNU 6.2.0\n-- Check for working C compiler: /mingw64/bin/cc.exe\n-- Check for working C compiler: /mingw64/bin/cc.exe -- works\n-- Detecting C compiler ABI info\n-- Detecting C compiler ABI info - failed\n-- Detecting C compile features\n-- Detecting C compile features - failed\n-- Check for working CXX compiler: /mingw64/bin/c++.exe\n-- Check for working CXX compiler: /mingw64/bin/c++.exe -- works\n-- Detecting CXX compiler ABI info\n-- Detecting CXX compiler ABI info - failed\n-- Detecting CXX compile features\n-- Detecting CXX compile features - failed\n-- Found Doxygen: /usr/bin/doxygen.exe (found version \"1.8.11\") \n-- Configuring incomplete, errors occurred!\nSee also \"/c/Users/Vano/.cargo/registry/src/github.com-1ecc6299db9ec823/qml-0.0.9/target/debug/build/qml-256362b3a3fb2327/out/DOtherSide/build/CMakeFiles/CMakeOutput.log\".\nSee also \"/c/Users/Vano/.cargo/registry/src/github.com-1ecc6299db9ec823/qml-0.0.9/target/debug/build/qml-256362b3a3fb2327/out/DOtherSide/build/CMakeFiles/CMakeError.log\".\n" "CMake Warning at /usr/share/cmake-3.6.2/Modules/Platform/MSYS.cmake:15 (message):\n CMake no longer defines WIN32 on MSYS!\n\n (1) If you are just trying to build this project, ignore this warning or\n quiet it by setting CMAKE_LEGACY_CYGWIN_WIN32=0 in your environment or in\n the CMake cache. If later configuration or build errors occur then this\n project may have been written under the assumption that MSYS is WIN32. In\n that case, set CMAKE_LEGACY_CYGWIN_WIN32=1 instead.\n\n (2) If you are developing this project, add the line\n\n set(CMAKE_LEGACY_CYGWIN_WIN32 0) # Remove when CMake >= 2.8.4 is required\n\n at the top of your top-level CMakeLists.txt file or set the minimum\n required version of CMake to 2.8.4 or higher. Then teach your project to\n build on Cygwin without WIN32.\nCall Stack (most recent call first):\n /usr/share/cmake-3.6.2/Modules/CMakeSystemSpecificInformation.cmake:37 (include)\n CMakeLists.txt\n\n\nCMake Warning at lib/CMakeLists.txt:10 (find_package):\n By not providing \"FindQt5Core.cmake\" in CMAKE_MODULE_PATH this project has\n asked CMake to find a package configuration file provided by \"Qt5Core\", but\n CMake did not find one.\n\n Could not find a package configuration file provided by \"Qt5Core\" with any\n of the following names:\n\n Qt5CoreConfig.cmake\n qt5core-config.cmake\n\n Add the installation prefix of \"Qt5Core\" to CMAKE_PREFIX_PATH or set\n \"Qt5Core_DIR\" to a directory containing one of the above files. If\n \"Qt5Core\" provides a separate development package or SDK, be sure it has\n been installed.\n\n\nCMake Warning at lib/CMakeLists.txt:11 (find_package):\n By not providing \"FindQt5Qml.cmake\" in CMAKE_MODULE_PATH this project has\n asked CMake to find a package configuration file provided by \"Qt5Qml\", but\n CMake did not find one.\n\n Could not find a package configuration file provided by \"Qt5Qml\" with any\n of the following names:\n\n Qt5QmlConfig.cmake\n qt5qml-config.cmake\n\n Add the installation prefix of \"Qt5Qml\" to CMAKE_PREFIX_PATH or set\n \"Qt5Qml_DIR\" to a directory containing one of the above files. If \"Qt5Qml\"\n provides a separate development package or SDK, be sure it has been\n installed.\n\n\nCMake Warning at lib/CMakeLists.txt:12 (find_package):\n By not providing \"FindQt5Gui.cmake\" in CMAKE_MODULE_PATH this project has\n asked CMake to find a package configuration file provided by \"Qt5Gui\", but\n CMake did not find one.\n\n Could not find a package configuration file provided by \"Qt5Gui\" with any\n of the following names:\n\n Qt5GuiConfig.cmake\n qt5gui-config.cmake\n\n Add the installation prefix of \"Qt5Gui\" to CMAKE_PREFIX_PATH or set\n \"Qt5Gui_DIR\" to a directory containing one of the above files. If \"Qt5Gui\"\n provides a separate development package or SDK, be sure it has been\n installed.\n\n\nCMake Warning at lib/CMakeLists.txt:13 (find_package):\n By not providing \"FindQt5Quick.cmake\" in CMAKE_MODULE_PATH this project has\n asked CMake to find a package configuration file provided by \"Qt5Quick\",\n but CMake did not find one.\n\n Could not find a package configuration file provided by \"Qt5Quick\" with any\n of the following names:\n\n Qt5QuickConfig.cmake\n qt5quick-config.cmake\n\n Add the installation prefix of \"Qt5Quick\" to CMAKE_PREFIX_PATH or set\n \"Qt5Quick_DIR\" to a directory containing one of the above files. If\n \"Qt5Quick\" provides a separate development package or SDK, be sure it has\n been installed.\n\n\nCMake Warning at lib/CMakeLists.txt:14 (find_package):\n By not providing \"FindQt5Widgets.cmake\" in CMAKE_MODULE_PATH this project\n has asked CMake to find a package configuration file provided by\n \"Qt5Widgets\", but CMake did not find one.\n\n Could not find a package configuration file provided by \"Qt5Widgets\" with\n any of the following names:\n\n Qt5WidgetsConfig.cmake\n qt5widgets-config.cmake\n\n Add the installation prefix of \"Qt5Widgets\" to CMAKE_PREFIX_PATH or set\n \"Qt5Widgets_DIR\" to a directory containing one of the above files. If\n \"Qt5Widgets\" provides a separate development package or SDK, be sure it has\n been installed.\n\n\nCMake Error at test/CMakeLists.txt:9 (find_package):\n By not providing \"FindQt5Core.cmake\" in CMAKE_MODULE_PATH this project has\n asked CMake to find a package configuration file provided by \"Qt5Core\", but\n CMake did not find one.\n\n Could not find a package configuration file provided by \"Qt5Core\" with any\n of the following names:\n\n Qt5CoreConfig.cmake\n qt5core-config.cmake\n\n Add the installation prefix of \"Qt5Core\" to CMAKE_PREFIX_PATH or set\n \"Qt5Core_DIR\" to a directory containing one of the above files. If\n \"Qt5Core\" provides a separate development package or SDK, be sure it has\n been installed.\n\n\n"', build.rs:32 stack backtrace: 0: 0x439a97 - 1: 0x4392c3 - 2: 0x43ac2e - 3: 0x43aad6 - 4: 0x43a9f9 - 5: 0x408d94 - 6: 0x43a8b8 - 7: 0x443d28 - 8: 0x43b3d3 - 9: 0x40995a - 10: 0x4013b4 - 11: 0x4014e7 - 12: 0x76d459cc -

flanfly commented 7 years ago

Have you tried setting the QTDIR environment variable to c:\msys64\mingw64\qt5-static?

ErichDonGubler commented 7 years ago

I'm getting a similar issue with the following files, which are similar to the first stages of the tutorial that recently hit Reddit:

# cargo.toml
[package]
name = "qml-test"
version = "0.1.0"

[dependencies]
qml = "*"
// main.rs
extern crate qml;

use qml::*;

fn main() {
    // Create a new QML Engine.
    let mut engine = QmlEngine::new();

    // Bind a message to the QML enviroment.
    let message = QVariant::from("Hello, world!");
    engine.set_property("message", &message);

    // Load some QML
    engine.load_data("
        import QtQuick 2.0
        import QtQuick.Controls 1.0

        ApplicationWindow {
            visible: true
            Text {
                anchors.fill: parent
                text: message
            }
        }
    ");
    engine.exec();
}

Console output:

$ set RUST_BACKTRACE=1
$ cargo build --verbose
       Fresh libc v0.2.20
       Fresh lazy_static v0.2.2
   Compiling qml v0.0.9
     Running `C:\Users\erich.gubler\Desktop\rust-qml-test\target\debug\build\qml-30d76bc68ec25e1f\build-script-build`
error: failed to run custom build command for `qml v0.0.9`
process didn't exit successfully: `C:\Users\erich.gubler\Desktop\rust-qml-test\target\debug\build\qml-30d76bc68ec25e1f\build-script-build` (exit code: 101)
--- stderr
thread 'main' panicked at 'Cannot build qrc resource:
"-- The C compiler identification is GNU 4.8.3\r\n-- The CXX compiler identification is GNU 4.8.3\r\n-- Check for working C compiler: C:/Win-builds/bin/gcc.exe\r\n-- Check for working C compiler: C:/Win-builds/bin/gcc.exe -- broken\r\n-- Configuring incomplete, errors occurred!\r\nSee also \"C:/Users/erich.gubler/Desktop/rust-qml-test/target/debug/build/qml-806982a6a7af4af0/out/DOtherSide/build/CMakeFiles/CMakeOutput.log\".\r\nSee also \"C:/Users/erich.gubler/Desktop/rust-qml-test/target/debug/build/qml-806982a6a7af4af0/out/DOtherSide/build/CMakeFiles/CMakeError.log\".\r\n"
"Cloning into \'DOtherSide\'...\nCMake Error at C:/Program Files/CMake/share/cmake-3.7/Modules/CMakeTestCCompiler.cmake:51 (message):\r\n  The C compiler \"C:/Win-builds/bin/gcc.exe\" is not able to compile a simple\r\n  test program.\r\n\r\n  It fails with the following output:\r\n\r\n   Change Dir: C:/Users/erich.gubler/Desktop/rust-qml-test/target/debug/build/qml-806982a6a7af4af0/out/DOtherSide/build/CMakeFiles/CMakeTmp\r\n\r\n  \r\n\r\n  Run Build Command:\"C:/D/dmd2/windows/bin/make.exe\" \"cmTC_14639/fast\"\r\n\r\n  f CMakeFiles/cmTC_14639.dir/build.make CMakeFiles/cmTC_14639.dir/build\r\r\n\r\n  Error: \'f\' not found\r\r\n\r\n  \r\n\r\n  \r\n\r\n  CMake will not be able to correctly generate this project.\r\nCall Stack (most recent call first):\r\n  CMakeLists.txt\r\n\r\n\r\n"', C:\Users\erich.gubler\.cargo\registry\src\github.com-1ecc6299db9ec823\qml-0.0.9\build.rs:32
stack backtrace:
   0:     0x7ff762a8cca7 - std::panicking::default_hook::{{closure}}
                        at C:\projects\rust\src\libstd\panicking.rs:356
   1:     0x7ff762a8c1d4 - std::panicking::default_hook
                        at C:\projects\rust\src\libstd\panicking.rs:367
   2:     0x7ff762a8fa81 - std::panicking::rust_panic_with_hook
                        at C:\projects\rust\src\libstd\panicking.rs:545
   3:     0x7ff762a8f938 - std::panicking::begin_panic<collections::string::String>
                        at C:\projects\rust\src\libstd\panicking.rs:507
   4:     0x7ff762a8f854 - std::panicking::begin_panic_fmt
                        at C:\projects\rust\src\libstd\panicking.rs:491
   5:     0x7ff762a78686 - build_script_build::main
                        at C:\Users\erich.gubler\.cargo\registry\src\github.com-1ecc6299db9ec823\qml-0.0.9\build.rs:32
   6:     0x7ff762a91d71 - panic_unwind::__rust_maybe_catch_panic
                        at C:\projects\rust\src\libpanic_unwind\lib.rs:98
   7:     0x7ff762a9008a - std::rt::lang_start
                        at C:\projects\rust\src\libstd\rt.rs:51
   8:     0x7ff762a7925b - main
   9:     0x7ff762a96488 - __scrt_common_main_seh
                        at f:\dd\vctools\crt\vcstartup\src\startup\exe_common.inl:253
  10:     0x7ff9408e8363 - BaseThreadInitThunk

A little massaging of the inner error yields:

Cannot build qrc resource:
-- The C compiler identification is GNU 4.8.3
-- The CXX compiler identification is GNU 4.8.3
-- Check for working C compiler: C:/Win-builds/bin/gcc.exe
-- Check for working C compiler: C:/Win-builds/bin/gcc.exe -- broken
-- Configuring incomplete, errors occurred!
See also "C:/Users/erich.gubler/Desktop/rust-qml-test/target/debug/build/qml-806982a6a7af4af0/out/DOtherSide/build/CMakeFiles/CMakeOutput.log".
See also "C:/Users/erich.gubler/Desktop/rust-qml-test/target/debug/build/qml-806982a6a7af4af0/out/DOtherSide/build/CMakeFiles/CMakeError.log".
"
"Cloning into 'DOtherSide'...
CMake Error at C:/Program Files/CMake/share/cmake-3.7/Modules/CMakeTestCCompiler.cmake:51 (message):
  The C compiler "C:/Win-builds/bin/gcc.exe" is not able to compile a simple
  test program.

  It fails with the following output:

   Change Dir: C:/Users/erich.gubler/Desktop/rust-qml-test/target/debug/build/qml-806982a6a7af4af0/out/DOtherSide/build/CMakeFiles/CMakeTmp

  Run Build Command:"C:/D/dmd2/windows/bin/make.exe" "cmTC_14639/fast"

  f CMakeFiles/cmTC_14639.dir/build.make CMakeFiles/cmTC_14639.dir/build

  Error: 'f' not found

  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  CMakeLists.txt

C:\Users\erich.gubler\.cargo\registry\src\github.com-1ecc6299db9ec823\qml-0.0.9\build.rs:32

Using Windows 10 with Qt 5.8 installed in the default location. QTDIR is set to C:\Qt\5.8\msvc2015_64, per flanfly's suggestion. CMAKE_PREFIX_PATH is NOT set, but cmake is in my path. I use Win-builds in my path for my copy of gcc, which may or may not affect things, but I don't think so.

I think most of the problem is that there aren't any install instructions at this point in the README.md...which leaves us to shoot in the dark.

vandenoever commented 7 years ago

@ErichDonGubler Check for working C compiler: C:/Win-builds/bin/gcc.exe -- broken suggests that gcc is not working.

I've used this crate with Qt 5.6 and 5.7 on Linux and do not have a windows setup at my disposal, so I'm just guessing.

qml-rust depends on DOtherSide which has binary releases at https://github.com/filcuc/DOtherSide/releases You might be able to use those along with the environment variable DyLib_DOtherSide set to true/false or 0/1.

Some relevant snippets from build.rs: https://github.com/White-Oak/qml-rust/blob/master/build.rs#L9 https://github.com/White-Oak/qml-rust/blob/master/build.rs#L78

ErichDonGubler commented 7 years ago

I've gotten a small walkthrough for getting examples to run on this gist. I have a working example for Arch Linux, but I've yet to determine how exactly to get Windows to work.

Will work on this some more!

flanfly commented 7 years ago

@vandenoever @ErichDonGubler are you the MinGW based Rust toolchain or MSVC. You can check with rustc --version --verbose.

White-Oak commented 7 years ago

I suppose there is a need for some kind of prerequisites' setup for Windows MSYS and MSVC toolchains.

vandenoever commented 7 years ago

@flanfly i'm not on windows at all, but @ErichDonGubler is

flanfly commented 7 years ago

@vandenoever you're right, I got that mixed up :laughing:

ErichDonGubler commented 7 years ago

@flanfly: MSVC. I'm going to guess that I need the GNU ABI?

ShalokShalom commented 7 years ago

Is there any news?

Boscop commented 7 years ago

I tried to build it on Windows 8.1, I set QTDIR=D:\data\Qt\Qt5.8.0\5.8\msvc2015_64 and DyLib_DOtherSide=true, but it still doesn't build:

>cargo build
   Compiling qml v0.0.9 (https://github.com/White-Oak/qml-rust#3316f54e)
error: could not find native static library `DOtherSideStatic`, perhaps an -L flag is missing?

error: Could not compile `qml`.

But that env var is set! Btw, I used this one: https://github.com/filcuc/DOtherSide/releases/download/v0.6.3/libDOtherside-windows-x64-msvc2015-qt-5.8.zip and built a .lib file for the dll. But it's not even trying to use that.

kieraneglin commented 7 years ago

Any update on this? I built my application on OSX and I need to run it on Windows as a one-time thing. I've put the DOtherside DLL provided on the release page into my System32 folder. I've also set the env variable to "true". What other steps do I need to take?