[MUSL] Consider removing linux/prctl.h from /klippy/chelper/pyhelper.c

The commit c78dd6a00a7434e0a235d4b722f4cac3b41884da (5 days ago, at the writing of this post) added prctl to /klippy/chelper/pyhelper.c

While MUSL supports sys/prctl.h just fine, for linux/prctl.h there are some conflicts that started happening with newer Linux kernel headers.

...
In file included from /home/klipper/klipper/klippy/chelper/pyhelper.c:13:
Aug 07 03:31:56 samsung-a3 python[3556]: /usr/include/linux/prctl.h:134:8: note: originally defined here
Aug 07 03:31:56 samsung-a3 python[3556]:   134 | struct prctl_mm_map {
Aug 07 03:31:56 samsung-a3 python[3556]:       |        ^~~~~~~~~~~~
...

Thus, this won’t compile on MUSL-based systems.

Please consider removing linux/prctl.h, and just leaving sys/prctl.h

1 Like

Interesting.
I’m able to reproduce it with the Alpine.

Probably it is safe to remove, because at least in my system sys/prctl.h, do internally includes the linux/prctl.h.


Welcome TheRealOne78,

Which headers? Can you explain for stupid people like me?

Hi, sorry for replying so late.

By the linux headers I meant linux/prctl.h which comes from linux-headers, and sys/prctl.h and which comes from musl libc.

Since both the linux header file and the musl file include the prctl_mm_map struct, there’s a conflict.

glibc includes linux/prctl.h, but musl libc implements this struct by itself.

Thus, if you include both the musl version of sys/prctl.h and linux/prctl.h, this struct will be defined twice.

It’s safe to include both sys/prctl.h and linux/prctl.h only if you’re using glibc, since here sys/prctl.h includes linux/prctl.h and linux/prctl.h has a #ifndef include guard.

Also, not a big fan of musl either, it’s just that I’m trying klipper on a phone with postMarketOS, but pmOS is based on Alpine, which is musl based.