maplibre / maplibre-native-qt

MapLibre Native Qt Bindings and Qt Location Plugin
https://maplibre.org/maplibre-native-qt/docs/
38 stars 14 forks source link

Library does not build on MacOS Qt 6.6.1 #105

Closed fro0m closed 8 months ago

fro0m commented 8 months ago

Describe the bug When building for IOs Sonomna it gives:

CMake Warning at /Users/user/Qt/6.6.1/ios/lib/cmake/Qt6/Qt6Config.cmake:156 (find_package):
  Found package configuration file:

    /Users/user/Qt/6.6.1/ios/lib/cmake/Qt6Gui/Qt6GuiConfig.cmake

  but it set Qt6Gui_FOUND to FALSE so package "Qt6Gui" is considered to be
  NOT FOUND.  Reason given by package:

  Qt6Gui could not be found because dependency GLESv2 could not be found.

  Configuring with --debug-find-pkg=GLESv2 might reveal details why the
  package was not found.

  Configuring with -DQT_DEBUG_FIND_PACKAGE=ON will print the values of some
  of the path variables that find_package uses to try and find the package.

Call Stack (most recent call first):
  CMakeLists.txt:42 (find_package)

CMake Error at CMakeLists.txt:42 (find_package):
  Found package configuration file:

    /Users/user/Qt/6.6.1/ios/lib/cmake/Qt6/Qt6Config.cmake

  but it set Qt6_FOUND to FALSE so package "Qt6" is considered to be NOT
  FOUND.  Reason given by package:

  Failed to find required Qt component "Gui".

  Expected Config file at
  "/Users/user/Qt/6.6.1/ios/lib/cmake/Qt6Gui/Qt6GuiConfig.cmake" exists

  Configuring with --debug-find-pkg=Qt6Gui might reveal details why the
  package was not found.

  Configuring with -DQT_DEBUG_FIND_PACKAGE=ON will print the values of some
  of the path variables that find_package uses to try and find the package.

To Reproduce Steps to reproduce the behavior:

  1. Follow steps in Readme for building for IOs / IOs Simulator
  2. As a minimal command to reproduce. Execute
  3. cmake ../ \
    -DCMAKE_CONFIGURATION_TYPES="Release;Debug" -DCMAKE_C_COMPILER_LAUNCHER="ccache" \ -DCMAKE_CXX_COMPILER_LAUNCHER="ccache" \ -DCMAKE_INSTALL_PREFIX="../install"

Expected behavior It builds

Platform information (please complete the following information):

Additional context I tried to install these libs but without success brew install mesa brew install mesa-glu brew install mesalib-glw

ntadej commented 8 months ago

The following works for me on a relatively fresh install of macOS Sonoma.

qt-cmake ../../maplibre-native-qt/ -G"Ninja Multi-Config" -DCMAKE_CONFIGURATION_TYPES="Release;Debug" -DCMAKE_C_COMPILER_LAUNCHER="ccache" -DCMAKE_CXX_COMPILER_LAUNCHER="ccache" -DCMAKE_INSTALL_PREFIX=../../install/qt6-ios -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64"

Make sure you use qt-cmake and not just cmake as it sets proper toolchains.

fro0m commented 8 months ago

@ntadej thank you for having a look. Running with qt-cmake gives me this:

