treeform / puppy

Puppy fetches via HTTP and HTTPS
MIT License
184 stars 27 forks source link

Zippy dependency breaks builds on ancient EOL platforms (CentOS 6) #102

Closed jrfondren closed 11 months ago

jrfondren commented 11 months ago

Due to CentOS 6 dependencies, I'm cross-compiling an application with zig, targeting x86_64-linux-gnu.2.12. Zippy breaks this with errors like

.nimble@spkgs@szippy-0.10.10@szippy@scrc32_simd.nim.c:277:7: error: '__builtin_ia32_pclmulqdq128' needs target feature pclmul
        x1 = _mm_clmulepi64_si128(x1, x0, ((NI) 0));

Since I happen to not need uncompress(), I just removed the dependency from a copy of puppy:

--- ../puppy/src/puppy/platforms/linux/platform.nim 2023-07-20 21:17:03
+++ puppy-2.0.3/platform.nim    2023-07-20 21:11:40
@@ -1,4 +1,4 @@
-import libcurl, puppy/common, std/strutils, zippy
+import libcurl, puppy/common, std/strutils

 block:
   ## If you did not already call curl_global_init then
@@ -108,10 +108,7 @@

       result.body = bodyWrap.str
       if result.headers["Content-Encoding"] == "gzip":
-        try:
-          result.body = uncompress(result.body, dfGzip)
-        except ZippyError as e:
-          raise newException(PuppyError, "Error uncompressing response", e)
+        raise newException(PuppyError, "Error uncompressing response")
     else:
       raise newException(PuppyError, $easy_strerror(ret))
   finally:

And otherwise, puppy seems to work just fine.

guzba commented 11 months ago

The issue is related to SIMD intrinsics. It is possible passing -d:zippyNoSimd to the Nim compiler will also work without needing to make any changes but I cannot be sure of that.

jrfondren commented 11 months ago

Great, that flag does work as well.