taviso/ctypes.sh

Support for musl libc?

Closed this issue · 4 comments

Would you consider support for musl libc? (or be open to PRs that added support for it?)

(I actually love using ctypes.sh - it's.. actually really good.)

What doesn't work with musl libc?

Would be more than happy to get PRs, or help fix whatever is broken.

Here are some of the things currently preventing compiling against musl.

Location Issue
static __always_inline int fls(int x)
no __always_inline in musl (could use __attribute__ ((__always_inline__))?)
static __always_inline int fls64(uint64_t x)
"
static __always_inline unsigned long __fls(unsigned long word)
"
static __always_inline int fls64(uint64_t x)
"
#if __WORDSIZE == 32
#define GOLDEN_RATIO_PRIME GOLDEN_RATIO_PRIME_32
#define hash_long(val, bits) hash_32(val, bits)
#elif __WORDSIZE == 64
#define hash_long(val, bits) hash_64(val, bits)
#define GOLDEN_RATIO_PRIME GOLDEN_RATIO_PRIME_64
#else
#error Wordsize not 32 or 64
#endif
no __WORDSIZE in musl
long sys_cacheline_size = sysconf(_SC_LEVEL1_DCACHE_LINESIZE);
no _SC_LEVEL1_DCACHE_LINESIZE in musl

I could start to take a stab at some of these, make a preliminary PR? I'm sure I'm gonna end up taking you up on that offer for help at some point along the way here.. :)

Closed via 6982e6c :)