Benjamin-Dobell / Heimdall

Heimdall is a cross-platform open-source tool suite used to flash firmware (aka ROMs) onto Samsung Galaxy devices.
MIT License
2.62k stars 587 forks source link

CMake Error at heimdall-frontend/CMakeLists.txt:11 (find_package) #532

Open mariano-daniel opened 1 year ago

mariano-daniel commented 1 year ago

$ cmake --version cmake version 3.27.4

$ brew --version
Homebrew 4.1.10-11-g502434c
Homebrew/homebrew-core (git revision 87b45ed1ec7; last commit 2023-09-10)
Homebrew/homebrew-cask (git revision 8acf42495f; last commit 2023-09-11) (Running on Catalina OS)

When I run:

cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DQt5Widgets_DIR=/usr/local/opt/qt5/lib/cmake/Qt5Widgets ..

I get:

CMake Error at heimdall-frontend/CMakeLists.txt:11 (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.

However, I cannot find Qt5WidgetsConfig.cmake nor qt5widgets-config.cmake anywhere.

I googled to no avail but all the threads I found mention people finding these files and adding the dir to the env variable, but I cannot find these files.

Any help would be super appreciated"

Grimler91 commented 1 year ago

On many linux systems Qt5WidgetsConfig.cmake is provided by a package named qt5-qtbase or qt5-qtbase-dev, so check if you have one of those

mariano-daniel commented 1 year ago

On many linux systems Qt5WidgetsConfig.cmake is provided by a package named qt5-qtbase or qt5-qtbase-dev, so check if you have one of those

Hello & Thank you @Grimler91 ! I don't have any of those on MacOS neither I can find them on Brew.

depperson commented 1 year ago

Brew installs Qt5 in a special location so you need to tell cmake where to find the libraries:

cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DQt5Widgets_DIR=/opt/homebrew/opt/qt@5/lib/cmake/Qt5Widgets ..

Also due to a newer version of cmake (CMP0006) you will need to add this line in heimdall-frontend/CMakeLists.txt and heimdall/CMakeLists.txt:

CMAKE_POLICY(SET CMP0006 OLD)

That makes cmake happy but then I run into problems during make:

In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX14.0.sdk/usr/include/c++/v1/string:545:
/Library/Developer/CommandLineTools/SDKs/MacOSX14.0.sdk/usr/include/c++/v1/__functional/hash.h:184:12: error: no matching constructor for initialization of 'pair<unsigned long, unsigned long>'
    return pair<_Size, _Size>(__a + __z, __b + __c);
           ^                  ~~~~~~~~~~~~~~~~~~~~

This seems to be due to the C++ version? Maybe my gcc or Apple clang is too new?

mariano-daniel commented 1 year ago

Thanks @depperson ! I will try this in the morning (02:10am here) and see if I get the same results!

depperson commented 1 year ago

Check out https://github.com/fathonix/heimdall-osx-arm64 if all you need is an m1 compatible heimdall binary.