I'm trying to build a universal/fat executable binary and I'm linking against ncurses. I'm using ncurses from homebrew because the built in one doesn't support wide characters.
The problem seems to be -L/path/to/arm/libs -L/path/to/intel/libs
never searches the intel libs because it finds the proper named lib in /path/to/arm/libs
. Then it complains about the architecture being wrong. It is wrong, but I want clang to keep looking in the other paths for the one that has the right name and architecture.
Is this possible? Do I have to use lipo or something else to build a fat lib from the separate arm and intel libs?
Here is my minimal app. It draws a border around your terminal window.
#define _XOPEN_SOURCE_EXTENDED
#include <ncursesw/curses.h>
#include <clocale>
int main(int argc, char* argv[]) {
setlocale(LC_ALL, "");
initscr();
raw();
noecho();
keypad(stdscr, true);
refresh();
wborder_set(stdscr, WACS_D_VLINE, WACS_D_VLINE, WACS_D_HLINE, WACS_D_HLINE,
WACS_D_ULCORNER, WACS_D_URCORNER, WACS_D_LLCORNER, WACS_D_LRCORNER);
getch();
endwin();
return 0;
}
Here are my build steps. I'm actually using a makefile but these lines are able to build non-fat apps if I only specify one arch and the matching lib path when linking.
clang++ -std=c++17 -Wall -fno-objc-arc -finput-charset=UTF-8 -I/opt/homebrew/opt/ncurses/include -arch arm64 -arch x86_64 -c -o main.o main.cpp
clang++ -L/opt/homebrew/opt/ncurses/lib -L/usr/local/homebrew/opt/ncurses/lib -lncurses -arch arm64 -arch x86_64 -o test main.o