octave-8.1.0 adds new autotools readline sensing, based on the added m4/readline.m4, with a related update in m4/acinclude.m4, changing ad hoc libreadline setup to gl_FUNC_READLINE. Behavior on octave-7.3.0-r2.ebuild: checking for rl_set_keyboard_input_timeout in -lreadline... yes Behavior on octave-8.1.0.ebuild: checking for readline... no checking for readline/readline.h... yes checking for readline/history.h... yes [...] checking for readline... (cached) no checking for readline/readline.h... (cached) yes checking for readline/history.h... (cached) yes configure: WARNING: I need GNU Readline 4.2 or later configure: error: this is fatal unless you specify --disable-readline Reproducible: Always Steps to Reproduce: 1. emerge --ask --oneshot =sci-mathematics/octave-8.1.0 2. 3. Actual Results: * ERROR: sci-mathematics/octave-8.1.0::gentoo failed (configure phase): Expected Results: >>> Completed (1 of 1) sci-mathematics/octave-8.1.0::gentoo * Found these USE flags for sci-mathematics/octave-8.1.0: U I + + X : Add support for X11 + - curl : Add support for client-side URL transfer library - - doc : Add extra documentation (API, Javadoc, etc). It is recommended to enable per package instead of globally + - fftw : Use FFTW library for computing Fourier transforms - - fltk : Use x11-libs/fltk as the backend for the OpenGL renderer in the absence of the Qt GUI + - glpk : Add support for sci-mathematics/glpk for linear programming + - gnuplot : Use sci-visualization/gnuplot to render plots if OpenGL is unavailable + + gui : Enable support for a graphical user interface + - hdf5 : Add support for the Hierarchical Data Format v5 + - imagemagick : Use media-gfx/graphicsmagick to read and write images - - java : Add support for Java - - json : Allow using jsonencode and jsondecode commands via dev-libs/rapidjson + + opengl : Add support for OpenGL (3D graphics) - - portaudio : Add support for the crossplatform portaudio audio API + - postscript : Enable support for the PostScript language (often with ghostscript-gpl or libspectre) + - qhull : Add support for media-libs/qhull, to allow `delaunay', `convhull', and related functions + - qrupdate : Add support for sci-libs/qrupdatefor QR and Cholesky update functions + + readline : Enable support for libreadline, a GNU line-editing library that almost everyone wants + - sndfile : Add support for libsndfile + - sparse : Add enhanced support for sparse matrix algebra with SuiteSparse + + ssl : Add support for SSL/TLS connections (Secure Socket Layer / Transport Layer Security) - - sundials : Enable the ode15i and ode15s ODE solvers using sci-libs/sundials + + zlib : Add support for zlib (de)compression [IP-] [ ] sys-apps/portage-3.0.45.2:0 [IP-] [ ] sys-libs/glibc-2.37-r1:2.2 [IP-] [ ] sys-libs/readline-8.2_p1:0/8 [IP-] [ ] sys-devel/autoconf-2.71-r5:2.71 [IP-] [ ] sys-devel/automake-1.16.5:1.16 [IP-] [ ] app-shells/bash-5.2_p15-r2:0 [IP-] [ ] sys-devel/m4-1.4.19-r1:0 [IP-] [ ] dev-lang/python-3.10.10_p3:3.10
Can you include the full build.log & config.log please?
Created attachment 858115 [details] config.log config.log, xz-compressed (uncompressed size 1186896 bytes)
Created attachment 858117 [details] build.log
configure:74420: checking for readline configure:74454: x86_64-pc-linux-gnu-gcc -o conftest -O2 -pipe -march=native -pthread -fopenmp -Wl,-O1 -Wl,--as-needed conftest.c -lpthread -lm /usr/lib64/libreadline.a >&5 /usr/lib/gcc/x86_64-pc-linux-gnu/11/../../../../x86_64-pc-linux-gnu/bin/ld: /usr/lib64/libreadline.a(terminal.o): warning: relocation against `UP' in read-only section `.text' /usr/lib/gcc/x86_64-pc-linux-gnu/11/../../../../x86_64-pc-linux-gnu/bin/ld: /usr/lib64/libreadline.a(display.o): in function `_rl_move_cursor_relative': display.c:(.text+0xef3): undefined reference to `tputs' /usr/lib/gcc/x86_64-pc-linux-gnu/11/../../../../x86_64-pc-linux-gnu/bin/ld: /usr/lib64/libreadline.a(display.o): in function `_rl_move_vert': display.c:(.text+0x176c): undefined reference to `tputs' /usr/lib/gcc/x86_64-pc-linux-gnu/11/../../../../x86_64-pc-linux-gnu/bin/ld: /usr/lib64/libreadline.a(display.o): in function `rl_clear_visible_line': display.c:(.text+0x17cd): undefined reference to `tputs' /usr/lib/gcc/x86_64-pc-linux-gnu/11/../../../../x86_64-pc-linux-gnu/bin/ld: /usr/lib64/libreadline.a(display.o): in function `update_line': display.c:(.text+0x3d2f): undefined reference to `tgoto' /usr/lib/gcc/x86_64-pc-linux-gnu/11/../../../../x86_64-pc-linux-gnu/bin/ld: display.c:(.text+0x3d43): undefined reference to `tputs' /usr/lib/gcc/x86_64-pc-linux-gnu/11/../../../../x86_64-pc-linux-gnu/bin/ld: display.c:(.text+0x3e6f): undefined reference to `tputs' /usr/lib/gcc/x86_64-pc-linux-gnu/11/../../../../x86_64-pc-linux-gnu/bin/ld: display.c:(.text+0x42da): undefined reference to `tputs' /usr/lib/gcc/x86_64-pc-linux-gnu/11/../../../../x86_64-pc-linux-gnu/bin/ld: display.c:(.text+0x4418): undefined reference to `tgoto' /usr/lib/gcc/x86_64-pc-linux-gnu/11/../../../../x86_64-pc-linux-gnu/bin/ld: display.c:(.text+0x442a): undefined reference to `tputs' /usr/lib/gcc/x86_64-pc-linux-gnu/11/../../../../x86_64-pc-linux-gnu/bin/ld: display.c:(.text+0x48d8): undefined reference to `tputs' /usr/lib/gcc/x86_64-pc-linux-gnu/11/../../../../x86_64-pc-linux-gnu/bin/ld: display.c:(.text+0x4938): undefined reference to `tputs' /usr/lib/gcc/x86_64-pc-linux-gnu/11/../../../../x86_64-pc-linux-gnu/bin/ld: /usr/lib64/libreadline.a(display.o): in function `_rl_clear_screen': display.c:(.text+0x6adc): undefined reference to `tputs' /usr/lib/gcc/x86_64-pc-linux-gnu/11/../../../../x86_64-pc-linux-gnu/bin/ld: /usr/lib64/libreadline.a(display.o): in function `_rl_update_final': display.c:(.text+0x6c5f): undefined reference to `tputs' /usr/lib/gcc/x86_64-pc-linux-gnu/11/../../../../x86_64-pc-linux-gnu/bin/ld: /usr/lib64/libreadline.a(display.o):display.c:(.text+0x6dbc): more undefined references to `tputs' follow /usr/lib/gcc/x86_64-pc-linux-gnu/11/../../../../x86_64-pc-linux-gnu/bin/ld: /usr/lib64/libreadline.a(terminal.o): in function `_rl_get_screen_size': terminal.c:(.text+0x22e): undefined reference to `tgetnum' /usr/lib/gcc/x86_64-pc-linux-gnu/11/../../../../x86_64-pc-linux-gnu/bin/ld: terminal.c:(.text+0x277): undefined reference to `tgetnum' /usr/lib/gcc/x86_64-pc-linux-gnu/11/../../../../x86_64-pc-linux-gnu/bin/ld: /usr/lib64/libreadline.a(terminal.o): in function `_rl_backspace': terminal.c:(.text+0x5fb): undefined reference to `tputs' /usr/lib/gcc/x86_64-pc-linux-gnu/11/../../../../x86_64-pc-linux-gnu/bin/ld: /usr/lib64/libreadline.a(terminal.o): in function `rl_ding': terminal.c:(.text+0x6c1): undefined reference to `tputs' /usr/lib/gcc/x86_64-pc-linux-gnu/11/../../../../x86_64-pc-linux-gnu/bin/ld: /usr/lib64/libreadline.a(terminal.o): in function `_rl_init_terminal_io': terminal.c:(.text+0xb64): undefined reference to `BC' /usr/lib/gcc/x86_64-pc-linux-gnu/11/../../../../x86_64-pc-linux-gnu/bin/ld: terminal.c:(.text+0xb71): undefined reference to `PC' /usr/lib/gcc/x86_64-pc-linux-gnu/11/../../../../x86_64-pc-linux-gnu/bin/ld: terminal.c:(.text+0xb79): undefined reference to `UP' /usr/lib/gcc/x86_64-pc-linux-gnu/11/../../../../x86_64-pc-linux-gnu/bin/ld: terminal.c:(.text+0xc29): undefined reference to `tgetent' /usr/lib/gcc/x86_64-pc-linux-gnu/11/../../../../x86_64-pc-linux-gnu/bin/ld: terminal.c:(.text+0xc77): undefined reference to `tgetstr' /usr/lib/gcc/x86_64-pc-linux-gnu/11/../../../../x86_64-pc-linux-gnu/bin/ld: terminal.c:(.text+0xca0): undefined reference to `PC' /usr/lib/gcc/x86_64-pc-linux-gnu/11/../../../../x86_64-pc-linux-gnu/bin/ld: terminal.c:(.text+0xcb6): undefined reference to `BC' /usr/lib/gcc/x86_64-pc-linux-gnu/11/../../../../x86_64-pc-linux-gnu/bin/ld: terminal.c:(.text+0xcc4): undefined reference to `UP' /usr/lib/gcc/x86_64-pc-linux-gnu/11/../../../../x86_64-pc-linux-gnu/bin/ld: terminal.c:(.text+0xcd6): undefined reference to `tgetflag' /usr/lib/gcc/x86_64-pc-linux-gnu/11/../../../../x86_64-pc-linux-gnu/bin/ld: terminal.c:(.text+0xd2b): undefined reference to `tgetflag' /usr/lib/gcc/x86_64-pc-linux-gnu/11/../../../../x86_64-pc-linux-gnu/bin/ld: terminal.c:(.text+0xed2): undefined reference to `tgetflag' /usr/lib/gcc/x86_64-pc-linux-gnu/11/../../../../x86_64-pc-linux-gnu/bin/ld: /usr/lib64/libreadline.a(terminal.o): in function `_rl_enable_meta_key': terminal.c:(.text+0x10c7): undefined reference to `tputs' /usr/lib/gcc/x86_64-pc-linux-gnu/11/../../../../x86_64-pc-linux-gnu/bin/ld: /usr/lib64/libreadline.a(terminal.o): in function `_rl_disable_meta_key': terminal.c:(.text+0x1129): undefined reference to `tputs' /usr/lib/gcc/x86_64-pc-linux-gnu/11/../../../../x86_64-pc-linux-gnu/bin/ld: /usr/lib64/libreadline.a(terminal.o): in function `_rl_cr': terminal.c:(.text+0x674): undefined reference to `tputs' /usr/lib/gcc/x86_64-pc-linux-gnu/11/../../../../x86_64-pc-linux-gnu/bin/ld: /usr/lib64/libreadline.a(terminal.o): in function `_rl_standout_on': terminal.c:(.text+0x733): undefined reference to `tputs' /usr/lib/gcc/x86_64-pc-linux-gnu/11/../../../../x86_64-pc-linux-gnu/bin/ld: /usr/lib64/libreadline.a(terminal.o): in function `_rl_standout_off': terminal.c:(.text+0x773): undefined reference to `tputs' /usr/lib/gcc/x86_64-pc-linux-gnu/11/../../../../x86_64-pc-linux-gnu/bin/ld: /usr/lib64/libreadline.a(terminal.o):terminal.c:(.text+0x1043): more undefined references to `tputs' follow /usr/lib/gcc/x86_64-pc-linux-gnu/11/../../../../x86_64-pc-linux-gnu/bin/ld: warning: creating DT_TEXTREL in a PIE collect2: error: ld returned 1 exit status configure:74454: $? = 1 configure: failed program was:
The octave-7.3.0 m4/acinclude.m4 logic around readline has this: if test $USE_READLINE = yes; then dnl RHEL 5 and older systems require termlib set before enabling readline AC_REQUIRE([OCTAVE_CHECK_LIB_TERMLIB]) ac_octave_save_LIBS="$LIBS" LIBS="$TERM_LIBS" AC_CHECK_LIB([readline], [rl_set_keyboard_input_timeout], [READLINE_LIBS="-lreadline" AC_DEFINE(USE_READLINE, 1, [Define to 1 to use the readline library.]) ], [AC_MSG_WARN([I need GNU Readline 4.2 or later]) AC_MSG_ERROR([this is fatal unless you specify --disable-readline]) ]) LIBS="$ac_octave_save_LIBS" fi Looks like the termlib kludge was rescuing the readline detection. Although, I see similar logic in the new m4/readline.m4. How does one inhibit use of libreadline.a? Why do you think that's happening? The libreadline.so* artifacts are certainly installed: lrwxrwxrwx 1 root root 18 Nov 24 09:26 /lib64/libreadline.so.8 -> libreadline.so.8.2 -rwxr-xr-x 1 root root 403736 Nov 24 09:26 /lib64/libreadline.so.8.2 -rw-r--r-- 1 root root 663384 Nov 24 09:26 /usr/lib64/libreadline.a -rwxr-xr-x 1 root root 531 Nov 24 09:26 /usr/lib64/libreadline.so Local readline use flags: * Found these USE flags for sys-libs/readline-8.2_p1: U I - - abi_x86_32 : 32-bit (x86) libraries + + static-libs : Build static versions of dynamic libraries as well - - utils : Install rlfe (ReadLine Front-End) helper tool -- a wrapper program for making any stdin use readline + + verify-sig : Verify upstream signatures on distfiles
Note, readline is linked on my system dynamically in octave-7.3.0, which is no surprise given that the ad hoc logic in acinclude.m4 just sets READLINE_LIBS=-lreadline: $ ldd /usr/bin/octave-cli [...] libreadline.so.8 => /lib64/libreadline.so.8 (0x00007f53f92d8000) Maybe relevant: sci-mathematics/octave/files/octave-4.2.2-ncurses-pkgconfig.patch is included in octave-7.3.0-r2.ebuild but omitted in octave-8.1.0.ebuild. termcap/ncurses/readline looks to be a hotspot both upstream and in the port, so it's not surprising that it's brittle.
FWIW, I can't replicate this. ~ $ emerge -1vp sci-mathematics/octave sys-libs/readline [ebuild R ] sci-mathematics/octave-8.1.0:0/8.1.0::gentoo USE="X curl fftw glpk gnuplot gui opengl qhull qrupdate readline sparse ssl zlib -doc -fltk -hdf5 -imagemagick -java -json -portaudio -postscript -sndfile -sundials" 0 KiB [ebuild R ] sys-libs/readline-8.2_p1:0/8::gentoo USE="static-libs (unicode) (-split-usr) -utils -verify-sig" ABI_X86="32 (64) (-x32)" 0 KiB Could you post emerge -epv octave? I'm curious if there could be any other flags at play.
Created attachment 858135 [details] emerge -epv =sci-mathematics/octave-8.1.0
hmm, interesting. what about: find /usr -name libreadline'*' -print0 | xargs -0 ls -l please also post emerge --info, just in case. (to elaborate on what I'm doing: I'm currently trying to see why AC_LIB_LINKFLAGS_BODY thinks the shared library doesn't exist)
(added /lib64) $ find /lib64/ /usr -name libreadline'*' -print0 | xargs -0 ls -l lrwxrwxrwx 1 root root 18 Nov 24 09:26 /lib64/libreadline.so.8 -> libreadline.so.8.2 -rwxr-xr-x 1 root root 403736 Nov 24 09:26 /lib64/libreadline.so.8.2 -rw-r--r-- 1 root root 663384 Nov 24 09:26 /usr/lib64/libreadline.a -rwxr-xr-x 1 root root 531 Nov 24 09:26 /usr/lib64/libreadline.so $ cat /usr/lib64/libreadline.so /* GNU ld script Since Gentoo has critical dynamic libraries in /lib, and the static versions in /usr/lib, we need to have a "fake" dynamic lib in /usr/lib, otherwise we run into linking problems. This "fake" dynamic lib is a linker script that redirects the linker to the real lib. And yes, this works in the cross- compiling scenario as the sysroot-ed linker will prepend the real path. See bug https://bugs.gentoo.org/4411 for more info. */ OUTPUT_FORMAT ( elf64-x86-64 ) GROUP ( /lib64/libreadline.so.8 )
Created attachment 858139 [details] emerge --info
curious - I see nothing out of the ordinary. the script should be checking for libdir/libreadline.so. what happens if you run configure with -C outside of portage? so that you can inspect/post the config.cache file (if it even makes one). I'd consider also running it under strace with -P on each one of those libreadline matches to see what it tries to probe (you'll need -f since shell scripts are fork heavy). so, something like: strace -o foo.strace -fqqqe s=USR1 -P /usr/lib/libreadline.so -P /usr/lib/libreadline.so.8 -P /usr/lib/libreadline.so.8.2 -P /usr/lib/libreadline.a -P /usr/lib64/libreadline.so.8 -P /usr/lib64/libreadline.so -P /usr/lib64/libreadline.so.8.2 -P /usr/lib64/libreadline.a ./configure -C I'd be interested in any stat/access calls that touch readlines. could you try what happens if you have readline[-static-libs]?
No need for a deep dive into syscall tracing and whatnot. If I just mv /usr/lib64/libreadline.a /usr/lib64/libreadline.a.hold then ebuild /usr/portage/sci-mathematics/octave/octave-8.1.0.ebuild configure is happy. Move libreadline.a back and configure is back to failing on the readline test compile. I've included at the end the full configure that portage issues in the workdir. My central finding around it is that with --prefix=/usr , configure does this and fails: configure:74420: checking for readline configure:74454: x86_64-pc-linux-gnu-gcc -o conftest -g -O2 -pthread -fopenmp conftest.c -lpthread -lm /usr/lib64/libreadline.a >&5 but without it, it does this and succeeds: configure:74420: checking for readline configure:74454: x86_64-pc-linux-gnu-gcc -o conftest -g -O2 -pthread -fopenmp conftest.c -lpthread -lm -lreadline >&5 Evidently this is an unexpected interaction, because --prefix designates the installation directory. But there is extensive reference to $prefix in the setup code for the readline compilation test. Without --prefix=/usr , prefix is defaulting to /usr/local, and since there is no /usr/local/lib*/libreadline.a on the system, configure falls through to the correct -lreadline. See if ebuild is issuing configure with the same args for you: ./configure --prefix=/usr --build=x86_64-pc-linux-gnu --host=x86_64-pc-linux-gnu --mandir=/usr/share/man --infodir=/usr/share/info --datadir=/usr/share --sysconfdir=/etc --localstatedir=/var/lib --datarootdir=/usr/share --disable-dependency-tracking --disable-silent-rules --disable-static --docdir=/usr/share/doc/octave-8.1.0 --htmldir=/usr/share/doc/octave-8.1.0/html --with-sysroot=/ '--localstatedir=/var/state/octave' '--with-blas=-lblas ' '--with-lapack=-llapack ' '--disable-64' '--enable-shared' '--with-z' '--with-bz2' '--disable-docs' '--disable-java' '--disable-rapidjson' '--enable-readline' '--with-curl' '--with-fftw3' '--with-fftw3f' '--enable-fftw-threads' '--with-glpk' '--with-hdf5' '--with-magick=GraphicsMagick++' '--with-opengl' '--without-fltk' '--with-openssl' '--without-portaudio' '--with-qhull_r' '--with-qrupdate' '--with-qt=5' '--with-sndfile' '--with-arpack' '--with-umfpack' '--with-colamd' '--with-ccolamd' '--with-cholmod' '--with-cxsparse' '--without-sundials_ida' '--with-x'
(Moving doesn't prove too much as the lookup order is also interesting.)
By instrumenting the generated configure script, I was able to determine that LIBREADLINE is getting its undesired .a value from here: ./m4/lib-link.m4 L 467: if test "X$found_a" != "X"; then dnl Linking with a static library. LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_a" else dnl We shouldn't come here, but anyway it's good to have a dnl fallback. LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir -l$name" fi which is bundled in the octave distfile: $ tar -tvvf /var/cache/distfiles/octave-8.1.0.tar.xz | fgrep lib-link.m4 -rw-r--r-- 0/0 35723 2023-03-06 23:34 octave-8.1.0/m4/lib-link.m4 but the file is nothing unique/unusual -- it's identical to the /usr/share/aclocal/lib-link.m4 owned by sys-devel/gettext. lib-link.m4 is 814 lines of arcane shell scripting just to pick which library to use. Seems like a good example of autotools hell. That said, I was able to tease out of it a fix that confirms my earlier diagnosis: --without-libreadline-prefix fixes the problem, satisfying the readline link dep with -lreadline. I have no theory for how this bug could be missing on another host with /usr/lib64/libreadline.a installed, and same configure args as I show above (including --prefix=/usr).
Ah, nice work. I never liked the -prefix mechanism. Hopefully I'll be able to influence folk to allow using pkg-config as a first resort, at least if required. In essence, the -prefix stuff exists to handle (IMO broken) setups in which programs are installed with various different $prefix values. This is useless in our case. In such a setup, the compiler can't be trusted to find the right libdirs, hence reimplementing that algorithm in shell. We can just add the --without-*-prefix flags for all possible libraries in octave here instead (there's already precedent for this too, many packages do this). Thanks again, excellent work.
(BTW, lib-link.m4 comes from Gnulib, not Gettext, Gettext just happens to also install it. This and other files like it are part of why it's normally wrong to autoreconf directly)
>lib-link.m4 comes from Gnulib, not Gettext I didn't know where it came from, but I knew it didn't come from gettext :-)
The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7b562e163273acc15b4490f029e08a637a57c764 commit 7b562e163273acc15b4490f029e08a637a57c764 Author: Sam James <sam@gentoo.org> AuthorDate: 2023-05-26 09:35:07 +0000 Commit: Sam James <sam@gentoo.org> CommitDate: 2023-05-26 09:35:17 +0000 sci-mathematics/octave: add 8.2.0 Closes: https://bugs.gentoo.org/907183 Closes: https://bugs.gentoo.org/901965 Signed-off-by: Sam James <sam@gentoo.org> sci-mathematics/octave/Manifest | 1 + sci-mathematics/octave/octave-8.2.0.ebuild | 241 +++++++++++++++++++++++++++++ 2 files changed, 242 insertions(+)