When trying to build vim 8.2.2725 with a ports tree freshly checked out with git, I get a linking failure: link.sh: $LINK_AS_NEEDED set to 'yes': invoking linker directly. cc -fstack-protector-strong -L/usr/local/lib -Wl,--as-needed -o vim objects/arabic.o objects/arglist.o objects/autocmd.o objects/beval.o objects/buffer.o objects/change.o objects/blob.o objects/blowfish.o objects/cindent.o objects/clientserver.o objects/clipboard.o objects/cmdexpand.o objects/cmdhist.o objects/crypt.o objects/crypt_zip.o objects/debugger.o objects/dict.o objects/diff.o objects/digraph.o objects/drawline.o objects/drawscreen.o objects/edit.o objects/eval.o objects/evalbuffer.o objects/evalfunc.o objects/evalvars.o objects/evalwindow.o objects/ex_cmds.o objects/ex_cmds2.o objects/ex_docmd.o objects/ex_eval.o objects/ex_getln.o objects/fileio.o objects/filepath.o objects/findfile.o objects/fold.o objects/getchar.o objects/gui_xim.o objects/hardcopy.o objects/hashtab.o objects/help.o objects/highlight.o objects/if_cscope.o objects/if_xcmdsrv.o objects/indent.o objects/insexpand.o objects/list.o objects/locale.o objects/map.o objects/mark.o objects/match.o objects/mbyte.o objects/memline.o objects/menu.o objects/misc1.o objects/misc2.o objects/mouse.o objects/move.o objects/normal.o objects/ops.o objects/option.o objects/optionstr.o objects/os_unix.o objects/pathdef.o objects/popupmenu.o objects/popupwin.o objects/profiler.o objects/pty.o objects/quickfix.o objects/regexp.o objects/register.o objects/screen.o objects/scriptfile.o objects/search.o objects/session.o objects/sha256.o objects/sign.o objects/sound.o objects/spell.o objects/spellfile.o objects/spellsuggest.o objects/syntax.o objects/tag.o objects/term.o objects/terminal.o objects/testing.o objects/textformat.o objects/textobject.o objects/textprop.o objects/time.o objects/typval.o objects/ui.o objects/undo.o objects/usercmd.o objects/userfunc.o objects/version.o objects/vim9compile.o objects/vim9execute.o objects/vim9script.o objects/vim9type.o objects/viminfo.o objects/window.o objects/bufwrite.o objects/vterm_encoding.o objects/vterm_keyboard.o objects/vterm_mouse.o objects/vterm_parser.o objects/vterm_pen.o objects/vterm_screen.o objects/vterm_state.o objects/vterm_unicode.o objects/vterm_vterm.o objects/if_python3.o objects/netbeans.o objects/job.o objects/channel.o objects/xdiffi.o objects/xemit.o objects/xprepare.o objects/xutils.o objects/xhistogram.o objects/xpatience.o objects/charset.o objects/json.o objects/main.o objects/memfile.o objects/message.o -lm -lelf -pthread -lncursesw -L/usr/local/lib/python3.9/config-3.9 -lpython3.9 -lcrypt -lintl -ldl -L/usr/local/lib -lintl -lutil -lm -lm ld: error: undefined symbol: sysinfo >>> referenced by memline.c >>> objects/memline.o:(findswapname) >>> referenced by memline.c >>> objects/memline.o:(ml_recover) >>> referenced by memline.c >>> objects/memline.o:(swapfile_info) cc: error: linker command failed with exit code 1 (use -v to see invocation) link.sh: Linking failed *** Error code 1 Stop. make[3]: stopped in /usr/ports/editors/vim/work/vim-8.2.2725/src *** Error code 1 Stop. make[2]: stopped in /usr/ports/editors/vim/work/vim-8.2.2725 *** Error code 1 Stop. make[1]: stopped in /usr/ports/editors/vim *** Error code 1 For now, I've added this to the Makefile. Not sure if this is the most elegant solution, but works for me. diff --git a/editors/vim/Makefile b/editors/vim/Makefile index 6e7e10617..feea79d53 100644 --- a/editors/vim/Makefile +++ b/editors/vim/Makefile @@ -18,6 +18,8 @@ USE_GITHUB= yes CONFLICTS_INSTALL?= vim-console vim-tiny +LIBS+= -L${LOCALBASE}/lib -lsysinfo + CONFIGURE_ARGS= --enable-gui=${GUI} \ --enable-multibyte \ --with-tlib=ncursesw In case it matters, this is my port config: # make showconfig ===> The following configuration options are available for vim-8.2.2725: CSCOPE=off: cscope support DEFAULT_VIMRC=off: Install bundled vimrc as default setting MAKE_JOBS=off: Enable parallel build NLS=off: Native Language Support XTERM_SAVE=on: Restore xterm screen after exit ====> Optional language bindings LUA=off: Lua scripting language support PERL=off: Perl scripting language support PYTHON=on: Python bindings or support RUBY=off: Ruby bindings or support SCHEME=off: MzScheme (Racket) bindings TCL=off: Tcl scripting language support ====> Options available for the single CTAGS: you have to select exactly one of them CTAGS_BASE=off: Use system ctags CTAGS_EXUBERANT=off: Use exctags instead of ctags CTAGS_UNIVERSAL=on: Use uctags instead of ctags ====> User interface: you have to select exactly one of them ATHENA=off: Athena GUI toolkit CONSOLE=on: Console/terminal mode GNOME=off: GNOME desktop environment support GTK2=off: GTK+ 2 GUI toolkit support GTK3=off: GTK+ 3 GUI toolkit support MOTIF=off: Motif widget library support X11=off: X11 (graphics) support
I suspect this has to do with the devel/libsysinfo port polluting your build environment. I assume you're building this with `make` instead of poudriere? If you're building with make, and you have the devel/libsysinfo port installed, then vim just needs to be taught not to try to link into it.
(In reply to Adam Weinberger from comment #1) Yes, I'm building with `make`, and `devel/sysinfo` is indeed installed. If I comment out lines 13867--13949 from the (already patched) configure script in work/vim-8.2.2725/src/auto/configure, the error disappears.
(In reply to rsmith from comment #2) I went in opposite direction and just edited work/vim-8.2.2725/src/auto/config.mk to link vim against libsysinfo. That worked also.
Created attachment 224139 [details] add dependency on libsysinfo to vim port My version of patch: add explicit dependency on libsysinfo
Thanks, Oleg, but the solution is to make sure vim does not link against libsysinfo. It is in no way required to run vim, and is solely a case of an unclean (i.e. non-poudriere) ports environment polluting the vim build.
(In reply to Adam Weinberger from comment #5) I welcome any solution that makes the port buildable :) sysinfo call is used just for optimization that looks quite fragile to me (however it was accepted by upstream).
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/ports/commit/?id=4d5cf5c847301e36f0ed4fe30a1b6bbb17ec2332 commit 4d5cf5c847301e36f0ed4fe30a1b6bbb17ec2332 Author: Adam Weinberger <adamw@FreeBSD.org> AuthorDate: 2021-04-16 14:12:06 +0000 Commit: Adam Weinberger <adamw@FreeBSD.org> CommitDate: 2021-04-16 14:12:44 +0000 Try harder to build when libsysinfo is installed PR: 254891 editors/vim/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Can you try with this newest commit? It deletes all the HAVE_SYSINFO_* stuff that got left over and hopefully fixes the build for you. Oleg, it doesn’t seem to me like vim actually needs the sysinfo headers. Do you see a reason why that’d be incorrect? Is there benefit I’m not seeing to making a hard dep on libsysinfo? I want to make sure I’m not missing something.
(In reply to Adam Weinberger from comment #8) Works for me, thanks. The only place it is used is here: https://github.com/vim/vim/blob/master/src/memline.c#L1102 As far as I undertand, here it tries to check if another instance of VIM is using the given.swp file. The check is quite fragile since it can return false positive result in case of time synchronization issues. The only benefit from hard dependency I can see is to have less patching in our ports.
(In reply to Adam Weinberger from comment #8) This solution works fine. It is certainly more elegant than my hack & slash modification of the configure script. A lesson worth remembering; thank you.
Thanks to both of you for the help here. I'm going to close this PR and mark it as fixed.