lichray / nvi2

A multibyte fork of the nvi editor for BSD
Other
144 stars 34 forks source link

Fix missing waddnwstr() definition on macOS and FreeBSD #99

Closed arichardson closed 3 years ago

arichardson commented 3 years ago

The macro _XOPEN_SOURCE_EXTENDED is needed to get the waddnwstr() definition on at least FreeBSD and recent macOS. This causes -Werror build failures due to -Wimplicit-function-declaration.

lichray commented 3 years ago

Which macOS version, Big Sur?

arichardson commented 3 years ago

Yes this appears to be needed on both macOS Big Sur and FreeBSD 12.2.

zhihaoy commented 3 years ago

Yes this appears to be needed on both macOS Big Sur and FreeBSD 12.2.

Confirmed. Please apply this change instead:

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 66d3ca2..4679463 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -148,6 +148,7 @@ if(USE_WIDECHAR)
     target_sources(regex PRIVATE ${REGEX_SRCS})
     target_include_directories(regex PUBLIC regex)
     target_compile_definitions(regex PUBLIC __REGEX_PRIVATE)
+    target_compile_definitions(nvi PRIVATE _XOPEN_SOURCE_EXTENDED)
     target_link_libraries(nvi PRIVATE regex)
 else()
     find_library(CURSES_LIBRARY NAMES ncurses curses HINTS /usr/lib)

Also, please consider changing the commit title and issue title to something more specific. A hundred issues can be titled "Fix macOS and FreeBSD build."

arichardson commented 3 years ago

Updated to scope the define to nvi only.

lichray commented 3 years ago

Thanks.