MINGW-packages: Unable to static link lerc.

Hello,

I’ve been trying to compile one of my project for Windows using msys2 and mingw, and it fails to link statically because of a missing library: lerc.

I’ve obviouslly installed mingw-w64-x86_64-lerc and I believe the issue is because Meson can’t find libLerc.a. The package does provide libLerc.dll.a, but not precisely libLerc.a.

Not gonna lie, I’m no expert here so I was wondering if this was normal and there’s a logical reason why meson can’t find that library or if it could be an oversight from the packager.

Logs:

The Meson build system
Version: 0.60.2
Source dir: D:/a/Hades/Hades
Build dir: D:/a/Hades/Hades/build
Build type: native build
Project name: Hades
Project version: 0.0.1
C compiler for the host machine: cc (gcc 11.2.0 "cc (Rev2, Built by MSYS2 project) 11.2.0")
C linker for the host machine: cc ld.bfd 2.37
C++ compiler for the host machine: c++ (gcc 11.2.0 "c++ (Rev2, Built by MSYS2 project) 11.2.0")
C++ linker for the host machine: c++ ld.bfd 2.37
Host machine cpu family: x86_64
Host machine cpu: x86_64
Found pkg-config: D:\a\_temp\msys64\mingw64\bin/pkg-config.EXE (0.29.2)
Run-time dependency sdl2 found: YES 2.0.16
Run-time dependency sdl2_image found: YES 2.0.5
Run-time dependency glew found: YES 2.2.0
Run-time dependency gl found: YES
Run-time dependency libpng found: YES 1.6.37
Run-time dependency libjpeg found: YES 2.1.2
WARNING: Static library 'Lerc' not found for dependency 'libtiff-4', may not be statically linked
Run-time dependency libtiff-4 found: YES 4.3.0
Run-time dependency libwebp found: YES 1.2.1
Run-time dependency threads found: YES
Program cp found: YES (D:\a\_temp\msys64\usr\bin/cp.EXE)
Build targets in project: 6

Hades 0.0.1

  User defined options
    static_executable: true

Found ninja-1.10.2 at D:\a\_temp\msys64\mingw64\bin/ninja.EXE
[1/57] Compiling C++ object external/libimgui.a.p/cimgui_imgui_imgui_tables.cpp.obj
[2/57] Compiling C++ object external/libimgui.a.p/cimgui_imgui_imgui_demo.cpp.obj
[3/57] Compiling C++ object external/libimgui.a.p/cimgui_imgui_imgui_draw.cpp.obj
[4/57] Compiling C++ object external/libimgui.a.p/cimgui_imgui_imgui_widgets.cpp.obj
[5/57] Compiling C++ object external/libimgui.a.p/cimgui_imgui_imgui.cpp.obj
[6/57] Compiling C++ object external/libimgui.a.p/cimgui_imgui_backends_imgui_impl_sdl.cpp.obj
[7/57] Compiling C object external/libfrozen.a.p/frozen_frozen.c.obj
[8/57] Compiling C++ object external/libimgui.a.p/cimgui_imgui_backends_imgui_impl_opengl3.cpp.obj
[9/57] Linking static target external/libfrozen.a
[10/57] Compiling C object source/gba/libgba.a.p/core_arm_bdt.c.obj
[11/57] Compiling C object source/common/libcommon.a.p/utils.c.obj
[12/57] Compiling C object source/gba/libgba.a.p/core_arm_branch.c.obj
[13/57] Compiling C object source/gba/libgba.a.p/core_arm_alu.c.obj
[14/57] Linking static target source/common/libcommon.a
[15/57] Compiling C object source/gba/libgba.a.p/apu_apu.c.obj
[16/57] Compiling C object source/gba/libgba.a.p/core_arm_swp.c.obj
[17/57] Compiling C object source/gba/libgba.a.p/core_arm_sdt.c.obj
[18/57] Compiling C object source/gba/libgba.a.p/core_arm_psr.c.obj
[19/57] Compiling C object source/gba/libgba.a.p/core_arm_core.c.obj
[20/57] Compiling C object source/gba/libgba.a.p/core_arm_swi.c.obj
[21/57] Compiling C object source/gba/libgba.a.p/core_arm_mul.c.obj
[22/57] Compiling C object source/gba/libgba.a.p/ppu_background_affine.c.obj
[23/57] Compiling C++ object external/libimgui.a.p/cimgui_cimgui.cpp.obj
[24/57] Compiling C object source/gba/libgba.a.p/ppu_background_bitmap.c.obj
[25/57] Compiling C object source/gba/libgba.a.p/ppu_background_text.c.obj
[26/57] Compiling C object source/gba/libgba.a.p/ppu_oam.c.obj
[27/57] Compiling C object source/gba/libgba.a.p/memory_memory.c.obj
[28/57] Compiling C object source/gba/libgba.a.p/ppu_ppu.c.obj
[29/57] Compiling C object source/gba/libgba.a.p/ppu_window.c.obj
[30/57] Compiling C object source/gba/libgba.a.p/scheduler.c.obj
[31/57] Compiling C++ object external/libimgui.a.p/imgui_file_dialog_ImGuiFileDialog.cpp.obj
../external/imgui_file_dialog/ImGuiFileDialog.cpp:50: warning: "stat" redefined
   50 | #define stat _stat
      | 
