I'm trying to compile a program using both curses and menu on Cion on MacOS Ventura.
I use this simple code as test
#include <menu.h>
#include <stdio.h>
#include <stdlib.h>
int cols, lines;
int main(int argc, char *argv[]) {
initscr();
getmaxyx(stdsrc, lines, cols);
noecho();
nocbreak();
keypad(stdscr, TRUE);
MENU* my_test_menu = new_menu(NULL);
getch();
exit(EXIT_SUCCESS);
}
When compiling using the following CMake configuration
...
find_package(Curses REQUIRED)
include_directories(${CURSES_INCLUDE_DIR})
...
target_link_libraries(my_projet PRIVATE menu ${CURSES_LIBRARY})
I got the following error from the linker :
Undefined symbol for architecture arm64 :
"_new_menu" referenced from my_file.cpp
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1
I have tested that build configuration on ubuntu AMD64 without any issue.
Solution using brew
and MacPort
like this one doesn't interest me because I would have to manually point CMake to the include
dir in my CMake setup, preventing the build from being "universal".
Also, after further testing curses panel and form work perfectly when included. So, I'm begun to suspect an issue with MacOS menu.
My point is also why would the system include the header file and not the actual library, which seems pretty mind blowing.
Hope someone have a solution or at least an explanation and have a nice day.