Package Details: mingw-w64-curl 8.8.0-1

Git Clone URL: https://aur.archlinux.org/mingw-w64-curl.git (read-only, click to copy)
Package Base: mingw-w64-curl
Description: An URL retrival utility and library (mingw-w64)
Upstream URL: https://curl.haxx.se
Licenses: MIT
Submitter: Schala
Maintainer: drakkan
Last Packager: drakkan
Votes: 12
Popularity: 0.000000
First Submitted: 2012-08-12 07:46 (UTC)
Last Updated: 2024-06-22 14:24 (UTC)

Latest Comments

1 2 3 Next › Last »

drakkan commented on 2024-06-22 14:23 (UTC) (edited on 2024-06-22 14:25 (UTC) by drakkan)

@maksverver I build in a chroot but it is not clean, wine is installed and I cannot reproduce the reported issue.

pacman -Q | grep wine
mingw-w64-wine 1-9
wine 9.11-1

Please compare your configure output with mine

@MoSal, removed static build patches, they were very old, maybe they are not needed anymore

MoSal commented on 2024-06-20 20:23 (UTC) (edited on 2024-06-20 20:24 (UTC) by MoSal)

From 0004-more-static-fixes.patch:

diff -urN curl-7.84.0/configure.ac.orig curl-7.84.0/configure.ac
--- curl-7.84.0/configure.ac.orig   2022-06-30 18:13:08.954675200 +0200
+++ curl-7.84.0/configure.ac    2022-06-30 18:18:29.024823500 +0200
@@ -1914,7 +1914,7 @@

 dnl link required libraries for USE_WIN32_CRYPTO or USE_SCHANNEL
 if test "x$USE_WIN32_CRYPTO" = "x1" -o "x$USE_SCHANNEL" = "x1"; then
-  LIBS="-ladvapi32 -lcrypt32 $LIBS"
+  LIBS="-ladvapi32 -lcrypt32 -lbcrypt $LIBS"
 fi

 case "x$OPENSSL_ENABLED$GNUTLS_ENABLED$NSS_ENABLED$MBEDTLS_ENABLED$WOLFSSL_ENABLED$SCHANNEL_ENABLED$SECURETRANSPORT_ENABLED$BEARSSL_ENABLED$AMISSL_ENABLED$RUSTLS_ENABLED"

What is this supposed to fix? Because it breaks static builds for me (linking libcurl against other software). Removing that part of the patch fixes the build.

Building without libssh2, and starting with -lcurl, here is the broken vs. working param list (25 -ls vs 38 -ls)!

Broken

 '-lcurl',
 '-lnghttp2',
 '-lidn2',
 '-lpsl',
 '-lbcrypt',
 '-ladvapi32',
 '-lcrypt32',
 '-lbcrypt',
 '-lssl',
 '-lcrypto',
 '-lssl',
 '-lcrypto',
 '-lgdi32',
 '-lwldap32',
 '-lzstd',
 '-lzstd',
 '-lbrotlidec',
 '-lz',
 '-lws2_32',
 '-lidn2',
 '-liconv',
 '-lunistring',
 '-lbrotlidec',
 '-lbrotlicommon',
 '-lpthread',

Working

 '-lcurl',
 '-lnghttp2',
 '-lidn2',
 '-lpsl',
 '-lbcrypt',
 '-ladvapi32',
 '-lcrypt32',
 '-lssl',
 '-lcrypto',
 '-lgdi32',
 '-lwldap32',
 '-lzstd',
 '-lbrotlidec',
 '-lz',
 '-lws2_32',
 '-lnghttp2',
 '-lidn2',
 '-lpsl',
 '-lbcrypt',
 '-ladvapi32',
 '-lcrypt32',
 '-lssl',
 '-lcrypto',
 '-lssl',
 '-lcrypto',
 '-lgdi32',
 '-lwldap32',
 '-lzstd',
 '-lzstd',
 '-lbrotlidec',
 '-lz',
 '-lws2_32',
 '-lidn2',
 '-liconv',
 '-lunistring',
 '-lbrotlidec',
 '-lbrotlicommon',
 '-lpthread',

Error:

/usr/lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../x86_64-w64-mingw32/bin/ld: /usr/x86_64-w64-mingw32/lib/libcrypto.a(libdefault-lib-winstore_store.obj):(.text+0xb7): undefined reference to `__imp_CertFindCertificateInStore'
/usr/lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../x86_64-w64-mingw32/bin/ld: /usr/x86_64-w64-mingw32/lib/libcrypto.a(libdefault-lib-winstore_store.obj):(.text+0x5eb): undefined reference to `__imp_CertOpenSystemStoreW'
collect2: error: ld returned 1 exit status

maksverver commented on 2024-04-08 15:57 (UTC) (edited on 2024-04-08 15:58 (UTC) by maksverver)

I would recommend against modifying /etc/makepkg.conf or other global system files. Any hacks applied there are likely to cause problems when compiling other packages, and in ways that may be very difficult to detect. Since the bug is specific to this package, any fixes or workarounds should be made in this package or upstream, not in the global system configuration.

Digging a bit deeper, I found another fix that I think is even cleaner than setting WINEPATH:

--- PKGBUILD.orig   2024-04-08 17:34:27.924474576 +0200
+++ PKGBUILD    2024-04-08 17:33:41.717364277 +0200
@@ -38,6 +38,7 @@

 build() {
   cd "${srcdir}"/${pkgname#mingw-w64-}-${pkgver}
+  export CHOST=$(./config.guess)
   for _arch in ${_architectures}; do
     configure_args="--with-openssl --enable-ipv6 --with-libidn2 --with-libssh2 --without-ca-bundle --without-random --with-libpsl --with-brotli --with-zstd"
     mkdir -p build-${_arch}-static && pushd build-${_arch}-static

The reason this works is that i686-w64-mingw32-configure invokes the configure script like this:

${config_path}/configure \
  --host=i686-w64-mingw32 --target=i686-w64-mingw32 --build="$CHOST" \
  --prefix=/usr/i686-w64-mingw32 --libdir=/usr/i686-w64-mingw32/lib --includedir=/usr/i686-w64-mingw32/include \
  --enable-shared --enable-static "$@"

Normally, CHOST is empty, and when --build is empty, the curl configure script tries to guess whether it's cross-compiling as discussed before. But when --build is nonempty and different from --host, then the configure script decides, correctly, that it's cross-compiling and does not perform any runtime checks, which is what we want.

The advantage of this fix compared to setting WINEPATH just in case wine is installed, is that with this fix no runtime checks are performed, regardless of whether wine is installed or not, so the configure process works the same in the clean chroot as on a live system with wine installed.

Martchus commented on 2024-04-08 10:19 (UTC)

If you need to add such workaround then probably /etc/makepkg.conf (which actually can contain arbitrary variables) is the right place. Maybe it is also better to get rid of /usr/lib/binfmt.d/wine.conf which apparently is part of the regular wine package.

maksverver commented on 2024-04-04 17:01 (UTC) (edited on 2024-04-04 17:05 (UTC) by maksverver)

...which also suggests another workaround: sabotaging wine e.g. by running export WINEPREFIX=/nonexistent before makepkg will cause the build to behave the same as in the clean chroot. But good luck figuring that out from the error message alone!

maksverver commented on 2024-04-04 16:55 (UTC) (edited on 2024-04-04 17:03 (UTC) by maksverver)

@drakkan: I verified it does build in a clean chroot, and I also figured out why.

The configure script tries to detect if it's cross-compiling, by trying to build and run a trivial binary (search config.log for "checking whether we are cross compiling"). When wine isn't installed, this fails, so the configure script sets cross_compiling=yes, and skips further runtime checks, including the runtime check for getaddrinfo(): https://github.com/curl/curl/blob/cfc65fd1ee164113e4b342f2e57e36fdc07c87fd/m4/curl-functions.m4#L1770-L1810

So the build fails only if wine is already installed on the build host, which is unfortunate, because people interested in mingw packages are likely to have wine installed too.

drakkan commented on 2024-04-04 14:41 (UTC)

@frecco2, @maksverver can you replicate the reported issue in a clean chroot? The automatic build here worked and wine is not listed as dependency. Anyway I'll try to reproduce and apply the proposed fix or another one when I have some free time. Thank you

frecco2 commented on 2024-03-31 07:19 (UTC)

@maksverver, I had the same problem. Thanks for the patch!

maksverver commented on 2024-03-30 15:45 (UTC) (edited on 2024-03-30 15:47 (UTC) by maksverver)

The current version (8.7.1-1) fails to build for me.

The build fails with:

  CC       libcurl_la-altsvc.lo
In file included from ../../lib/altsvc.c:28:
../../lib/curl_setup.h:624:4: error: #error "Unexpected build: IPv6 is enabled but getaddrinfo was not found."
  624 | #  error "Unexpected build: IPv6 is enabled but getaddrinfo was not found."
      |    ^~~~~

But the root cause is that the configure test for getaddrinfo() has failed:

configure:38226: checking if getaddrinfo seems to work
configure:38346: sh ./run-compiler -o conftest.exe -D_FORTIFY_SOURCE=3 -D_GLIBCXX_ASSERTIONS -O2 -pipe -fno-plt -fexceptions --param=ssp-buffer-size=4 -Wformat -Werror=format-security -fcf-protection -Werror-implicit-function-declaration -Wno-system-headers -D_FORTIFY_SOURCE=3 -D_GLIBCXX_ASSERTIONS -I/usr/i686-w64-mingw32/include -Wl,-O1,--sort-common,--as-needed -fstack-protector  -L/usr/i686-w64-mingw32/lib conftest.c -lnghttp2 -lidn2 -lssh2 -lssh2 -lcrypt32 -lbcrypt -lws2_32 -lpsl -lbcrypt -ladvapi32 -lcrypt32 -lbcrypt -lssl -lcrypto -lssl -lcrypto -lgdi32 -lwldap32 -lzstd -lzstd -lbrotlidec -lbrotlidec -lz -lws2_32  >&5
configure:38346: $? = 0
configure:38346: ./conftest.exe
006c:err:ole:start_rpcss Failed to start RpcSs service
0024:err:module:import_dll Library libssp-0.dll (which is needed by L"Z:\\home\\maks\\build\\mingw-w64-curl.orig\\src\\curl-8.7.1\\build-i686-w64-mingw32-static\\conftest.exe") not found
0024:err:module:loader_init Importing dlls for L"Z:\\home\\maks\\build\\mingw-w64-curl.orig\\src\\curl-8.7.1\\build-i686-w64-mingw32-static\\conftest.exe" failed, status c0000135
configure:38346: $? = 53
configure: program exited with status 53

The problem is that -fstack-protector flag (which is added to LDFLAGS by /usr/bin/mingw-env) adds a dependency on libssp-0.dll, but that file exists under /usr/i686-w64-mingw32/bin/, NOT /usr/i686-w64-mingw32/lib/.

I was able to work around it by adding the binary directory to WINEPATH before running configure, like so:

--- PKGBUILD.orig   2024-03-30 15:43:29.066584869 +0100
+++ PKGBUILD    2024-03-30 16:22:18.173164563 +0100
@@ -39,16 +39,16 @@
 build() {
   cd "${srcdir}"/${pkgname#mingw-w64-}-${pkgver}
   for _arch in ${_architectures}; do
     configure_args="--with-openssl --enable-ipv6 --with-libidn2 --with-libssh2 --without-ca-bundle --without-random --with-libpsl --with-brotli --with-zstd"
     mkdir -p build-${_arch}-static && pushd build-${_arch}-static
-    ${_arch}-configure $configure_args \
+    WINEPATH=/usr/${_arch}/bin ${_arch}-configure $configure_args \
       --enable-static --disable-shared ..
     make
     popd
     mkdir -p build-${_arch} && pushd build-${_arch}
-    ${_arch}-configure $configure_args \
+    WINEPATH=/usr/${_arch}/bin ${_arch}-configure $configure_args \
       --disable-static --enable-shared ..
     make
     popd
   done
 }

Not sure if that's the correct way to fix it, but I thought I'd share it in case anyone else finds this useful.

Note that WINEPATH being unset is not a problem when running the final executable, because curl.exe gets installed in the bin/ directory that also contains libssp-0.dll, and Wine searches for libraries in the executable's directory by default.

xantares commented on 2023-03-23 09:14 (UTC)

could you bump the release number ? I found out it needs a rebuild after the libpsl update