dankamongmen / growlight

notcurses block device manager / system installation tool
https://nick-black.com/dankwiki/index.php/Growlight
GNU General Public License v3.0
85 stars 12 forks source link

build fails on musl #99

Closed dankamongmen closed 3 years ago

dankamongmen commented 3 years ago

Trying to build on Alpine Linux, we fail due to the following missing header:

/home/dank/growlight/src/growlight-1.2.16/src/growlight.c:31:10: fatal error: gnu/libc-version.h: No such file or directory
   31 | #include <gnu/libc-version.h>
      |          ^~~~~~~~~~~~~~~~~~~~
/home/dank/growlight/src/growlight-1.2.16/src/growlight.c:31:10: fatal error: gnu/libc-version.h: No such file or directory
   31 | #include <gnu/libc-version.h>
      |          ^~~~~~~~~~~~~~~~~~~~

This is a Glibc-specific header. Try and get rid of this dep -- is it truly necessary?

dankamongmen commented 3 years ago

PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP isn't supported on musl, alas.

dankamongmen commented 3 years ago

It looks like musl does have PTHREAD_MUTEX_RECURSIVE (as an enum), suitable for use with a pthread_mutexattr_t, and that Glibc also provides this identifier. So let's get rid of PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP and do it the long way.

dankamongmen commented 3 years ago

recursive_lock_init() has been added, and does this portably (i think).

dankamongmen commented 3 years ago

tested; we now build on alpine