Skip to content
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

lesstest: use pkg-config to find ncurses libraries #412

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

thesamesam
Copy link
Contributor

Fails to build with split tinfo otherwise like:


x86_64-pc-linux-gnu-gcc -O2 -pipe -march=native -fdiagnostics-color=always -frecord-gcc-switches -Wreturn-type      -ggdb3 -Wl,-O1 -Wl,--as-needed -Wl,--defsym=__gentoo_check_ldflags__=0 -Wl,-z,pack-relative-relocs    -ggdb3 -o lesstest display.o env.o lesstest.o parse.o pipeline.o log.o run.o term.o wchar.o -lncurses
/usr/lib/gcc/x86_64-pc-linux-gnu/13/../../../../x86_64-pc-linux-gnu/bin/ld: display.o: in function `display_screen':
/var/tmp/portage/sys-apps/less-643/work/less-643/lesstest/display.c:86:(.text+0x2e0): undefined reference to `tgoto'
/usr/lib/gcc/x86_64-pc-linux-gnu/13/../../../../x86_64-pc-linux-gnu/bin/ld: term.o: in function `setup_mode':
/var/tmp/portage/sys-apps/less-643/work/less-643/lesstest/term.c:83:(.text+0x18): undefined reference to `tgetstr'
[...]

Going forward, we may want to just add a Makefile.in which configure handles to the lesstest subdir.

Fails to build with split tinfo otherwise like:
```

x86_64-pc-linux-gnu-gcc -O2 -pipe -march=native -fdiagnostics-color=always -frecord-gcc-switches -Wreturn-type      -ggdb3 -Wl,-O1 -Wl,--as-needed -Wl,--defsym=__gentoo_check_ldflags__=0 -Wl,-z,pack-relative-relocs    -ggdb3 -o lesstest display.o env.o lesstest.o parse.o pipeline.o log.o run.o term.o wchar.o -lncurses
/usr/lib/gcc/x86_64-pc-linux-gnu/13/../../../../x86_64-pc-linux-gnu/bin/ld: display.o: in function `display_screen':
/var/tmp/portage/sys-apps/less-643/work/less-643/lesstest/display.c:86:(.text+0x2e0): undefined reference to `tgoto'
/usr/lib/gcc/x86_64-pc-linux-gnu/13/../../../../x86_64-pc-linux-gnu/bin/ld: term.o: in function `setup_mode':
/var/tmp/portage/sys-apps/less-643/work/less-643/lesstest/term.c:83:(.text+0x18): undefined reference to `tgetstr'
[...]
```

Going forward, we may want to just add a Makefile.in which configure handles
to the lesstest subdir.

Signed-off-by: Sam James <[email protected]>
@uberhacker
Copy link

Thank you for this, however, I'm still unable to run tests after applying the patch. Received the following:

ERR  status 256 from /usr/local/tmp/crew/less.20230814224036.dir/less-643/lesstest/lesstest  -e -s '/usr/local/tmp/crew/less.20230814224036.dir/less-643/lesstest/lt_screen' -t '/usr/local/tmp/crew/less.20230814224036.dir/less-643/lesstest/lt/subsearch.lt' '/usr/local/tmp/crew/less.20230814224036.dir/less-643/less'
/usr/local/tmp/crew/less.20230814224036.dir/less-643/less: error while loading shared libraries: libtinfow.so.6: cannot open shared object file: No such file or directory
DIFF github216 on cmd #0 (. 0)
FAIL: github216 (0 steps)

The library does exist and the library search path includes this location.

$ echo $LD_LIBRARY_PATH
/usr/local/lib:/usr/local/lib64
$ ls -l /usr/local/lib64/libtinfow.so.6
lrwxrwxrwx 1 chronos chronos 16 Jan  5  2023 /usr/local/lib64/libtinfow.so.6 -> libtinfow.so.6.4

Any other suggestions?

@thesamesam
Copy link
Contributor Author

I assume LD_LIBRARY_PATH is definitely exported (not just set)?

Can you reproduce it if you run /usr/local/tmp/crew/less.20230814224036.dir/less-643/lesstest/lesstest -e -s '/usr/local/tmp/crew/less.20230814224036.dir/less-643/lesstest/lt_screen' -t '/usr/local/tmp/crew/less.20230814224036.dir/less-643/lesstest/lt/subsearch.lt' '/usr/local/tmp/crew/less.20230814224036.dir/less-643/less' manually after failure?

@uberhacker
Copy link

Hey @thesamesam,
Thanks for the quick response. Yes, I can reproduce.

$ /usr/local/tmp/crew/less.20230817064138.dir/less-643/lesstest/lesstest -e -s '/usr/local/tmp/crew/less.20230817064138.dir/less-643/lesstest/lt_screen' -t '/usr/local/tmp/crew/less.20230817064138.dir/less-643/lesstest/lt/subsearch.lt' '/usr/local/tmp/crew/less.20230817064138.dir/less-643/less'
/usr/local/tmp/crew/less.20230817064138.dir/less-643/less: error while loading shared libraries: libtinfow.so.6: cannot open shared object file: No such file or directory
DIFF subsearch on cmd #0 (. 0)
FAIL: subsearch (0 steps)

@gwsw
Copy link
Owner

gwsw commented Sep 9, 2024

@thesamesam I don't want to merge this while there is an unresolved error report against it as above.
Also what will happen if there is no pkg-config program on the build system?

@gwsw gwsw added the question label Sep 9, 2024
@thesamesam
Copy link
Contributor Author

I'm not sure what the remaining issue is with their test. I interpreted it as "this doesn't make it worse for me" rather than "this regresses my usecase" though.

But you're right that it won't work if there's no pkg-config program on the build system. Handling that portably in a Makefile is a pain. Any suggestions? The better option would be to have configure look for it and substitute in the value.

@avih
Copy link
Contributor

avih commented Sep 9, 2024

what will happen if there is no pkg-config program on the build system?

This should handle this case (untested):

TERMLIB ?= $(shell ${PKG_CONFIG} --libs ncurses || printf %s -lncurses)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants