-
-
Notifications
You must be signed in to change notification settings - Fork 12.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ncurses: fix linking with lld
17+
#309887
Conversation
@ofborg build pkgsLLVM.ncurses |
Has this one been reported upstream? |
As far as I can tell it hasn't but I'm not sure I'm looking in the right places (is this mailing list where |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM tho could avoid the rebuilds using configureFlags
nit.diff
diff --git a/pkgs/development/libraries/ncurses/default.nix b/pkgs/development/libraries/ncurses/default.nix
index 4a90733fc805..8d4bbed34d7f 100644
--- a/pkgs/development/libraries/ncurses/default.nix
+++ b/pkgs/development/libraries/ncurses/default.nix
@@ -24,7 +24,10 @@ stdenv.mkDerivation (finalAttrs: {
outputs = [ "out" "dev" "man" ];
setOutputFlags = false; # some aren't supported
- configureFlags = [
+ configureFlags = let
+ lld17Plus = stdenv.cc.bintools.isLLVM
+ && lib.versionAtLeast stdenv.cc.bintools.version "17";
+ in [
(lib.withFeature (!enableStatic) "shared")
"--without-debug"
"--enable-pc-files"
@@ -51,21 +54,16 @@ stdenv.mkDerivation (finalAttrs: {
]}"
] ++ lib.optionals (stdenv.buildPlatform != stdenv.hostPlatform) [
"--with-build-cc=${buildPackages.stdenv.cc}/bin/${buildPackages.stdenv.cc.targetPrefix}cc"
+ ] ++ lib.optionals lld17Plus [
+ # lld17+ passes `--no-undefined-version` by default and makes this a hard
+ # error; ncurses' `resulting.map` version script makes reference to symbols
+ # that aren't present. For now we allow this with `--undefined-version`:
+ "LDFLAGS=-Wl,--undefined-version"
];
# Only the C compiler, and explicitly not C++ compiler needs this flag on solaris:
CFLAGS = lib.optionalString stdenv.isSunOS "-D_XOPEN_SOURCE_EXTENDED";
- # lld17+ passes `--no-undefined-version` by default and makes this a hard
- # error; ncurses' `resulting.map` version script makes reference to symbols
- # that aren't present. For now we allow this with `--undefined-version`:
- env = let
- lld17Plus = stdenv.cc.bintools.isLLVM
- && lib.versionAtLeast stdenv.cc.bintools.version "17";
- in {
- NIX_LDFLAGS = lib.optionalString lld17Plus "--undefined-version";
- };
-
strictDeps = true;
nativeBuildInputs = [
I think that's correct. Mind reporting it? |
9bf58a8
to
6f3c12e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I independently discovered this and submitted a duplicate PR (above), so this PR is now a) additionally tested via aggressive FreeBSD dogfooding, and b) blocking for #296581
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
IIRC This has also been an issue in Gentoo. This patch removes the terminfo dependency from LLVM to at least reduce the amount of undefined symbols that need to be ignored to build LLVM with curses support: |
6f3c12e
to
7695ec0
Compare
I took the liberty of addressing the review comments to unblock this. @rrbutani, I hope that's okay :) |
I still don't see an upstream bug report… |
@alyssais I've already sent the email, but the archives haven't refreshed yet. I'll post a link here when it shows up. |
Wonderful, thank you! |
Another fix like NixOS#309884 for fallout from `lld` 17's `--no-undefined-version` default + hard error. For context: - llvm/llvm-project@241dbd3 - https://reviews.llvm.org/D135402 - llvm/llvm-project#61208 Error (without this fix): ```console ncurses> x86_64-unknown-linux-gnu-clang -Qunused-arguments -Wno-error=implicit-function-declaration -shared -Wl,--version-script,resulting.map -Wl,-soname,`basename ../lib/libncursesw.so.6.4 .6.4`.6,-stats,-lc -o ../lib/libncursesw.so.6.4 ../obj_s/hardscroll.o ../obj_s/hashmap.o ../obj_s/lib_addch.o ../obj_s/lib_addstr.o ../obj_s/lib_beep.o ../obj_s/lib_bkgd.o ../obj_s/lib_box.o ../obj_s/lib_chgat.o ../obj_s/lib_clear.o ../obj_s/lib_clearok.o ../obj_s/lib_clrbot.o ../obj_s/lib_clreol.o ../obj_s/lib_color.o ../obj_s/lib_colorset.o ../obj_s/lib_delch.o ../obj_s/lib_delwin.o ../obj_s/lib_echo.o ../obj_s/lib_endwin.o ../obj_s/lib_erase.o ../obj_s/lib_flash.o ../obj_s/lib_gen.o ../obj_s/lib_getch.o ../obj_s/lib_getstr.o ../obj_s/lib_hline.o ../obj_s/lib_immedok.o ../obj_s/lib_inchstr.o ../obj_s/lib_initscr.o ../obj_s/lib_insch.o ../obj_s/lib_insdel.o ../obj_s/lib_insnstr.o ../obj_s/lib_instr.o ../obj_s/lib_isendwin.o ../obj_s/lib_leaveok.o ../obj_s/lib_mouse.o ../obj_s/lib_move.o ../obj_s/lib_mvcur.o ../obj_s/lib_mvwin.o ../obj_s/lib_newterm.o ../obj_s/lib_newwin.o ../obj_s/lib_nl.o ../obj_s/lib_overlay.o ../obj_s/lib_pad.o ../obj_s/lib_printw.o ../obj_s/lib_redrawln.o ../obj_s/lib_refresh.o ../obj_s/lib_restart.o ../obj_s/lib_scanw.o ../obj_s/lib_screen.o ../obj_s/lib_scroll.o ../obj_s/lib_scrollok.o ../obj_s/lib_scrreg.o ../obj_s/lib_set_term.o ../obj_s/lib_slk.o ../obj_s/lib_slkatr_set.o ../obj_s/lib_slkatrof.o ../obj_s/lib_slkatron.o ../obj_s/lib_slkatrset.o ../obj_s/lib_slkattr.o ../obj_s/lib_slkclear.o ../obj_s/lib_slkcolor.o ../obj_s/lib_slkinit.o ../obj_s/lib_slklab.o ../obj_s/lib_slkrefr.o ../obj_s/lib_slkset.o ../obj_s/lib_slktouch.o ../obj_s/lib_touch.o ../obj_s/lib_tstp.o ../obj_s/lib_ungetch.o ../obj_s/lib_vidattr.o ../obj_s/lib_vline.o ../obj_s/lib_wattroff.o ../obj_s/lib_wattron.o ../obj_s/lib_winch.o ../obj_s/lib_window.o ../obj_s/nc_panel.o ../obj_s/safe_sprintf.o ../obj_s/tty_update.o ../obj_s/varargs.o ../obj_s/vsscanf.o ../obj_s/lib_freeall.o ../obj_s/charable.o ../obj_s/lib_add_wch.o ../obj_s/lib_box_set.o ../obj_s/lib_cchar.o ../obj_s/lib_erasewchar.o ../obj_s/lib_get_wch.o ../obj_s/lib_get_wstr.o ../obj_s/lib_hline_set.o ../obj_s/lib_in_wch.o ../obj_s/lib_in_wchnstr.o ../obj_s/lib_ins_wch.o ../obj_s/lib_inwstr.o ../obj_s/lib_key_name.o ../obj_s/lib_pecho_wchar.o ../obj_s/lib_slk_wset.o ../obj_s/lib_unget_wch.o ../obj_s/lib_vid_attr.o ../obj_s/lib_vline_set.o ../obj_s/lib_wacs.o ../obj_s/lib_wunctrl.o ../obj_s/expanded.o ../obj_s/legacy_coding.o ../obj_s/lib_dft_fgbg.o ../obj_s/lib_print.o ../obj_s/new_pair.o ../obj_s/resizeterm.o ../obj_s/use_screen.o ../obj_s/use_window.o ../obj_s/wresize.o ../obj_s/access.o ../obj_s/add_tries.o ../obj_s/alloc_ttype.o ../obj_s/codes.o ../obj_s/comp_captab.o ../obj_s/comp_error.o ../obj_s/comp_hash.o ../obj_s/comp_userdefs.o ../obj_s/db_iterator.o ../obj_s/doalloc.o ../obj_s/entries.o ../obj_s/fallback.o ../obj_s/free_ttype.o ../obj_s/getenv_num.o ../obj_s/home_terminfo.o ../obj_s/init_keytry.o ../obj_s/lib_acs.o ../obj_s/lib_baudrate.o ../obj_s/lib_cur_term.o ../obj_s/lib_data.o ../obj_s/lib_has_cap.o ../obj_s/lib_kernel.o ../obj_s/lib_keyname.o ../obj_s/lib_longname.o ../obj_s/lib_napms.o ../obj_s/lib_options.o ../obj_s/lib_raw.o ../obj_s/lib_setup.o ../obj_s/lib_termcap.o ../obj_s/lib_termname.o ../obj_s/lib_tgoto.o ../obj_s/lib_ti.o ../obj_s/lib_tparm.o ../obj_s/lib_tputs.o ../obj_s/lib_trace.o ../obj_s/lib_ttyflags.o ../obj_s/lib_twait.o ../obj_s/name_match.o ../obj_s/names.o ../obj_s/obsolete.o ../obj_s/read_entry.o ../obj_s/read_termcap.o ../obj_s/strings.o ../obj_s/tries.o ../obj_s/trim_sgr0.o ../obj_s/unctrl.o ../obj_s/visbuf.o ../obj_s/alloc_entry.o ../obj_s/captoinfo.o ../obj_s/comp_expand.o ../obj_s/comp_parse.o ../obj_s/comp_scan.o ../obj_s/parse_entry.o ../obj_s/write_entry.o ../obj_s/define_key.o ../obj_s/hashed_db.o ../obj_s/key_defined.o ../obj_s/keybound.o ../obj_s/keyok.o ../obj_s/version.o -L../lib ncurses> x86_64-unknown-linux-gnu-ld: error: version script assignment of 'NCURSES6_TIC_5.0.19991023' to symbol '_nc_check_termtype' failed: symbol not defined ncurses> x86_64-unknown-linux-gnu-ld: error: version script assignment of 'NCURSES6_TIC_5.0.19991023' to symbol '_nc_resolve_uses' failed: symbol not defined ncurses> x86_64-unknown-linux-gnu-ld: error: version script assignment of 'NCURSES6_TIC_5.5.20051010' to symbol '_nc_alloc_entry_leaks' failed: symbol not defined ncurses> x86_64-unknown-linux-gnu-ld: error: version script assignment of 'NCURSES6_TIC_5.5.20051010' to symbol '_nc_captoinfo_leaks' failed: symbol not defined ncurses> x86_64-unknown-linux-gnu-ld: error: version script assignment of 'NCURSES6_TIC_5.5.20051010' to symbol '_nc_comp_scan_leaks' failed: symbol not defined ncurses> x86_64-unknown-linux-gnu-ld: error: version script assignment of 'NCURSES6_TIC_5.7.20081102' to symbol '_nc_free_tic' failed: symbol not defined ncurses> x86_64-unknown-linux-gnu-ld: error: version script assignment of 'local' to symbol '_nc_comp_captab_leaks' failed: symbol not defined ncurses> x86_64-unknown-linux-gnu-ld: error: version script assignment of 'local' to symbol '_nc_leaks_tic' failed: symbol not defined ncurses> x86_64-unknown-linux-gnu-ld: error: version script assignment of 'NCURSES6_TINFO_5.0.19991023' to symbol '_nc_info_hash_table' failed: symbol not defined ncurses> x86_64-unknown-linux-gnu-ld: error: version script assignment of 'NCURSES6_TINFO_5.0.19991023' to symbol '_nc_trace_buf' failed: symbol not defined ncurses> x86_64-unknown-linux-gnu-ld: error: version script assignment of 'NCURSES6_TINFO_5.0.19991023' to symbol '_tracechar' failed: symbol not defined ncurses> x86_64-unknown-linux-gnu-ld: error: version script assignment of 'NCURSES6_TINFO_5.0.19991023' to symbol 'trace' failed: symbol not defined ncurses> x86_64-unknown-linux-gnu-ld: error: version script assignment of 'local' to symbol '_nc_cap_hash_table' failed: symbol not defined ncurses> x86_64-unknown-linux-gnu-ld: error: version script assignment of 'local' to symbol '_nc_capalias_table' failed: symbol not defined ncurses> x86_64-unknown-linux-gnu-ld: error: version script assignment of 'local' to symbol '_nc_infoalias_table' failed: symbol not defined ncurses> x86_64-unknown-linux-gnu-ld: error: version script assignment of 'local' to symbol '_nc_key_names' failed: symbol not defined ncurses> x86_64-unknown-linux-gnu-ld: error: version script assignment of 'local' to symbol '_nc_read_termcap_entry' failed: symbol not defined ncurses> x86_64-unknown-linux-gnu-ld: error: version script assignment of 'local' to symbol '_nc_trace_tries' failed: symbol not defined ncurses> x86_64-unknown-linux-gnu-ld: error: version script assignment of 'local' to symbol '_nc_tracebits' failed: symbol not defined ncurses> x86_64-unknown-linux-gnu-ld: error: version script assignment of 'NCURSES6_TINFO_5.1.20000708' to symbol '_nc_utf8_outch' failed: symbol not defined ncurses> x86_64-unknown-linux-gnu-ld: error: too many errors emitted, stopping now (use --error-limit=0 to see all errors) ``` Co-authored-by: Bernardo Meurer <bernardo@meurer.org>
7695ec0
to
6080bfb
Compare
Apologies for dropping the ball on this. @lovesegfault thank you; I've added a link to your bug report in the comments. |
Successfully created backport PR for |
Backport failed for Please cherry-pick the changes locally and resolve any conflicts. git fetch origin release-24.05
git worktree add -d .worktree/backport-309887-to-release-24.05 origin/release-24.05
cd .worktree/backport-309887-to-release-24.05
git switch --create backport-309887-to-release-24.05
git cherry-pick -x 6080bfb6cb054c4fe6df6da3836c7930141be897 |
Another fix like #309884 for fallout from
lld
17's--no-undefined-version
default + hard error.For context:
Error (without this PR):
Closes #310727
Description of changes
Things done
nix.conf
? (See Nix manual)sandbox = relaxed
sandbox = true
nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD"
. Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/
)Add a 👍 reaction to pull requests you find important.