In file included from ../external/imgui_file_dialog/ImGuiFileDialog.cpp:40:
D:/a/_temp/msys64/mingw64/x86_64-w64-mingw32/include/sys/stat.h:279: note: this is the location of the previous definition
  279 | #define stat _stat64
      | 
cc1plus.exe: note: unrecognized command-line option '-Wno-microsoft-anon-tag' may have been intended to silence earlier diagnostics
[32/57] Linking static target external/libimgui.a
[33/57] Compiling C object source/gba/libgba.a.p/timer.c.obj
[34/57] Compiling C object source/gba/libgba.a.p/quicksave.c.obj
[35/57] Compiling C object source/gba/libgba.a.p/gba.c.obj
[36/57] Compiling C object source/platform/gui/hades.exe.p/config.c.obj
[37/57] Compiling C object source/platform/gui/hades.exe.p/error.c.obj
[38/57] Compiling C object source/platform/gui/hades.exe.p/game_screenshot.c.obj
[39/57] Compiling C object source/platform/gui/hades.exe.p/game_render.c.obj
[40/57] Compiling C object source/platform/gui/hades.exe.p/game_game.c.obj
[41/57] Compiling C object source/platform/gui/hades.exe.p/main.c.obj
[42/57] Compiling C object source/platform/gui/hades.exe.p/menubar.c.obj
[43/57] Compiling C object source/gba/libgba.a.p/core_thumb_core.c.obj
[44/57] Compiling C object source/gba/libgba.a.p/core_thumb_alu.c.obj
[45/57] Compiling C object source/gba/libgba.a.p/core_thumb_logical.c.obj
[46/57] Compiling C object source/gba/libgba.a.p/core_thumb_bdt.c.obj
[47/57] Compiling C object source/gba/libgba.a.p/core_thumb_sdt.c.obj
[48/57] Compiling C object source/gba/libgba.a.p/core_thumb_branch.c.obj
[49/57] Compiling C object source/gba/libgba.a.p/memory_storage_storage.c.obj
[50/57] Compiling C object source/gba/libgba.a.p/core_thumb_swi.c.obj
[51/57] Compiling C object source/gba/libgba.a.p/core_core.c.obj
[52/57] Compiling C object source/gba/libgba.a.p/memory_io.c.obj
[53/57] Compiling C object source/gba/libgba.a.p/memory_storage_flash.c.obj
[54/57] Compiling C object source/gba/libgba.a.p/memory_dma.c.obj
[55/57] Linking static target source/gba/libgba.a
[56/57] Linking target source/platform/gui/hades.exe
FAILED: source/platform/gui/hades.exe 
"c++"  -o source/platform/gui/hades.exe source/platform/gui/hades.exe.p/game_game.c.obj source/platform/gui/hades.exe.p/game_render.c.obj source/platform/gui/hades.exe.p/game_screenshot.c.obj source/platform/gui/hades.exe.p/config.c.obj source/platform/gui/hades.exe.p/error.c.obj source/platform/gui/hades.exe.p/main.c.obj source/platform/gui/hades.exe.p/menubar.c.obj "-Wl,--allow-shlib-undefined" "-Wl,-O1" "-Wl,--start-group" "source/gba/libgba.a" "source/common/libcommon.a" "external/libimgui.a" "external/libfrozen.a" "-static" "-pthread" "D:/a/_temp/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/lib/../lib/libmingw32.a" "D:/a/_temp/msys64/mingw64/lib/libSDL2main.a" "D:/a/_temp/msys64/mingw64/lib/libSDL2.a" "-mwindows" "D:/a/_temp/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/lib/../lib/libdinput8.a" "D:/a/_temp/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/lib/../lib/libshell32.a" "D:/a/_temp/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/lib/../lib/libsetupapi.a" "D:/a/_temp/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/lib/../lib/libadvapi32.a" "D:/a/_temp/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/lib/../lib/libuuid.a" "D:/a/_temp/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/lib/../lib/libversion.a" "D:/a/_temp/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/lib/../lib/liboleaut32.a" "D:/a/_temp/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/lib/../lib/libole32.a" "D:/a/_temp/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/lib/../lib/libimm32.a" "D:/a/_temp/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/lib/../lib/libwinmm.a" "D:/a/_temp/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/lib/../lib/libgdi32.a" "D:/a/_temp/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/lib/../lib/libuser32.a" "-lm" "-Wl,--no-undefined" "-pipe" "-Wl,--dynamicbase,--high-entropy-va,--nxcompat,--default-image-base-high" "-mwindows" "D:/a/_temp/msys64/mingw64/lib/libSDL2_image.a" "-mwindows" "-Wl,--no-undefined" "-Wl,--dynamicbase,--high-entropy-va,--nxcompat,--default-image-base-high" "-mwindows" "D:/a/_temp/msys64/mingw64/lib/libglew32.a" "-lopengl32" "D:/a/_temp/msys64/mingw64/lib/libpng16.a" "D:/a/_temp/msys64/mingw64/lib/libz.a" "D:/a/_temp/msys64/mingw64/lib/libjpeg.a" "D:/a/_temp/msys64/mingw64/lib/libtiff.a" "D:/a/_temp/msys64/mingw64/lib/libwebp.a" "D:/a/_temp/msys64/mingw64/lib/libzstd.a" "D:/a/_temp/msys64/mingw64/lib/liblzma.a" "D:/a/_temp/msys64/mingw64/lib/libjbig.a" "D:/a/_temp/msys64/mingw64/lib/libdeflate.a" "-LD:/a/_temp/msys64/mingw64/lib" "-lLerc" "-Wl,--subsystem,console" "-lkernel32" "-luser32" "-lgdi32" "-lwinspool" "-lshell32" "-lole32" "-loleaut32" "-luuid" "-lcomdlg32" "-ladvapi32" "-Wl,--end-group"
D:/a/_temp/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lLerc
collect2.exe: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
Error: Process completed with exit code 1.

Thank you for your time. 😄

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 20 (14 by maintainers)

Most upvoted comments

@Arignir Please feel free to open an upstream issue that it is not possible to build a static lib on Windows currently ootb.

Hello, I’ve made an issue upstream as requested, linking to this one so that anyone reading either of them can easily follow all of the discussion.