Review Request 127415: Set the appropriate feature test macro definitions to enable building on musl libc

Wiktor W Brodlo wiktor at brodlo.net
Sun Mar 20 15:08:26 UTC 2016


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/127415/
-----------------------------------------------------------

(Updated March 20, 2016, 3:08 p.m.)


Status
------

This change has been marked as submitted.


Review request for KDE Frameworks.


Repository: kdesu


Description
-------

The file kdesu_stub.c calls the following functions: putenv, unsetenv, initgroups, mkstemp, popen, pclose. Looking at the man pages, this set requires the _XOPEN_SOURCE and _BSD_SOURCE feature test macros to be defined. This patch passes these definitions to the compiler. This enables kdesu to be built against the musl libc, which is very strict about these things.


Diffs
-----

  src/CMakeLists.txt 73ff883 

Diff: https://git.reviewboard.kde.org/r/127415/diff/


Testing
-------

Without the patch, the build fails as follows:

```
src/kdesu_stub.c: In function ‘xsetenv’:
src/kdesu_stub.c:136:5: error: implicit declaration of function ‘putenv’ [-Werror=implicit-function-declaration]
     return putenv(s); /* yes: no free()! */
     ^
src/kdesu_stub.c: In function ‘main’:
src/kdesu_stub.c:258:9: error: implicit declaration of function ‘unsetenv’ [-Werror=implicit-function-declaration]
         unsetenv("LC_ALL");
         ^
src/kdesu_stub.c:301:9: error: implicit declaration of function ‘initgroups’ [-Werror=implicit-function-declaration]
         if (initgroups(pw->pw_name, pw->pw_gid) == -1) {
         ^
src/kdesu_stub.c:331:13: error: implicit declaration of function ‘mkstemp’ [-Werror=implicit-function-declaration]
             fd2 = mkstemp(xauthority);
             ^
src/kdesu_stub.c:342:13: error: implicit declaration of function ‘popen’ [-Werror=implicit-function-declaration]
             fout = popen("xauth >/dev/null 2>&1", "w");
             ^
src/kdesu_stub.c:342:18: warning: assignment makes pointer from integer without a cast
             fout = popen("xauth >/dev/null 2>&1", "w");
                  ^
src/kdesu_stub.c:348:13: error: implicit declaration of function ‘pclose’ [-Werror=implicit-function-declaration]
             pclose(fout);
             ^
```

With the patch, the build passes and kdesu works.


Thanks,

Wiktor W Brodlo

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20160320/5991f1b2/attachment.html>


More information about the Kde-frameworks-devel mailing list