Bug 365925 - KIO KPAC fails to build on musl libc: _BSD_SOURCE or _GNU_SOURCE needs to be defined
Summary: KIO KPAC fails to build on musl libc: _BSD_SOURCE or _GNU_SOURCE needs to be ...
Status: RESOLVED FIXED
Alias: None
Product: frameworks-kio
Classification: Frameworks and Libraries
Component: general (show other bugs)
Version: 5.24.0
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: David Faure
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-07-21 07:54 UTC by A. Wilcox (awilfox)
Modified: 2018-08-30 18:38 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In: 5.37.0
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description A. Wilcox (awilfox) 2016-07-21 07:54:27 UTC
The proxy autoconfiguration portion of KIO fails to build against the musl libc due to _BSD_SOURCE and _GNU_SOURCE both being undefined.  This causes the symbol 'setgroups' to be hidden as it is not specified in POSIX.1-2008.  It also causes NI_MAXHOST and IFF_LOOPBACK to be undefined.

I suggest adding a check for setgroups to ConfigureChecks.cmake in the kpac/ directory and defining _BSD_SOURCE if it is not available, but that is just a suggestion.  I am not sure the desired style in the KIO project.

Reproducible: Always

Steps to Reproduce:
1. Use musl libc.
2. Attempt to build KIO's proxy autoconfiguration support.

Actual Results:  
/usr/src/kde-frameworks/kio-5.21.0/work/kio-5.21.0/src/kpac/kpac_dhcp_helper.c: In function ‘set_gid’:
/usr/src/kde-frameworks/kio-5.21.0/work/kio-5.21.0/src/kpac/kpac_dhcp_helper.c:59:9: error: implicit declaration of function ‘setgroups’ [-Werror=implicit-function-declaration]
     if (setgroups(1, &gid) == -1) {
         ^
/usr/src/kde-frameworks/kio-5.21.0/work/kio-5.21.0/src/kpac/kpac_dhcp_helper.c: In function ‘send_request’:
/usr/src/kde-frameworks/kio-5.21.0/work/kio-5.21.0/src/kpac/kpac_dhcp_helper.c:173:19: error: ‘NI_MAXHOST’ undeclared (first use in this function)
     char hostname[NI_MAXHOST];
                   ^
/usr/src/kde-frameworks/kio-5.21.0/work/kio-5.21.0/src/kpac/kpac_dhcp_helper.c:173:19: note: each undeclared identifier is reported only once for each function it appears in
/usr/src/kde-frameworks/kio-5.21.0/work/kio-5.21.0/src/kpac/kpac_dhcp_helper.c:186:30: error: ‘IFF_LOOPBACK’ undeclared (first use in this function)
         if (ifa->ifa_flags & IFF_LOOPBACK) {
                              ^

Expected Results:  
Successful build.
Comment 1 Nate Graham 2018-08-22 20:14:42 UTC
Is this still an issue with KDE Frameworks 5.49?