Created attachment 176954 [details] build log If ncurses from ports installed, cmus trying to linked against them but compile failed. 1. Configure script detect that strndup function is supported by system. 2. Ncurses cflags: -D_BSD_TYPES -D__BSD_VISIBLE -D_POSIX_C_SOURCE=200112L -D_XOPEN_SOURCE=600 -I/usr/local/include/ncurses/ncurses passed to cmus build flags. 3. Redefine _POSIX_C_SOURCE as 200112 hiding strndup function in string.h 102 #if __POSIX_VISIBLE >= 200809 103 char *strndup(const char *, size_t) __malloc_like; 104 size_t strnlen(const char *, size_t) __pure; 105 #endif 4. Compile failed error: implicitly declaring library function 'strndup' with type 'char *(const char *, unsigned long)'
Created attachment 176956 [details] cmus.diff Interesting, thank you for the detailed report. The attached patch should allow you to build cmus. Though I'm not sure how to fix this in a proper way. I also found that cmus tries to use git during the build when it's installed... The patch should prevent this too.
Thanks! I build cmus by commenting line 515 in configure script #check_string_function "strndup" && HAVE_STRNDUP=y then cmus using own replacement of strndup function.
Anyway, I think this must be fixed in ncurses port by removing -D_POSIX_C_SOURCE=200112L flag. Or, maybe, replace them by -D_POSIX_C_SOURCE=200809L Interesting, in revision prior 265878 https://svnweb.freebsd.org/base?view=revision&revision=265878 define __BSD_VISIBLE in cflags working fine.
(In reply to Oleg Gushchenkov from comment #3) Yes, I think you're right. I've asked on the ports mailing list.
Comment on attachment 176956 [details] cmus.diff The update to cmus 2.8.0-rc0 in bug #216325 should fix this problem.
A commit references this bug: Author: tobik Date: Mon Apr 10 13:25:24 UTC 2017 New revision: 438165 URL: https://svnweb.freebsd.org/changeset/ports/438165 Log: Update to 2.8.0-rc0 - Fix build with devel/ncurses installed [1], which erroneously redefines _POSIX_C_SOURCE as 200112L globally via its pkg-config file and hides strndup from cmus. A workaround for this was applied to cmus in DPorts commit d2907fe but it never made it back to FreeBSD. Changes: https://github.com/cmus/cmus/releases/tag/v2.8.0-rc0 PR: 216325, 214475 [1] Reported by: Oleg Gushchenkov <gor@clogic.com.ua> [1] Approved by: mat (mentor) Differential Revision: https://reviews.freebsd.org/D10242 Changes: head/audio/cmus/Makefile head/audio/cmus/distinfo head/audio/cmus/files/patch-Makefile head/audio/cmus/files/patch-configure head/audio/cmus/files/patch-ffmpeg.c head/audio/cmus/files/patch-ip_mp4.c head/audio/cmus/files/patch-mp4.c head/audio/cmus/files/patch-sndio.c head/audio/cmus/pkg-plist