/Users/user/Qt/6.6.1/ios/bin/qt-cmake -B /Users/user/prj/ubego-mobile-app/build-ubego-Qt_6_6_1_for_iOS-Debug/libs/Darwin_x86_64/iphoneos/map_libre_native_qt_lib -DCMAKE_INSTALL_PREFIX=/Users/user/prj/ubego-mobile-app/build-ubego-Qt_6_6_1_for_iOS-Debug/libs/Darwin_x86_64/iphoneos/map_libre_native_qt_lib/install  -G"Ninja Multi-Config" -DCMAKE_CONFIGURATION_TYPES="Release;Debug" -DCMAKE_C_COMPILER_LAUNCHER="ccache" -DCMAKE_CXX_COMPILER_LAUNCHER="ccache" -DCMAKE_OSX_ARCHITECTURES="x86_64;arm64" -DCMAKE_BUILD_TYPE=RelWithDebInfo -S .
-- Version 3.0.0
-- The CXX compiler identification is AppleClang 15.0.0.15000100
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE  
-- Performing Test HAVE_EGL
-- Performing Test HAVE_EGL - Failed
-- Could NOT find EGL (missing: EGL_INCLUDE_DIR HAVE_EGL EGL_LIBRARY) 
-- Performing Test HAVE_GLESv2
-- Performing Test HAVE_GLESv2 - Success
-- Found GLESv2: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS17.2.sdk/System/Library/Frameworks/OpenGLES.framework  
-- Found ZLIB: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS17.2.sdk/usr/lib/libz.tbd (found version "1.2.12")  
-- Found WrapSystemZLIB: TRUE  
-- Using system ZLIB.
-- Found WrapZLIB: TRUE  
-- Using Qt bundled PNG.
-- Found WrapPNG: TRUE  
-- Using Qt bundled Harfbuzz.
-- Found WrapHarfbuzz: TRUE  
-- Using Qt bundled Freetype.
-- Found WrapFreetype: TRUE  
-- Performing Test HAVE_STDATOMIC
-- Performing Test HAVE_STDATOMIC - Success
-- Found WrapAtomic: TRUE  
-- Looking for backtrace
-- Looking for backtrace - not found
-- Could NOT find Backtrace (missing: Backtrace_LIBRARY) 
CMake Warning at /usr/local/Cellar/cmake/3.28.1/share/cmake/Modules/CMakeFindDependencyMacro.cmake:76 (find_package):
  Found package configuration file:

    /Users/user/Qt/6.6.1/ios/lib/cmake/Qt6Core/Qt6CoreConfig.cmake

  but it set Qt6Core_FOUND to FALSE so package "Qt6Core" is considered to be
  NOT FOUND.  Reason given by package:

  Qt6Core could not be found because dependency WrapBacktrace could not be
  found.

  Configuring with --debug-find-pkg=WrapBacktrace might reveal details why
  the package was not found.

  Configuring with -DQT_DEBUG_FIND_PACKAGE=ON will print the values of some
  of the path variables that find_package uses to try and find the package.

Call Stack (most recent call first):
  /Users/user/Qt/6.6.1/ios/lib/cmake/Qt6/QtPublicDependencyHelpers.cmake:111 (find_dependency)
  /Users/user/Qt/6.6.1/ios/lib/cmake/Qt6Gui/Qt6GuiDependencies.cmake:39 (_qt_internal_find_qt_dependencies)
  /Users/user/Qt/6.6.1/ios/lib/cmake/Qt6Gui/Qt6GuiConfig.cmake:40 (include)
  /Users/user/Qt/6.6.1/ios/lib/cmake/Qt6/Qt6Config.cmake:156 (find_package)
  CMakeLists.txt:42 (find_package)

CMake Warning at /Users/user/Qt/6.6.1/ios/lib/cmake/Qt6/Qt6Config.cmake:156 (find_package):
  Found package configuration file:

    /Users/user/Qt/6.6.1/ios/lib/cmake/Qt6Gui/Qt6GuiConfig.cmake

  but it set Qt6Gui_FOUND to FALSE so package "Qt6Gui" is considered to be
  NOT FOUND.  Reason given by package:

  Qt6Gui could not be found because dependency Qt6Core could not be found.

  Configuring with --debug-find-pkg=Qt6Core might reveal details why the
  package was not found.

  Configuring with -DQT_DEBUG_FIND_PACKAGE=ON will print the values of some
  of the path variables that find_package uses to try and find the package.

Call Stack (most recent call first):
  CMakeLists.txt:42 (find_package)

CMake Error at CMakeLists.txt:42 (find_package):
  Found package configuration file:

    /Users/user/Qt/6.6.1/ios/lib/cmake/Qt6/Qt6Config.cmake

  but it set Qt6_FOUND to FALSE so package "Qt6" is considered to be NOT
  FOUND.  Reason given by package:

  Failed to find required Qt component "Gui".

  Expected Config file at
  "/Users/user/Qt/6.6.1/ios/lib/cmake/Qt6Gui/Qt6GuiConfig.cmake" exists

  Configuring with --debug-find-pkg=Qt6Gui might reveal details why the
  package was not found.

  Configuring with -DQT_DEBUG_FIND_PACKAGE=ON will print the values of some
  of the path variables that find_package uses to try and find the package.

-- Configuring incomplete, errors occurred!

