On Mon, Jul 22, 2019 at 10:21:28AM +0900, Robert Smith wrote: > Dear Thomas, here is my build script for 5.9, when I change the source file > to 6.1 all it does it duplicate this 5.6 file to a 6.1 file, and I have to > manually add any tweaks if necessary. > > root@h1up:/usr/src/build_system_v2/build_scripts# cat ncurses-5.9_ug > echo Compiling and Installing ncurses-5.9
I revisited this, and can see half of the problem, which offers a different
workaround. Comparing the specs files for the compiler in 6.2 and 6.5,
I see that someone added a fallback for -L/usr/lib, apparently to compensate
for some other change.
I'm looking at this file:
/usr/lib/gcc-lib/amd64-unknown-openbsd6.5/4.2.1/specs
which has a line with this information:
%{!static:--eh-frame-hdr} %{!shared:%{!nostdlib:%{!r*:%{!e*:-e
__start}}}} %{shared:-shared} %{R*} %{static:-Bstatic}
%{!static:-Bdynamic} %{rdynamic:-export-dynamic} %{assert*}
%{!dynamic-linker:-dynamic-linker /usr/libexec/ld.so} %{!nostdlib:-L/usr/lib}
That
%{!nostdlib:-L/usr/lib}
is the added text. Using ktrace, I could see that the arguments passed
to collect2 (part of the compiler) put a "-L/usr/lib" before any of the
command-line arguments:
[0] = "/usr/lib/gcc-lib/amd64-unknown-openbsd6.5/4.2.1/collect2"
[1] = "--eh-frame-hdr"
[2] = "-e"
[3] = "__start"
[4] = "-Bdynamic"
[5] = "-dynamic-linker"
[6] = "/usr/libexec/ld.so"
[7] = "-L/usr/lib"
[8] = "-o"
[9] = "clear"
[10] = "/usr/lib/crt0.o"
[11] = "/usr/lib/crtbegin.o"
[12] = "-L../lib"
[13] = "-L/usr/lib/gcc-lib/amd64-unknown-openbsd6.5/4.2.1"
[14] = "../obj_s/clear.o"
[15] = "../obj_s/clear_cmd.o"
[16] = "../obj_s/tty_settings.o"
[17] = "-lncurses"
[18] = "-lgcc"
[19] = "-lc"
[20] = "-lgcc"
[21] = "/usr/lib/crtend.o"
So the loader gets libncurses.so immediately without bothering to pay
any attention to its parameters.
Just reverting that change doesn't work (won't link), so I can see it's
just half the story. But it's enough to see that it probably wasn't
intended behavior.
You might want to open a bug report with the OpenBSD developers here:
http://www.openbsd.org/report.html
(cc'ing them, anyway).
According to
https://gcc.gnu.org/onlinedocs/gcc/Spec-Files.html
you could make a custom "specs" file with a -L../lib before the -L/usr/lib,
using the "-specs=" flag and pass that in your $CFLAGS
(In a quick check, that works for me).
--
Thomas E. Dickey <[email protected]>
https://invisible-island.net
ftp://ftp.invisible-island.net
signature.asc
Description: PGP signature
