maplibre / maplibre-native-qt

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

Cannot run quick example on Windows, Qt 6.5.3 #75

Closed jennyrudemo closed 1 week ago

jennyrudemo commented 8 months ago

I try to run the quick example on Windows, using Qt 6.5.3. The program starts, but the map is not visible and I get the error '1 , "The geoservices provider is not supported.” '

OS: Windows Qt version: 6.5.3 Compiler/kit: MSVC2019 64bit

To run the example, I set up a Qt Quick Application (compat) in Qt Creator, choosing qmake as build system and Desktop Qt 6.5.3 MSVC2019 64bit as kit. Then I added the example code to the main.cpp, main.qml and .pro file.

I used the Qt 6.4.3 MSVC2019 release from https://github.com/maplibre/maplibre-native-qt/releases/tag/v2.1.0 and moved the content from the folder _msvc201964 (Qt/6.4.3/msvc2019) and placed it in a folder called maplibre.

I refer to the contents of this folder when I set the environment variables QML_IMPORT_PATH, QT_PLUGIN_PATH, and LD_LIBRARY_PATH (not sure if this is correct for Windows, have also tried DYLD_LIBRARY_PATH and simply PATH).

QML_IMPORT_PATH = "<path>/maplibre/qml/"
QT_PLUGIN_PATH = "<path>/maplibre/plugins/"
PATH = "<path>/maplibre/lib/"

Does it matter what I call the folder that contains the folders plugins, lib, bin, include, etc.? Does it matter where I place the folder?

I have looked at this issue and tried setting the enivorment varaibles as mentioned above and to add this suggestion to the main.cpp.

The output is still image And error message: 1 , "The geoservices provider is not supported.”

Any suggestions on what might be wrong? Could it be because I use Qt 6.5.3 in the project and the plugin build is based on 6.4.3?

jennyrudemo commented 8 months ago

I've tried to build the example with Qt 6.4.3 but keep getting the error "Unknown module(s) in QT: location" when I run qmake. I also tried running this older example but I get the same error.

Not sure if this is worth trying to solve, since I want to use MapLibre with Qt 6.5.3 in the end.

FinitelyFailed commented 8 months ago

I managed to build the project, targeting Qt 6.5.3.

I have some problems with using the lib in a Qt project however.

We want to be able to develop our app on Windows and Linux, the app itself will run on an embedded Linux device in the end.

Parts of the pro file looks like this:

win32 {
    # Maplibre
    copyToDestDir($$PWD/'../libs/windows/qt6.5.3-plugins/maplibre/bin/QMapLibre.dll', $$OUT_PWD)
    copyToDestDir($$PWD/'../libs/windows/qt6.5.3-plugins/maplibre/plugins', $$OUT_PWD)
    copyToDestDir($$PWD/'../libs/windows/qt6.5.3-plugins/maplibre/plugins/geoservices', $$OUT_PWD)
    copyToDestDir($$PWD/'../libs/windows/qt6.5.3-plugins/maplibre/plugins/geoservices/qtgeoservices_maplibre.dll', $$OUT_PWD)

    LIBS += -L$$PWD/'../libs/windows/qt6.5.3-plugins/maplibre/lib' -lQMapLibre

    INCLUDEPATH += $$PWD/'../libs/windows/qt6.5.3-plugins/maplibre/include'
    DEPENDPATH += $$PWD/'../libs/windows/qt6.5.3-plugins/maplibre/include'

    win32:win32-g++:CONFIG(release, debug|release): PRE_TARGETDEPS += $$PWD/'../libs/windows/qt6.5.3-plugins/maplibre/lib/QMapLibre.lib'
    win32:win32-g++:CONFIG(debug, debug|release): PRE_TARGETDEPS += $$PWD/'../libs/windows/qt6.5.3-plugins/maplibre/lib/QMapLibre.lib'
}

image

The output looks like this:

Debug:  MESSAGE: checking directory path "C:/dev/places/gpt-onboard/GptEdge/build-frontend_apps-Desktop_Qt_6_5_3_MSVC2019_64bit-Release/GPTPilotQmake/release/geoservices" ...
Debug:  MESSAGE: "C:/dev/places/gpt-onboard/GptEdge/frontend_apps/libs/windows/qt6.5.3-plugins/maplibre/plugins/geoservices/qtgeoservices_maplibre.dll" cannot load: Cannot load library C:\dev\places\gpt-onboard\GptEdge\frontend_apps\libs\windows\qt6.5.3-plugins\maplibre\plugins\geoservices\qtgeoservices_maplibre.dll: The specified module could not be found.
Debug:  MESSAGE: QLibraryPrivate::loadPlugin failed on "C:/dev/places/gpt-onboard/GptEdge/frontend_apps/libs/windows/qt6.5.3-plugins/maplibre/plugins/geoservices/qtgeoservices_maplibre.dll" : "Cannot load library C:\\dev\\places\\gpt-onboard\\GptEdge\\frontend_apps\\libs\\windows\\qt6.5.3-plugins\\maplibre\\plugins\\geoservices\\qtgeoservices_maplibre.dll: The specified module could not be found."
Debug:  MESSAGE: 5 ,  "loader()->instance(idx) failed to return an instance. Set the environment variable QT_DEBUG_PLUGINS to see more details."

Edit:

I got mine working, I had to copy some more dll:s and make sure that OpenGL was used for rendering.

Parts of my pro-file:

win32 {
    # Maplibre
    copyToDestDir($$PWD/'../libs/windows/qt6.5.3-plugins/maplibre/bin/QMapLibre.dll', $$OUT_PWD)
    copyToDestDir($$PWD/'../libs/windows/qt6.5.3-plugins/maplibre/bin/QMapLibreLocation.dll', $$OUT_PWD)
    copyToDestDir($$PWD/'../libs/windows/qt6.5.3-plugins/maplibre/bin/QMapLibreWidgets.dll', $$OUT_PWD)

    LIBS += -L$$PWD/'../libs/windows/qt6.5.3-plugins/maplibre/lib' -lQMapLibre

    INCLUDEPATH += $$PWD/'../libs/windows/qt6.5.3-plugins/maplibre/include'
    DEPENDPATH += $$PWD/'../libs/windows/qt6.5.3-plugins/maplibre/include'

    win32:win32-g++:CONFIG(release, debug|release): PRE_TARGETDEPS += $$PWD/'../libs/windows/qt6.5.3-plugins/maplibre/lib/QMapLibre.lib'
    win32:win32-g++:CONFIG(debug, debug|release): PRE_TARGETDEPS += $$PWD/'../libs/windows/qt6.5.3-plugins/maplibre/lib/QMapLibre.lib'
}

image

ntadej commented 1 week ago

Basic usage documentation is now provided. QML/Location plugins are mentioned.