'make -C mail/neomutt build' fails with an undefined symbol [[1]] in the ncurses port is installed on FreeBSD 12.4. This is a new change between neomutt-20230407 and neomutt-20230512. The key is this addition: --- work/neomutt-20230407/gui/mutt_curses.h 2023-04-07 08:00:22.000000000 -0600 +++ work/neomutt-20230512/gui/mutt_curses.h 2023-05-12 05:31:15.000000000 -0600 @@ -37,6 +37,12 @@ #include <curses.h> #endif +#if (((NCURSES_VERSION_MAJOR > 6) || \ + ((NCURSES_VERSION_MAJOR == 6) && (NCURSES_VERSION_MINOR >= 1))) && \ + defined(NCURSES_EXT_COLORS)) +#define NEOMUTT_DIRECT_COLORS +#endif + If it detects ncurses 6.x it uses "direct colors" which now calls init_extended_pair() as of neomut-20230512. That function is not in ncurses 5 which is the base ncurses library in 12.4 Here is what's happening - the build uses the ncurses header file from ports (in /usr/local/include) but links with the ncurses lib from base (in /usr/lib). 13.2 has ncurses 6 in /usr/lib and has the missing symbol from ncurses 5, so it does not have this failure. However, it is still including the header from /usr/local and linking with the library in /usr/lib. It's just luck if it does not fail to compile with headers from /usr/local and link with the lib from /usr/lib. There could be failures at run time if it DOES build and potential build failures as the ports and base ncurses diverge in the future. [[1]] linker error: cc -o neomutt alternates.o commands.o conststrings.o copy.o editmsg.o enriched.o external.o flags.o functions.o git_ver.o globals.o handler.o hdrline.o help.o hook.o init.o keymap.o mailcap.o maillist.o main.o muttlib.o mutt_account.o mutt_body.o mutt_config.o mutt_header.o mutt_history.o mutt_logging.o mutt_mailbox.o mutt_signal.o mutt_socket.o mutt_thread.o mview.o mx.o opcodes.o recvcmd.o resize.o rfc3676.o score.o sort.o status.o subjectrx.o system.o version.o libindex.a libpager.a libpop.a libbrowser.a libcompmbox.a libstore.a libprogress.a libquestion.a libpostpone.a libalias.a libsend.a libconvert.a libcompose.a libattach.a libgui.a libenter.a libcomplete.a libnntp.a libpattern.a libmenu.a libcolor.a libenvelope.a libhelpbar.a libmbox.a libnotmuch.a libmaildir.a libncrypt.a libimap.a libconn.a libhcache.a libsidebar.a libbcache.a libhistory.a libcore.a libparse.a libconfig.a libemail.a libaddress.a libmutt.a -Wl,-rpath,/usr/local/lib:/usr/local/lib -Wl,-rpath=/usr/local/lib -fstack-protector-strong -L/usr/local/lib -L/usr/local/lib -L/usr/local/lib -L/usr/local/lib -L/usr/local/lib -L/usr/local/lib -Wl,-rpath,/usr/local/lib:/usr/lib -Wl,-rpath,/usr/local/lib -L/usr/local/lib -fstack-protector-strong -lgssapi_krb5 -lkrb5 -lk5crypto -lcom_err -lz -ltinfow -lnotmuch -L/usr/local/lib -lgpgme -lgpg-error -lsasl2 -lintl -liconv -lssl -lcrypto -lidn2 -lpcre2-8 -llmdb -ltokyocabinet -lbz2 -lz -lrt -lpthread -lm -lc ld: error: undefined symbol: init_extended_pair >>> referenced by curses.c >>> curses.o:(curses_color_new) in archive libcolor.a cc: error: linker command failed with exit code 1 (use -v to see invocation) *** Error code 1 Note: In the cases where the link succeeds (e.g., on 12.x without the ncurses port installed or on 13.x), the linker line does not reference libncurses (or libncursesw), and yet the neomutt binary is dynamically linked with libncursesw.so. So it's getting pulled into the linked binary implicitly somewhere.
Created attachment 242221 [details] [patch] explicitly specify ncurses libs for neomutt tldr; This patch explicitly specifies ncurses includes & libs Instead of using -lncurses or -lncursesw, it might be better to explicitly link with the pathname (e.g., /lib/libncurses.so). It's hard to use -lfoo and get it to link to the right ncurses library because the -L flags that are pulled in. It helps that base and ports libs are named different (currently) - base has libncursesw and ports has libncurses. But there's no guarantee of that in the future. The attached patch does not try to solve the problem with base and ports have the same lib name (where -lncurses may lead to the wrong library getting linked in). If that ever happens perhaps Uses/ncurses.mk should use absolute paths instead of -lfoo. In any case, it was missing that the ncurses lib was mentioned in the link command at all. The attached patch adds the desired lib (via NCURSESLIBS) in the link flags explicitly. Also --with-ncurses is used during configure to get the configure/build to explicitly use the right headers. With the way the current Mk/Uses/ncurses.mk works, that fixes the problem currently in 12.x where the configure/build detects one flavor of ncurses to compile with and uses another at link time. And it makes builds on all releases more explicit regarding which ncurses to use during configure, compile, and link. It is an option to specify USES=ncurses:port. That's not necessarily required to fix the build failure. That could be considered as well, but the patch does not include that. I did not bump PORTREVISION, but it could be argued that this change might change the package in environments where the ncurses port is installed (including bulk poudriere builds where ncurses is built & installed before neomutt is built). I believe it will not matter for the FreeBSD package builder as neomutt is built in a fully clean environment (and so the ncurses port would not be installed). Bump PORTREVISION out of caution if you like.
Created attachment 242222 [details] [patch] explicitly specify ncurses libs for neomutt - and other updates (v2) Here's another patch with a few other changes while I'm here. These changes are not related to the ncurses build failure at all. - remove MAKE_JOBS_UNSAFE (builds fine with -j4) - remove USES=localbase (not needed - tested with many options combinations) - add IDN_CONFIGURE_OFF=--disable-idn2 If the idn2 port is not installed, you get the following error during 'configure' even if IDN=off: Checking for libidn2 ...not found Error: libidn2 None of these changes require a PORTREVISION bump.
Comment on attachment 242222 [details] [patch] explicitly specify ncurses libs for neomutt - and other updates (v2) Choose either the minimal patch to fix the bug or this one with a few other updates.
Created attachment 246039 [details] [patch] explicity specify ncurses libs, disable idn if IDN is off (v3) (In reply to John Hein from comment #2) v3: same as v2, except: - only need to link with -lncurses (-ltinfo not needed) - remove old NCURSES option from OPTIONS_DEFAULT (NCURSES option removed years ago) - remove old SCREEN_DESC, no longer used (removed years ago) Maintainer timeout. The build still fails as reported originally.
FreeBSD 12 is EOLed now