Skip to content

(Windows/mingw64) Can't link static binary #1769

@autofire372

Description

@autofire372

I am at my wit's end. I am trying to build mGBA as a static binary on Windows via mingw64. I have installed qt5-static, and installed ffmpeg 4.2.3 from source. I then invoke the following cmake command:

cmake -DCMAKE_EXE_LINKER_FLAGS=-static -DUSE_MINIZIP=OFF -DZLIB_LIBRARY_RELEASE=/mingw64/lib/libz.a -DEPOXY_LIBRARIES=/mingw64/lib/libepoxy.a -DPNG_LIBRARY_RELEASE=/mingw64/lib/libpng.a -DSQLite3_LIBRARY=/mingw64/lib/libsqlite3.a -DQt5Core_DIR=/mingw/qt5-static/lib/cmake/Qt5Core -DQt5Gui_DIR:PATH=/mingw64/qt5-static/lib/cmake/Qt5Gui -DQt5LinguistTools_DIR:PATH=/mingw64/qt5-static/lib/cmake/Qt5LinguistTools -DQt5Multimedia_DIR:PATH=/mingw64/qt5-static/lib/cmake/Qt5Multimedia -DQt5Network_DIR:PATH=/mingw64/qt5-static/lib/cmake/Qt5Network -DQt5OpenGL_DIR:PATH=/mingw64/qt5-static/lib/cmake/Qt5OpenGL -DQt5Widgets_DIR:PATH=/mingw64/qt5-static/lib/cmake/Qt5Widgets -DQt5_DIR:PATH=/mingw64/qt5-static/lib/cmake/Qt5 -DQTPCRE:FILEPATH=/mingw64/qt5-static/lib/libqtpcre2.a -DBUILD_STATIC=ON -DBUILD_SHARED=OFF .. -G "MSYS Makefiles"

The SDL binary builds fine (though it refuses to run outside minGW), but the Qt binary trips at the finish line:

C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lqwindows C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lqwindows collect2.exe: error: ld returned 1 exit status make[2]: *** [qt/CMakeFiles/mgba-qt.dir/build.make:1755: qt/mGBA.exe] Error 1 make[1]: *** [CMakeFiles/Makefile2:513: qt/CMakeFiles/mgba-qt.dir/all] Error 2 make: *** [Makefile:172: all] Error 2

I can't use Docker as I am on Windows 10 Home. What am I doing wrong?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions