-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
psutil fails to compile against MUSL C library #872
Comments
What's MUSL? On Aug 18, 2016 12:37 PM, "Yegor Yefremov" [email protected] wrote:
|
@giampaolo MUSL is a new C library, that tries to strictly follow the standards (POSIX etc.). These rules often lead to compilation issues, when non-stadard headers will be included etc. MUSL is for example quasi standard C library for OpenWrt/LEDE projects. In the case of psutil, there is glibc leftover issue with struct sysinfo. It is defined in linux/sysinfo.h and in sys/sysinfo.h. OpenWrt project provides following patch for the kernel header, but this is not applicable for psutil of course. If I remove #include <sys/sysinfo.h> from psutil/_psutil_linux.c I can compile the package, but I also get following warning: psutil/_psutil_linux.c: In function ‘psutil_linux_sysinfo’: So I don't know, if it is a proper solution. |
Here's my output on Alpine Linux, using MUSL
|
bump getting the same issue with Alpine linux:3.4. |
Please provide instructions on how to build/compile psutil by using MUSL on Linux (I'm on Ubuntu). |
I have a solution to the problem for Alpine linux. I can't be more specific with the MUSL portion outside of that. i'd already entered apk add --upgrade py-pip and psuti, so they may be needed as well. |
The easiest way to reproduce the issue would be to use Buildroot:
|
How about this? |
That's what I mention above. Installing linux-headers in alpine fixed it for me. |
Oh sorry, I missed that. Closing this out then. |
@giampaolo have you tried to build psutil in Buildroot following the steps I've provided? The issue with musl is still there. @DamionWaltermeyer and @ConorIA had unrelated issue, because kernel headers were missing. |
Suppress inclusion of linux/sysinfo.h to fix redefinition of struct sysinfo that musl libc defines in sys/sysinfo.h, which least to the following build failure (paths abbreviated): In file included from .../usr/include/linux/kernel.h:4:0, from .../usr/include/linux/ethtool.h:16, from psutil/_psutil_linux.c:35: .../usr/include/linux/sysinfo.h:7:8: error: redefinition of ‘struct sysinfo’ struct sysinfo { ^ In file included from psutil/_psutil_linux.c:21:0: .../usr/include/sys/sysinfo.h:10:8: note: originally defined here struct sysinfo { ^ Fixes giampaolo#872
This is required to build psutil. Without this patch, I get: psutil/_psutil_posix.c:29:29: fatal error: linux/types.h: No such file or directory After this patch, 'docker build' completes successfully. See also: giampaolo/psutil#872
Thank you so much for sharing. |
Following error occurs, when compiling psutil against MUSL. Any idea?
The text was updated successfully, but these errors were encountered: