Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 947171 - dev-libs/newt: fails to compile with musl /gcc14 - form.c:162:41: error: implicit declaration of function 'strncmp' [-Wimplicit-function-declaration]
Summary: dev-libs/newt: fails to compile with musl /gcc14 - form.c:162:41: error: imp...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Ben Kohler
URL:
Whiteboard:
Keywords: PullRequest
Depends on:
Blocks: c99-porting
  Show dependency tree
 
Reported: 2024-12-29 12:36 UTC by meartzheast877
Modified: 2025-01-12 13:00 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
The build log (build.log,8.21 KB, text/x-log)
2024-12-29 12:38 UTC, meartzheast877
Details
The output of emerge --info (info.log,5.93 KB, text/x-log)
2024-12-29 12:38 UTC, meartzheast877
Details

Note You need to log in before you can comment on or make changes to this bug.
Description meartzheast877 2024-12-29 12:36:21 UTC
The dev-libs/newt package cannot compile on musl systems, I encountered the error first in gcc 15, then I tried to test in gcc 14, the error kept appearing.

One of the errors is:
form.c:162:41: error: implicit declaration of function 'strncmp' [-Wimplicit-function-declaration]
  162 |   if ((term=(char *)getenv("TERM")) && !strncmp(term,"xterm",5))
      |                                         ^~~~~~~
form.c:29:1: note: include '<string.h>' or provide a declaration of 'strncmp'
   28 | #include "newt_pr.h"
  +++ |+#include <string.h>
   29 | 


Reproducible: Always

Steps to Reproduce:
1. Have a musl system
2. Try to compile newt
Actual Results:  
A compilation error appeared and did not allow the program to be installed correctly

Expected Results:  
It should have been compiled and installed successfully.
Comment 1 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2024-12-29 12:37:42 UTC
Please always include the full build.log and emerge --info.
Comment 2 meartzheast877 2024-12-29 12:38:02 UTC
Created attachment 915482 [details]
The build log
Comment 3 meartzheast877 2024-12-29 12:38:45 UTC
Created attachment 915484 [details]
The output of emerge --info
Comment 4 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2024-12-29 12:40:12 UTC
Note that the title (and tracker) should be c99, given you said it fails with 14.
Comment 5 Larry the Git Cow gentoo-dev 2025-01-12 13:00:38 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=51172d3b7b8c533c7a86a40604ff0363d9bbe752

commit 51172d3b7b8c533c7a86a40604ff0363d9bbe752
Author:     Solegaiter <meartzheast877@gmail.com>
AuthorDate: 2025-01-01 12:01:01 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2025-01-12 12:59:01 +0000

    dev-libs/newt: fix to use C99.
    
    This patch fixes 'error: implicit declaration of function 'strncmp'' which made it impossible to compile this program in modern versions of the C standard.
    
    Closes: https://bugs.gentoo.org/947171
    Signed-off-by: Solegaiter <meartzheast877@gmail.com>
    Closes: https://github.com/gentoo/gentoo/pull/39929
    Signed-off-by: Sam James <sam@gentoo.org>

 dev-libs/newt/files/newt-0.52.24-c99-fix.patch               | 12 ++++++++++++
 .../newt/{newt-0.52.24.ebuild => newt-0.52.24-r1.ebuild}     |  3 ++-
 2 files changed, 14 insertions(+), 1 deletion(-)