Created attachment 176954 [details]
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;
4. Compile failed
error: implicitly declaring library function 'strndup' with type 'char *(const char *, unsigned long)'
Created attachment 176956 [details]
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.
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
Or, maybe, replace them by
Interesting, in revision prior 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]
The update to cmus 2.8.0-rc0 in bug #216325 should fix this problem.
A commit references this bug:
Date: Mon Apr 10 13:25:24 UTC 2017
New revision: 438165
Update to 2.8.0-rc0
- Fix build with devel/ncurses installed , 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
PR: 216325, 214475 
Reported by: Oleg Gushchenkov <firstname.lastname@example.org> 
Approved by: mat (mentor)
Differential Revision: https://reviews.freebsd.org/D10242