White-Oak / qml-rust

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

Build failure on macOS #40

Open lilyball opened 7 years ago

lilyball commented 7 years ago

I'm trying to build this on macOS 10.12.3. I first installed qt5 with Homebrew via brew install qt5, and confirmed that /usr/local/opt/qt5 exists. I then stuck qml = "0.0.9" in my Cargo.toml and ran cargo build, and it panicked:

error: failed to run custom build command for `qml v0.0.9`
process didn't exit successfully: `/Users/kevinballard/Dev/Rust/Scratch/sousa/target/debug/build/qml-5384353925dbbf0e/build-script-build` (exit code: 101)
--- stderr
thread 'main' panicked at 'Cannot build qrc resource:
-- The C compiler identification is AppleClang 8.0.0.8000042
-- The CXX compiler identification is AppleClang 8.0.0.8000042
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found Doxygen: /usr/local/bin/doxygen (found version "1.8.10") 
-- Configuring incomplete, errors occurred!
See also "/Users/kevinballard/Dev/Rust/Scratch/sousa/target/debug/build/qml-eb0722b0d2c5887a/out/DOtherSide/build/CMakeFiles/CMakeOutput.log".

Cloning into 'DOtherSide'...
CMake Warning at lib/CMakeLists.txt:10 (find_package):
  By not providing "FindQt5Core.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "Qt5Core", but
  CMake did not find one.

  Could not find a package configuration file provided by "Qt5Core" with any
  of the following names:

    Qt5CoreConfig.cmake
    qt5core-config.cmake

  Add the installation prefix of "Qt5Core" to CMAKE_PREFIX_PATH or set
  "Qt5Core_DIR" to a directory containing one of the above files.  If
  "Qt5Core" provides a separate development package or SDK, be sure it has
  been installed.

CMake Warning at lib/CMakeLists.txt:11 (find_package):
  By not providing "FindQt5Qml.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "Qt5Qml", but
  CMake did not find one.

  Could not find a package configuration file provided by "Qt5Qml" with any
  of the following names:

    Qt5QmlConfig.cmake
    qt5qml-config.cmake

  Add the installation prefix of "Qt5Qml" to CMAKE_PREFIX_PATH or set
  "Qt5Qml_DIR" to a directory containing one of the above files.  If "Qt5Qml"
  provides a separate development package or SDK, be sure it has been
  installed.

CMake Warning at lib/CMakeLists.txt:12 (find_package):
  By not providing "FindQt5Gui.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "Qt5Gui", but
  CMake did not find one.

  Could not find a package configuration file provided by "Qt5Gui" with any
  of the following names:

    Qt5GuiConfig.cmake
    qt5gui-config.cmake

  Add the installation prefix of "Qt5Gui" to CMAKE_PREFIX_PATH or set
  "Qt5Gui_DIR" to a directory containing one of the above files.  If "Qt5Gui"
  provides a separate development package or SDK, be sure it has been
  installed.

CMake Warning at lib/CMakeLists.txt:13 (find_package):
  By not providing "FindQt5Quick.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "Qt5Quick",
  but CMake did not find one.

  Could not find a package configuration file provided by "Qt5Quick" with any
  of the following names:

    Qt5QuickConfig.cmake
    qt5quick-config.cmake

  Add the installation prefix of "Qt5Quick" to CMAKE_PREFIX_PATH or set
  "Qt5Quick_DIR" to a directory containing one of the above files.  If
  "Qt5Quick" provides a separate development package or SDK, be sure it has
  been installed.

CMake Warning at lib/CMakeLists.txt:14 (find_package):
  By not providing "FindQt5Widgets.cmake" in CMAKE_MODULE_PATH this project
  has asked CMake to find a package configuration file provided by
  "Qt5Widgets", but CMake did not find one.

  Could not find a package configuration file provided by "Qt5Widgets" with
  any of the following names:

    Qt5WidgetsConfig.cmake
    qt5widgets-config.cmake

  Add the installation prefix of "Qt5Widgets" to CMAKE_PREFIX_PATH or set
  "Qt5Widgets_DIR" to a directory containing one of the above files.  If
  "Qt5Widgets" provides a separate development package or SDK, be sure it has
  been installed.

CMake Error at test/CMakeLists.txt:9 (find_package):
  By not providing "FindQt5Core.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "Qt5Core", but
  CMake did not find one.

  Could not find a package configuration file provided by "Qt5Core" with any
  of the following names:

    Qt5CoreConfig.cmake
    qt5core-config.cmake

  Add the installation prefix of "Qt5Core" to CMAKE_PREFIX_PATH or set
  "Qt5Core_DIR" to a directory containing one of the above files.  If
  "Qt5Core" provides a separate development package or SDK, be sure it has
  been installed.

I'm using CMake 3.7.2.

flanfly commented 7 years ago

You need to set QTDIR64 (or QTDIR if you're on 32 bit) to the install prefix of Qt. So QTDIR64=`brew --prefix qt5` cargo build should do the trick. Sorry, I forgot to document this.

lilyball commented 7 years ago

I looked at the build.rs script and it has code in there that explicitly looks in the Homebrew install area (/usr/local/opt/qt5) on macOS, so why would that environment variable be necessary?

lilyball commented 7 years ago

In fact, brew --prefix qt5 spits out /usr/local/opt/qt5, and setting QTDIR64 to that value has literally no effect. I get the exact same error.

flanfly commented 7 years ago

What happens when you remove qt5 and install homebrew/versions/qt55?

lilyball commented 7 years ago

Same error, using env QTDIR64=$(brew --prefix qt@5.5) cargo build.

Also, incidentally, homebrew says homebrew/versions/qt55 is deprecated and the correct syntax is qt@5.5.

JustinRyanH commented 7 years ago

For people searching for this issue

Seems this has been fixed with current master, however whenever you use qml = "0.0.9" in you will be using a version that will give you the above errors. Instead you should reference a more recent working build. In my project I used the SHA from a PR merged from Feb 22.

qml = { git = "https://github.com/White-Oak/qml-rust", rev = "d731e336fbd1e713"}