Я пытаюсь скомпилировать Marble на Windows 10, используя Mingw и Qt 5.5.
g++ (i686-posix-dwarf-rev1, Built by MinGW-W64 project) 4.9.2
Copyright (C) 2014 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Я слежу за официальным инструкция. Однако я получаю ошибку компиляции:
F:\marble\marble\src\lib\marble\MarbleZip.cpp:371:1: warning: 'Marble::MarbleZipReader::FileInfo::FileInfo()' redeclared without dllimport attribute: previous dllimport ignored [-Wattributes]
MarbleZipReader::FileInfo::FileInfo()
^
F:\marble\marble\src\lib\marble\MarbleZip.cpp:376:1: warning: 'Marble::MarbleZipReader::FileInfo::~FileInfo()' redeclared without dllimport attribute: previous dllimport ignored [-Wattributes]
MarbleZipReader::FileInfo::~FileInfo()
^
F:\marble\marble\src\lib\marble\MarbleZip.cpp:380:1: warning: 'Marble::MarbleZipReader::FileInfo::FileInfo(const Marble::MarbleZipReader::FileInfo&)' redeclared without dllimport attribute: previous dllimport ignored [-Wattributes]
MarbleZipReader::FileInfo::FileInfo(const FileInfo &other)
^
F:\marble\marble\src\lib\marble\MarbleZip.cpp:385:28: warning: 'Marble::MarbleZipReader::FileInfo& Marble::MarbleZipReader::FileInfo::operator=(const Marble::MarbleZipReader::FileInfo&)' redeclared without dllimport attribute after being referenced with dll linkage
MarbleZipReader::FileInfo& MarbleZipReader::FileInfo::operator=(const FileInfo &other)
^
F:\marble\marble\src\lib\marble\MarbleZip.cpp:398:6: warning: 'bool Marble::MarbleZipReader::FileInfo::isValid() const' redeclared without dllimport attribute: previous dllimport ignored [-Wattributes]
bool MarbleZipReader::FileInfo::isValid() const
^
[ 46%] Building CXX object src/lib/marble/CMakeFiles/marblewidget-qt5.dir/cloudsync/CloudSyncManager.cpp.obj
[ 47%] Building CXX object src/lib/marble/CMakeFiles/marblewidget-qt5.dir/cloudsync/RouteSyncManager.cpp.obj
[ 47%] Building CXX object src/lib/marble/CMakeFiles/marblewidget-qt5.dir/cloudsync/OwncloudSyncBackend.cpp.obj
[ 47%] Building CXX object src/lib/marble/CMakeFiles/marblewidget-qt5.dir/cloudsync/CloudRouteModel.cpp.obj
[ 47%] Building CXX object src/lib/marble/CMakeFiles/marblewidget-qt5.dir/cloudsync/CloudRoutesDialog.cpp.obj
[ 47%] Building CXX object src/lib/marble/CMakeFiles/marblewidget-qt5.dir/cloudsync/RouteItem.cpp.obj
[ 47%] Building CXX object src/lib/marble/CMakeFiles/marblewidget-qt5.dir/cloudsync/RouteItemDelegate.cpp.obj
[ 47%] Building CXX object src/lib/marble/CMakeFiles/marblewidget-qt5.dir/cloudsync/BookmarkSyncManager.cpp.obj
[ 47%] Building CXX object src/lib/marble/CMakeFiles/marblewidget-qt5.dir/cloudsync/MergeItem.cpp.obj
[ 47%] Building CXX object src/lib/marble/CMakeFiles/marblewidget-qt5.dir/cloudsync/ConflictDialog.cpp.obj
[ 47%] Building CXX object src/lib/marble/CMakeFiles/marblewidget-qt5.dir/MarbleWebView.cpp.obj
[ 47%] Building CXX object src/lib/marble/CMakeFiles/marblewidget-qt5.dir/TinyWebBrowser.cpp.obj
[ 47%] Building CXX object src/lib/marble/CMakeFiles/marblewidget-qt5.dir/MarbleDBusInterface.cpp.obj
[ 47%] Building CXX object src/lib/marble/CMakeFiles/marblewidget-qt5.dir/qrc_libmarble.cpp.obj
[ 47%] Building CXX object src/lib/marble/CMakeFiles/marblewidget-qt5.dir/qrc_marble.cpp.obj
[ 47%] Building CXX object src/lib/marble/CMakeFiles/marblewidget-qt5.dir/marblewidget-qt5_automoc.cpp.obj
[ 48%] Linking CXX shared library libmarblewidget-qt5.dll
CMakeFiles\marblewidget-qt5.dir/objects.a(NewstuffModel.cpp.obj):NewstuffModel.cpp:(.text+0x8a42): undefined reference to `_imp___ZN6Marble15MarbleZipReader8FileInfoD1Ev'
CMakeFiles\marblewidget-qt5.dir/objects.a(NewstuffModel.cpp.obj):NewstuffModel.cpp:(.text+0x8aaf): undefined reference to `_imp___ZN6Marble15MarbleZipReader8FileInfoD1Ev'
F:/Qt/Tools/mingw492_32/bin/../lib/gcc/i686-w64-mingw32/4.9.2/../../../../i686-w64-mingw32/bin/ld.exe: CMakeFiles\marblewidget-qt5.dir/objects.a(NewstuffModel.cpp.obj): bad reloc address 0x4 in section `.data'
collect2.exe: error: ld returned 1 exit status
src\lib\marble\CMakeFiles\marblewidget-qt5.dir\build.make:17541: recipe for target 'src/lib/marble/libmarblewidget-qt5.dll' failed
mingw32-make[2]: *** [src/lib/marble/libmarblewidget-qt5.dll] Error 1
CMakeFiles\Makefile2:1254: recipe for target 'src/lib/marble/CMakeFiles/marblewidget-qt5.dir/all' failed
mingw32-make[1]: *** [src/lib/marble/CMakeFiles/marblewidget-qt5.dir/all] Error 2
makefile:159: recipe for target 'all' failed
mingw32-make: *** [all] Error 2
Похоже, есть некоторые проблемы с zlib, я пытался указать путь к zlib (скомпилирован вручную с помощью Mingw) через CMake GUI, но результат был тот же — ошибка при связывании libmarblewidget-qt5.dll. Итак … Кто-нибудь знает, как я могу это исправить?
В файле «MarbleZipReader.h» измените
struct Q_GUI_EXPORT FileInfo
в
struct MARBLE_EXPORT FileInfo
Это сработало для меня, но не уверен, что это совершенно правильно. Я предполагаю, что это будет исправлено на каком-то этапе. Я использовал мраморную ветку «Приложение / 15.12».
Благодаря ответу @ user5792278 ошибка связи вопроса может быть решена. Однако вы можете столкнуться с дополнительными ошибками компоновки (касающимися libz
). В моем случае это было с версиями Application/15.12
+ Qt5.5
+ GCC4.9.2
:
CMakeFiles \ marblewidget-qt5.dir / objects.a (MarbleZip.cpp.obj): MarbleZip.cpp :(. Text + […]): неопределенная ссылка на inflateInit2_ […]
быстрый (хотя и не обязательно чистый) взломать, чтобы решить эту проблему, это заменить
линия
TARGET_LINK_LIBRARIES (${MARBLEWIDGET} astro)
с
TARGET_LINK_LIBRARIES (${MARBLEWIDGET} astro z)
в файле sources\src\lib\marble\CMakeLists.txt