lucianpls / libicd

image codec library

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

macOS support

adamjstewart opened this issue · comments

Are there plans to add macOS support? I tried building naively but hit:

src/icd_codecs.h:108:10: fatal error: 'endian.h' file not found
#include <endian.h>
         ^~~~~~~~~~

I was able to solve this with:

diff --git a/src/icd_codecs.h b/src/icd_codecs.h
index 0859328..f235ba9 100644
--- a/src/icd_codecs.h
+++ b/src/icd_codecs.h
@@ -103,8 +103,12 @@
 #define le64toh(X) (X)
 #define htole64(X) (X)
 
+#elif defined(__APPLE__) && defined(__MACH__)
+
+#include <machine/endian.h>
+
 #else
-// Assume linux
+
 #include <endian.h>
 
 #endif

However, I hit a new error:

src/PNG_codec.cpp:82:12: error: use of undeclared identifier 'be32toh'
    return be32toh(result);
           ^

I'm not super familiar with C++, I mostly do Python, so I'm probably not the best person to work on this. But happy to test out any patches!

@adamjstewart
I never use the macOS, I'll give it a try and let you know.

Works great, thanks so much!

@adamjstewart
Note that libicd is only required for the QB3 test. The QB3/libQB3 is all that is needed to build and install the libQB3 itself.

I seem to recall CMake complaining when it couldn't find libicd. Is there a way to explicitly enable/disable tests to avoid this?

Also, would you be willing to help maintain any of these build recipes in Spack? You don't need to be a Spack expert, it just gives us someone to help debug build issues or review PRs to add new versions, etc. For any Spack-specific syntax questions, I can handle that.