premake / premake/premake-core

undefined reference to `__imp_CertFreeCertificateContext' when building under MSYS2

Open
#1,870 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
C
Stars
3.6k
Forks
654
Avg merge
1d 1h
Merged PRs (30d)
13

Description

I'm trying to build premake-5.0.0-beta1-src under MSYS2 but get this linking error:

zheka@hydra MINGW64 /c/projects/premake5/premake-5.0.0-beta1-src/build/gmake2.windows
$ make Premake5
==== Building lua-lib (release_win32) ====
==== Building zip-lib (release_win32) ====
==== Building zlib-lib (release_win32) ====
==== Building curl-lib (release_win32) ====
==== Building Premake5 (release_win32) ====
Linking Premake5
../../src/host/curl_utils.c: In function 'curlRequest':
../../src/host/curl_utils.c:179:9: warning: call to '_curl_easy_setopt_err_write_callback' declared with attribute warning: curl_easy_setopt expects a curl_write_callback argument for this option [-Wattribute-warning]
  179 |         curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, curlWriteCallback);
      |         ^
../../src/host/curl_utils.c:185:17: warning: call to '_curl_easy_setopt_err_progress_cb' declared with attribute warning: curl_easy_setopt expects a curl_progress_callback argument for this option [-Wattribute-warning]
  185 |                 curl_easy_setopt(curl, CURLOPT_PROGRESSFUNCTION, curlProgressCallback);
      |                 ^
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\msys64\tmp\ccojyC5r.ltrans10.ltrans.o:<artificial>:(.text+0x1843): undefined reference to `__imp_CertFreeCertificateContext'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\msys64\tmp\ccojyC5r.ltrans10.ltrans.o:<artificial>:(.text+0x1c8a): undefined reference to `__imp_CertFreeCertificateContext'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\msys64\tmp\ccojyC5r.ltrans10.ltrans.o:<artificial>:(.text+0x1d95): undefined reference to `__imp_CertFreeCertificateContext'
collect2.exe: error: ld returned 1 exit status
make[1]: *** [Premake5.make:183: ../../bin/release/premake5.exe] Error 1
make: *** [Makefile:50: Premake5] Error 2

However, if I add libcrypt32 to LIBS the build succeeds:

user@host MINGW64 /c/projects/premake5/premake-5.0.0-beta1-src/build/gmake2.windows
$ LIBS=-lcrypt32 make Premake5
==== Building lua-lib (release_win32) ====
==== Building zip-lib (release_win32) ====
==== Building zlib-lib (release_win32) ====
==== Building curl-lib (release_win32) ====
==== Building Premake5 (release_win32) ====
Linking Premake5
../../src/host/curl_utils.c: In function 'curlRequest':
../../src/host/curl_utils.c:179:9: warning: call to '_curl_easy_setopt_err_write_callback' declared with attribute warning: curl_easy_setopt expects a curl_write_callback argument for this option [-Wattribute-warning]
  179 |         curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, curlWriteCallback);
      |         ^
../../src/host/curl_utils.c:185:17: warning: call to '_curl_easy_setopt_err_progress_cb' declared with attribute warning: curl_easy_setopt expects a curl_progress_callback argument for this option [-Wattribute-warning]
  185 |                 curl_easy_setopt(curl, CURLOPT_PROGRESSFUNCTION, curlProgressCallback);
      |                 ^

user@host MINGW64 /c/projects/premake5/premake-5.0.0-beta1-src/build/gmake2.windows
$ ../../bin/release/premake5.exe --version
premake5 (Premake Build Script Generator) 5.0.0-beta1

Looks like this library was forgotten at some point. Or is this only relevant to MSYS2 and not for other MinGW-related environments?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in the build/gmake2.windows configuration that produces Premake5.make, and compare its Windows linker libraries with the successful LIBS=-lcrypt32 build. Check the link step for Premake5 and confirm the fix by rebuilding under MSYS2 without the environment override, then run ../../bin/release/premake5.exe --version.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
build-system
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.