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

libpanel.so: Fix a build break without an already installed libterminfo.so #55

Closed
wants to merge 1 commit into from

Conversation

winspool
Copy link

While testing the new rc of tinycc on linux, the build breaks at libpanel/libpanel.so:

  • libpanel/libpanel.so depends on libcurses/libcurses.so

  • libcurses/libcurses.so depends on libterminfo/libterminfo.so

  • the compiler searches for libterminfo.so, but fails:

tcc -m32 -w  -v -v  -shared -o libpanel/libpanel.so libpanel/_deck.lo libpanel/above.lo libpanel/below.lo libpanel/bottom.lo libpanel/del.lo libpanel/getuser.lo libpanel/hidden.lo libpanel/hide.lo libpanel/move.lo libpanel/new.lo libpanel/replace.lo libpanel/setuser.lo libpanel/show.lo libpanel/top.lo libpanel/update.lo libpanel/window.lo libcurses/libcurses.so -Wl,-soname=libpanel.so
tcc version 0.9.28rc 2023-09-09 mob@7f39b4f (i386 Linux)
-> /usr/i686-linux-gnu/lib/crti.o
-> libpanel/_deck.lo
-> libpanel/above.lo
-> libpanel/below.lo
-> libpanel/bottom.lo
-> libpanel/del.lo
-> libpanel/getuser.lo
-> libpanel/hidden.lo
-> libpanel/hide.lo
-> libpanel/move.lo
-> libpanel/new.lo
-> libpanel/replace.lo
-> libpanel/setuser.lo
-> libpanel/show.lo
-> libpanel/top.lo
-> libpanel/update.lo
-> libpanel/window.lo
-> libcurses/libcurses.so
libcurses/libcurses.so: error: referenced dll 'libterminfo.so' not found
make: *** [GNUmakefile:529: libpanel/libpanel.so] Fehler 1

This patch adds the missing reference to libterminfo/
during the build to allow the compiler to find libterminfo.so.

When the os has a libterminfo.so already installed in one of the
default lib search directories, the bug will never be visible.

This can be verified after a sucessful build,
without an installed libterminfo.so:
Example:

ldd libpanel/libpanel.so
libcurses.so is marked as "not found"

ldd libcurses/libcurses.so
libterminfo.so is marked as "not found"

--
Regards ... Detlef

While testing the new rc of tinycc on linux, the build breaks at libpanel/libpanel.so:
* libpanel/libpanel.so depends on libcurses/libcurses.so

* libcurses/libcurses.so depends on libterminfo/libterminfo.so
  the compiler searches for libterminfo.so, but fails.

This patch adds the missing reference to libterminfo/ during the build
to allow the compiler to find libterminfo.so.

This bug will never be visible, when the os has a libterminfo.so installed
in one of the default lib search directories.

--
Regards ... Detlef
@winspool
Copy link
Author

The failure log is similar, when compiling for 64bit.

With an increased verbosity level,
tcc prints more infos during linking, but for "libterminfo.so",
the result is always "nf" (not found).

tcc -w -v -v -v   -shared -o libpanel/libpanel.so libpanel/_deck.lo libpanel/above.lo libpanel/below.lo libpanel/bottom.lo libpanel/del.lo libpanel/getuser.lo libpanel/hidden.lo libpanel/hide.lo libpanel/move.lo libpanel/new.lo libpanel/replace.lo libpanel/setuser.lo libpanel/show.lo libpanel/top.lo libpanel/update.lo libpanel/window.lo libcurses/libcurses.so -Wl,-soname=libpanel.so
tcc version 0.9.28rc 2023-09-09 mob@7f39b4f (x86_64 Linux)
-> /usr/lib/x86_64-linux-gnu/crti.o
-> libpanel/_deck.lo
-> libpanel/above.lo
-> libpanel/below.lo
-> libpanel/bottom.lo
-> libpanel/del.lo
-> libpanel/getuser.lo
-> libpanel/hidden.lo
-> libpanel/hide.lo
-> libpanel/move.lo
-> libpanel/new.lo
-> libpanel/replace.lo
-> libpanel/setuser.lo
-> libpanel/show.lo
-> libpanel/top.lo
-> libpanel/update.lo
-> libpanel/window.lo
-> libcurses/libcurses.so
nf /usr/lib/x86_64-linux-gnu/tcc/libterminfo.so
nf /usr/lib/x86_64-linux-gnu/libterminfo.so
nf /usr/lib/libterminfo.so
nf /lib/x86_64-linux-gnu/libterminfo.so
nf /lib/libterminfo.so
nf /usr/local/lib/x86_64-linux-gnu/libterminfo.so
nf /usr/local/lib/libterminfo.so
libcurses/libcurses.so: error: referenced dll 'libterminfo.so' not found
make: *** [GNUmakefile:529: libpanel/libpanel.so] Fehler 1

@rofl0r
Copy link
Member

rofl0r commented Sep 15, 2023

libpanel.so only uses symbols from libcurses.so, which has its full path provided at the linker command line. imo it's a bug that tcc tries to "recurse" into the dependency tree of libcurses.so. gcc doesn't, i often build netbsd curses on a fresh rootfs without any existing libterminfo.so installed. i suppose unless that is fixed you'll run into problems with other packages that use multiple shared libraries. in case tinycc calls out to binutils' ld, the fix could be as easy as passing the right options (same ones that gcc uses).

@winspool
Copy link
Author

libpanel.so only uses symbols from libcurses.so, which has its full path provided at the linker command line.
imo it's a bug that tcc tries to "recurse" into the dependency tree of libcurses.so.
gcc doesn't,

tcc 0.9.28rc was fixed to not load all referenced libraries, when linking a library.
https://repo.or.cz/tinycc.git/commit/32c4df1497e887eb77f5663c7b656aad70475325

in case tinycc calls out to binutils' ld,
the fix could be as easy as passing the right options (same ones that gcc uses).

tcc is not only a superfast compiler,
but includes also common linker and archive functionality.

@winspool winspool closed this Nov 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants