curl / curl-for-win

Reproducible curl binaries for Linux, macOS and Windows
https://curl.se/windows/
MIT License
686 stars 207 forks source link

Unable to build at Debian 12 with LLVM #75

Closed killerbees19 closed 1 month ago

killerbees19 commented 1 month ago

Building at Debian 12 doesn't work anymore. Something changed between v8.4.0 (f55f424e030afa529c94bc3e8da31e27725fedb8) and v8.9.1 (ab833ee2e6e992182635d424d3e4a563139b1303).

Debian 13 (Testing)

Debian 12 (Stable)

+ [ llvm = llvm ]
+ llvm-readelf --coff-exports _x86-win-ucrt/usr/bin/libcurl.dll
+ grep -a -F Name: 
+ grep -a -F -v  curl_
  Name: 
+ false
Command exited with non-zero status 1

Differences

llvm-readelf outputs a nameless block at Debian Stable. This was already the case in the past, but the build process still succeeded.

--- stable.txt
+++ testing.txt
 Format: COFF-i386
 Arch: i386
 AddressSize: 32bit
-Export {
-  Ordinal: 0
-  Name: 
-  RVA: 0x0
-}
 Export {
   Ordinal: 1
   Name: curl_easy_cleanup

Workaround

Commit 3b9fb4737e6e2a01488b677bb1a1b685826574ff added an additional check, that fails at Debian Stable.

I don't know if ignoring these "empty" blocks could do any harm. But this is my personal workaround for the time being:

--- a/_info-bin.sh
+++ b/_info-bin.sh
@@ -26,13 +26,13 @@ while [ -n "${1:-}" ]; do
     TZ=UTC "${_OBJDUMP}" --all-headers "${f}" | grep -a -E -i "(file format|DLL Name|Time/Date)" | sort -r -f
     if [ "${is_curl}" = '1' ]; then
       # Verify exported curl symbols
-      # = llvm-readobj --coff-exports | grep -a -F 'Name: ' | grep -a -F ' curl_'
+      # = llvm-readobj --coff-exports | grep -a -E 'Name: .+' | grep -a -F ' curl_'
       if [ "${filetype}" = 'exe' ]; then
         "${_OBJDUMP}" --all-headers "${f}" | grep -a -F ' curl_' && false  # should not have any hits for statically linked curl
       else
         "${_OBJDUMP}" --all-headers "${f}" | grep -a -F ' curl_' || false  # show public libcurl APIs (in a well-defined order)
         if [ "${_CC}" = 'llvm' ]; then
-          "${_READELF}" --coff-exports "${f}" | grep -a -F 'Name: ' | grep -a -F -v ' curl_' && false  # should not export anything else except the libcurl API
+          "${_READELF}" --coff-exports "${f}" | grep -a -E 'Name: .+' | grep -a -F -v ' curl_' && false  # should not export anything else except the libcurl API
         fi
       fi
     fi

Any ideas what's going wrong here or how to fix it properly? 😳

I've two throwaway VMs ready to test things out…

vszakats commented 1 month ago

Interesting, I'm not sure what's going on, but your patch looks sensible to avoid an issue like that whatever the root cause is.

vszakats commented 1 month ago

Thanks @killerbees19, merged!