Bring several fixes for broader musl compatibility - #793
Conversation
- Introduced `--disable-werror` option to control the use of -Werror during compilation - Default behavior remains to enable -Werror for stricter error checking - This change allows users to disable -Werror if they prefer to compile with warnings Authored-by: Natanael Copa <ncopa@alpinelinux.org>
Use __GLIBC__ when testing for GNU libc specific things instead of assuming that __linux__ is GNU libc. This is needed for building with musl libc. Authored-by: Natanael Copa <ncopa@alpinelinux.org>
Use the configure script to test for struct time spec instead of trying to keep track of what platforms has it. Authored-by: Natanael Copa <ncopa@alpinelinux.org>
The ALLPERMS and ACCESSPERMS defines are not specified in POSIX so assume it is not there instead of testing for specific implementations. This is needed for musl libc. Authored-by: Natanael Copa <ncopa@alpinelinux.org>
Test for various functions instead of trying to keep track of what platform and what version of the given platform has support for what. This should make it easier to port to currently unknown platforms and will solve the issue if a platform add support for a missing feature in the future. The features we test for are: - getifaddrs - getauxval - issetugid - __secure_getenv This is needed for musl libc. Authored-by: Natanael Copa <ncopa@alpinelinux.org>
This is needed for musl libc. Authored-by: Natanael Copa <ncopa@alpinelinux.org>
This is needed for musl libc. Authored-by: Natanael Copa <ncopa@alpinelinux.org>
- Added <stdio.h> to errPosix.c to ensure proper error handling functionality
- Changed the error handling mechanism to use strerror_r only for non-GLIBC systems - This ensures compatibility with platforms that do not support GLIBC, improving portability
- Undefine g_free to provide a stub symbol for GLib versions >= 2.78 - This change ensures compatibility with fortify macros in newer GLib versions
- Introduced `resolv_compat.h` to provide GLIBC-like functionality for `res_ninit()` and `res_nclose()` when using musl libc. - Updated `nicInfoPosix.c` to include this compatibility header conditionally based on the libc being used.
|
Thanks for reporting. I have filed an internal PR for this, and will see where it goes. |
|
Hey @steve-goddard-brcm is there any update on this? Any changes needed or any idea if this can be merged at some point? Thanks! |
🛑 Legal Compliance Check FailedHi @Itxaka, thank you for your contribution! To merge this Pull Request, you must sign our CLA. Note: Even if you signed off your commits locally (using 1. Read the Document: Click here to read the CLA ⏳ Processing Schedule: |
Currently, open-vm-tools cannot be built under musl without carrying a number of small compatibility patches. Several downstream projects already maintain patches for this, which suggests there is existing interest in making musl builds work out of the box.
In particular, Alpine has done a lot of work in this area, especially @ncopa, who put together and maintained fixes for many of the compatibility issues. There was also an earlier PR for this work: #557. Unfortunately, that PR did not get merged and is now quite outdated.
Rather than having downstreams continue to carry separate patch sets, I think it would be valuable to bring this work upstream and make open-vm-tools build cleanly under musl by default. This would improve the developer and user experience for musl-based distributions and make the maintenance burden smaller for everyone involved.
Given that musl-based environments are still actively used and supported by distributions such as Alpine, it would be great to make this a first-class upstream-supported build target instead of requiring downstream patch stacks.
Open to changes, redoing and resend of this patches. Let me know and I am willing to rework any part of this PR, send in smaller batches and whatnot so we can get this in :D