note that configuring with CMake with Xcode (default when not specifying generator) generator finds Backtrace.
Attaching CMake command and output

/Users/user/Qt/6.6.1/ios/bin/qt-cmake -B /Users/user/prj/ubego-mobile-app/build-ubego-Qt_6_6_1_for_iOS-Debug/libs/Darwin_x86_64/iphoneos/map_libre_native_qt_lib -DCMAKE_INSTALL_PREFIX=/Users/user/prj/ubego-mobile-app/build-ubego-Qt_6_6_1_for_iOS-Debug/libs/Darwin_x86_64/iphoneos/map_libre_native_qt_lib/install  -DCMAKE_C_COMPILER_LAUNCHER="ccache" -DCMAKE_CXX_COMPILER_LAUNCHER="ccache" -DCMAKE_OSX_ARCHITECTURES="x86_64;arm64" -DCMAKE_BUILD_TYPE=RelWithDebInfo -S .
-- Version 3.0.0
-- The CXX compiler identification is AppleClang 15.0.0.15000100
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE  
-- Performing Test HAVE_EGL
-- Performing Test HAVE_EGL - Failed
-- Could NOT find EGL (missing: EGL_INCLUDE_DIR HAVE_EGL EGL_LIBRARY) 
-- Performing Test HAVE_GLESv2
-- Performing Test HAVE_GLESv2 - Success
-- Found GLESv2: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS17.2.sdk/System/Library/Frameworks/OpenGLES.framework  
-- Found ZLIB: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS17.2.sdk/usr/lib/libz.tbd (found version "1.2.12")  
-- Found WrapSystemZLIB: TRUE  
-- Using system ZLIB.
-- Found WrapZLIB: TRUE  
-- Using Qt bundled PNG.
-- Found WrapPNG: TRUE  
-- Using Qt bundled Harfbuzz.
-- Found WrapHarfbuzz: TRUE  
-- Using Qt bundled Freetype.
-- Found WrapFreetype: TRUE  
-- Performing Test HAVE_STDATOMIC
-- Performing Test HAVE_STDATOMIC - Success
-- Found WrapAtomic: TRUE  
-- Looking for backtrace
-- Looking for backtrace - found
-- backtrace facility detected in default set of libraries
-- Found Backtrace: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS17.2.sdk/usr/include  
-- Using Qt bundled PCRE2.
-- Found WrapPCRE2: TRUE  
-- Performing Test HAVE_GETTIME
-- Performing Test HAVE_GETTIME - Success
-- Performing Test HAVE_SHM_OPEN_SHM_UNLINK
-- Performing Test HAVE_SHM_OPEN_SHM_UNLINK - Success
-- Found WrapRt: TRUE  
-- Using Qt bundled Jpeg.
-- Found WrapJpeg: TRUE  
-- Found AVFoundation: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS17.2.sdk/System/Library/Frameworks/AVFoundation.framework  
-- Using Qt6
-- The C compiler identification is AppleClang 15.0.0.15000100
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Configuring GL-Native with OpenGL renderer backend
-- Configuring MapLibre Native with Qt platform
CMake Error at src/location/plugins/CMakeLists.txt:64 (install):
  install TARGETS given OBJECT library "qtgeoservices_maplibre_init" whose
  objects may not be installed under Xcode with multiple architectures.

CMake Error at src/location/plugins/CMakeLists.txt:172 (install):
  install TARGETS given OBJECT library
  "declarative_locationplugin_maplibre_init" whose objects may not be
  installed under Xcode with multiple architectures.

-- Building location module
-- Building widgets module
-- Configuring incomplete, errors occurred!
ntadej commented 8 months ago

Make sure you run Xcode at least once and have iOS SDK installed. They are not by default anymore.

It may help if you go to Settings -> Locations to make sure command line tools are properly set up also for iOS.

fro0m commented 8 months ago

@ntadej it is all installed. What Xcode version and Qt version do you use?

ntadej commented 8 months ago

The latest Xcode and Qt 6.6.1.

Please check the command line settings as I also had to make Xcode ones active.

fro0m commented 8 months ago

I figured out that this Backtrace lib is located in the CommanLineTools subdirectory and this directory was not in CMake search path, so I added

-DCMAKE_FIND_ROOT_PATH="/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/

It may be a bug of Qt , IDK

fro0m commented 8 months ago

@ntadej thank you for help