Quake3e icon indicating copy to clipboard operation
Quake3e copied to clipboard

[Mingw64-UCRT] libcurl causing build failure when using

Open rorgoroth opened this issue 4 years ago • 4 comments

Hello, I recently updated my cross compiler to use ucrt rather than old msvcrt.

Enabling CURL causes a build failure, which doesn't happen when using mingw using msvcrt. Here is the build log: q3e.log

Specific error part:

LD build/release-mingw64-x86_64/quake3e.x64.exe
/mingw64/lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld: code/libcurl/windows/mingw/lib64/libcurl.a(mprintf.o):(.text+0x1824): undefined reference to `__imp___iob_func'
/mingw64/lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld: code/libcurl/windows/mingw/lib64/libcurl.a(mprintf.o):(.text+0x18be): undefined reference to `__imp___iob_func'
/mingw64/lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld: code/libcurl/windows/mingw/lib64/libcurl.a(strerror.o):(.text+0x6f4): undefined reference to `__imp__sys_nerr'
/mingw64/lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld: code/libcurl/windows/mingw/lib64/libcurl.a(cookie.o):(.text+0x1984): undefined reference to `__imp___iob_func'
/mingw64/lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld: code/libcurl/windows/mingw/lib64/libcurl.a(cookie.o):(.text+0x1d02): undefined reference to `__imp___iob_func'
/mingw64/lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld: code/libcurl/windows/mingw/lib64/libcurl.a(url.o):(.text+0x150a): undefined reference to `__imp___iob_func'
/mingw64/lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld: code/libcurl/windows/mingw/lib64/libcurl.a(url.o):(.text+0x3fbc): undefined reference to `__imp___iob_func'
/mingw64/lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld: code/libcurl/windows/mingw/lib64/libcurl.a(formdata.o):(.text+0x1093): undefined reference to `__imp___iob_func'
/mingw64/lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld: code/libcurl/windows/mingw/lib64/libcurl.a(formdata.o):(.text+0x12c9): more undefined references to `__imp___iob_func' follow
collect2: error: ld returned 1 exit status

Interestingly, that old version of curl used in q3e, as well as latest both build fine under the same cross compiler. Thanks for your time!

rorgoroth avatar Nov 29 '21 13:11 rorgoroth

You may need to update the curl libs used as the ones included are compiled by certain versions of runtime?

Aka it must also be changed to use ucrt

ensiform avatar Nov 29 '21 14:11 ensiform

I assume I need to build them with vs? I tried quickly copying the libs (and later, headers) from my mingw prefix but that caused further breakage 🥴

-------- Original Message -------- On 29 Nov 2021, 14:47, Ensiform wrote:

You would need to update the curl libs used as the ones included are compiled by certain versions of msvc

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android.

rorgoroth avatar Nov 29 '21 14:11 rorgoroth

Okay, I've made some progress and managed to hack it up enough to build and run.

I've:

  • updated all the curl includes to 7.80.0
  • updated libcurl.a
  • added libz.a
  • Updated makefile:
--- a/Makefile
+++ b/Makefile
@@ -387,7 +387,7 @@ ifdef MINGW
     else
       CLIENT_LDFLAGS += -L$(MOUNT_DIR)/libcurl/windows/mingw/lib64
     endif
-    CLIENT_LDFLAGS += -lcurl -lwldap32 -lcrypt32
+    CLIENT_LDFLAGS += -lcurl -lwldap32 -lcrypt32 -lz
   endif

   DEBUG_CFLAGS = $(BASE_CFLAGS) -DDEBUG -D_DEBUG -g -O0

It seems to function as expected, it downloads files fine.

rorgoroth avatar Nov 29 '21 17:11 rorgoroth

Okay one last update, I did a more proper solution: https://github.com/rorgoroth/quake3e/commits/master

I keep the original curl version, removed the zlib dep and add makefile option for mingw with ucrt. If you are interested, you can take it. If not, that's okay too. Feel free to close this now if you wish.

rorgoroth avatar Dec 02 '21 15:12 rorgoroth