Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 754924 - sys-fs/reiser4progs: fix libreiser4 linking against static libmisc, and fix configure not finding ncurses (libtinfo)
Summary: sys-fs/reiser4progs: fix libreiser4 linking against static libmisc, and fix c...
Status: UNCONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: No maintainer - Look at https://wiki.gentoo.org/wiki/Project:Proxy_Maintainers if you want to take care of it
URL:
Whiteboard:
Keywords: PATCH
Depends on:
Blocks: tinfo
  Show dependency tree
 
Reported: 2020-11-16 14:22 UTC by mehw
Modified: 2021-05-19 16:07 UTC (History)
4 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
dumb program to test linking against libreiser4 (test-libreiser4.c,562 bytes, text/x-csrc)
2020-11-16 14:22 UTC, mehw
Details
sys-fs/reiser4progs-1.2.1.ebuild (link libreiser4 against static libmisc) (reiser4progs-1.2.1.ebuild,1.33 KB, text/plain)
2020-11-16 14:25 UTC, mehw
Details
sys-fs/reiser4progs/files v1.2.1-v2.0.4 patch to link libreiser4 against libmisc (reiser4progs-1.2.1-libmisc-static.patch,6.29 KB, patch)
2020-11-16 14:28 UTC, mehw
Details | Diff
sys-fs/reiser4progs-2.0.2.ebuild (link libreiser4 against static libmisc) (reiser4progs-2.0.2.ebuild,1.42 KB, text/plain)
2020-11-16 14:29 UTC, mehw
Details
sys-fs/reiser4progs/files v2.0.2-v2.0.4 progs/volume links against static libmisc (reiser4progs-2.0.2-libmisc-static.patch,590 bytes, patch)
2020-11-16 14:33 UTC, mehw
Details | Diff
sys-fs/reiser4progs-2.0.3.ebuild (link libreiser4 against static libmisc) (reiser4progs-2.0.3.ebuild,1.43 KB, text/plain)
2020-11-16 14:35 UTC, mehw
Details
bump sys-fs/reiser4progs-2.0.4.ebuild (link libreiser4 against static libmisc) (reiser4progs-2.0.4.ebuild,1.60 KB, text/plain)
2020-11-16 14:39 UTC, mehw
Details
sys-fs/reiser4progs/files v2.0.4 progs/{cpfs,resizefs} link against static libmisc (reiser4progs-2.0.4-libmisc-static.patch,1.39 KB, patch)
2020-11-16 14:42 UTC, mehw
Details | Diff
sys-fs/reiser4progs updated Manifest file (Manifest,1.21 KB, text/plain)
2020-11-16 14:44 UTC, mehw
Details
sys-fs/reiser4progs-1.2.1-r1.ebuild (link libreiser4 against static libmisc and fix libtinfo) (reiser4progs-1.2.1-r1.ebuild,2.24 KB, text/plain)
2020-11-23 19:50 UTC, mehw
Details
sys-fs/reiser4progs-1.2.1.ebuild configure log: ncurses could not be found (reiser4progs-1.2.1-configure.log,12.98 KB, text/x-log)
2020-11-23 19:54 UTC, mehw
Details
sys-fs/reiser4progs-2.0.2-r1 (link libreiser4 against static libmisc and fix libtinfo) (reiser4progs-2.0.2-r1.ebuild,2.36 KB, text/plain)
2020-11-23 19:57 UTC, mehw
Details
sys-fs/reiser4progs-2.0.3-r1 (link libreiser4 against static libmisc and fix libtinfo) (reiser4progs-2.0.3-r1.ebuild,2.29 KB, text/plain)
2020-11-23 20:01 UTC, mehw
Details
sys-fs/reiser4progs-2.0.4 (fix libtinfo) (reiser4progs-2.0.4.ebuild,2.20 KB, text/plain)
2020-11-23 20:03 UTC, mehw
Details
sys-fs/reiser4progs Manifest file (Manifest,1.21 KB, text/plain)
2020-11-23 20:05 UTC, mehw
Details

Note You need to log in before you can comment on or make changes to this bug.
Description mehw 2020-11-16 14:22:07 UTC
Created attachment 671632 [details]
dumb program to test linking against libreiser4

Compiling sys-fs/reiser4progs v1.2.1, v2.0.2, and v2.0.3 (and also v2.0.4 from format41 branch https://github.com/edward6/reiser4progs/tree/567e5f09f2cc9719686c1d33f8db8b8ad22b83f5) produces libreiser4 libraries with undefined symbols regarding misc_* functions which are defined in libmisc (see include/misc/misc.h and libmisc/Makefile.am), a libtool convenience library (static and never installed on the system).

Compiling sys-block/partclone[reiser4] from 4nykey overlay or even a dumb program 'test-libreiser4.c' (see the attachments) which links against libreiser4 fails:

gcc (Gentoo 9.3.0-r1 p3) 9.3.0

$ /usr/bin/ld: /lib64/libreiser4-1.2.so.1: undefined reference to `misc_str2long'
$ collect2: error: ld returned 1 exit status

The issue is solvable by amending libreiser4/Makefile.am to link libreiser4 against libmisc.

Note that once libreiser4 is linked against a static libmisc, demo/* and progs/* can access misc_* functions via libreiser4, rather than counting on libmisc. This way, when libreiser4 is built as a shared library, demo/* and progs/* (debugfs, fsck, measurefs, mkfs, etc.) can resolve the misc_* symbols dynamically.

Since at the present moment reiser4progs demo/* and progs/* link all against a static libmisc, here I provide patches to keep it that way. Even if libreiser4 links against the static libmisc, making libmisc unessential for demo/* and progs/* (they already link to the former), by giving libmisc precedence over libreiser4 in the Makefile.am files, demo/* and progs/* are kept linked to the static libmisc (otherwise the misc_* symbols in libreiser4 will be used by demo/* and progs/* as explained before).

I do not know if there's a reason to not make libmisc an installable library (lib_LTLIBRARIES=libmisc.la). This way, when it is built as a shared library, its symbols can be resolved dynamically (by libreiser4, and by demo/* and progs/* too).

Since modifying Makefile.am files requires to run automake, the new ebuilds are amended just to apply the patches and run eautoreconf.

I will contact the programmer of reiser4progs to give information about what said here.

Cheers.
Comment 1 mehw 2020-11-16 14:25:22 UTC
Created attachment 671635 [details]
sys-fs/reiser4progs-1.2.1.ebuild (link libreiser4 against static libmisc)

Amended to apply patches and to call eautoreconf.
Comment 2 mehw 2020-11-16 14:28:32 UTC
Created attachment 671638 [details, diff]
sys-fs/reiser4progs/files v1.2.1-v2.0.4 patch to link libreiser4 against libmisc

Patch to link libreiser4 against libmisc.

Suitable for sys-fs/reiser4progs versions from v1.2.1 to v2.0.4.
Comment 3 mehw 2020-11-16 14:29:27 UTC
Created attachment 671641 [details]
sys-fs/reiser4progs-2.0.2.ebuild (link libreiser4 against static libmisc)

Amended to apply patches and to call eautoreconf.
Comment 4 mehw 2020-11-16 14:33:36 UTC
Created attachment 671644 [details, diff]
sys-fs/reiser4progs/files v2.0.2-v2.0.4 progs/volume links against static libmisc

Keeps reiser4progs progs/volume linked against a static libmisc.

Suitable for sys-fs/reiser4progs versions from v2.0.2 to v2.0.4.
Comment 5 mehw 2020-11-16 14:35:03 UTC
Created attachment 671647 [details]
sys-fs/reiser4progs-2.0.3.ebuild (link libreiser4 against static libmisc)

Amended to apply patches and to call eautoreconf.
Comment 6 mehw 2020-11-16 14:39:30 UTC
Created attachment 671650 [details]
bump sys-fs/reiser4progs-2.0.4.ebuild (link libreiser4 against static libmisc)

Version bump.

Uses https://github.com/edward6/reiser4progs/tree/567e5f09f2cc9719686c1d33f8db8b8ad22b83f5 (v2.0.4 isn't yet in https://sourceforge.net/projects/reiser4/).
Comment 7 mehw 2020-11-16 14:42:47 UTC
Created attachment 671653 [details, diff]
sys-fs/reiser4progs/files v2.0.4 progs/{cpfs,resizefs} link against static libmisc

This patch isn't really needed. Useful just to keep an eye of what is happening in progs/*.

Commit c9e2f5cc3be55434ea0d508d42112ff951fcce91 removed cpfs and resizefs as SUBDIRS from progs/Makefile.am. Hence they will not be compiled/installed.
Comment 8 mehw 2020-11-16 14:44:05 UTC
Created attachment 671656 [details]
sys-fs/reiser4progs updated Manifest file

Add v2.0.4 to Manifest file.
Comment 9 mehw 2020-11-23 19:50:16 UTC
Created attachment 674569 [details]
sys-fs/reiser4progs-1.2.1-r1.ebuild (link libreiser4 against static libmisc and fix libtinfo)

Hi.

The developer acknowledged the issue about libreiser4 not linkging against the static libmisc. Also, bugs about reiser4progs code should go to the http://vger.kernel.org/vger-lists.html#reiserfs-devel mailing list.

reiser4progs-1.2.1 is fixed upstream with the following commit:
https://github.com/edward6/reiser4progs/commit/4ae24d18328802c63bf0d4cec7bbfa417031fdae

reiser4progs-2.0.4 is fixed upstream with the following commit:
https://github.com/edward6/reiser4progs/commit/eefb72de39d13cdc575371c0657b84b93b6df2a9

On sourceforge, reiser4progs-2.0.4 release already integrates the patch:
https://sourceforge.net/projects/reiser4/



The amended ebuilds attached also fix an error about not finding ncurses during configure, due to sys-libs/ncurses[tinfo], when the use flag readline is enabled:

configure: WARNING: ncurses could not be found which is required for the --with-readline option (which is enabled by default).

What you should expect, instead, are links against libreadline and libncurses(w), or against libreadline and libtinfo(w) for sys-libs/ncurses[tinfo] (the 'w' is for sys-libs/readline[unicode]).

# USE="readline unicode" emerge =reiser4progs-1.2.1-r1
$ gcc test-libreiser4.c -o test-libreiser4 -lreiser4 -laal
$ ldd test-libreiser4
linux-vdso.so.1 (0x00007ffdbe4a3000)
libreiser4-1.2.so.1 => /lib64/libreiser4-1.2.so.1 (0x00007fca47ef8000)
libaal-1.0.so.7 => /lib64/libaal-1.0.so.7 (0x00007fca47eee000)
libc.so.6 => /lib64/libc.so.6 (0x00007fca47d32000)
libuuid.so.1 => /lib64/libuuid.so.1 (0x00007fca47d29000)
libreadline.so.8 => /lib64/libreadline.so.8 (0x00007fca47cd6000)
/lib64/ld-linux-x86-64.so.2 (0x00007fca47f8f000)
libtinfow.so.6 => /lib64/libtinfow.so.6 (0x00007fca47c98000)



diff reiser4progs-1.2.1.ebuild reiser4progs-1.2.1-r1.ebuild
4c4
< EAPI="6"
---
> EAPI=7
6c6
< inherit multilib eutils toolchain-funcs usr-ldscript
---
> inherit multilib toolchain-funcs usr-ldscript autotools
9c9
< HOMEPAGE="https://sourceforge.net/projects/reiser4/"
---
> HOMEPAGE="https://sourceforge.net/projects/reiser4/ https://github.com/edward6/reiser4progs"
14,15c14,15
< KEYWORDS="amd64 arm ppc ppc64 -sparc x86"
< IUSE="debug readline static static-libs"
---
> KEYWORDS="~amd64 ~arm ~ppc ~ppc64 -sparc ~x86"
> IUSE="debug readline static static-libs unicode"
20c20,21
< 	static-libs? ( >=sys-libs/libaal-1.0.6:=[static-libs(+)] )"
---
> 	static-libs? ( >=sys-libs/libaal-1.0.6:=[static-libs(+)] )
> 	readline? ( sys-libs/readline:0=[unicode=] )"
24c25,32
< PATCHES=( "${FILESDIR}"/${PN}-1.0.7-readline-6.3.patch )
---
> REQUIRED_USE="unicode? ( readline )"
> 
> PATCHES=(
> 	"${FILESDIR}"/${PN}-1.0.7-readline-6.3.patch
> 	"${FILESDIR}"/${P}-libmisc-static.patch
> )
> 
> S="${WORKDIR}/${P}"
26a35,58
> 	default
> 
> 	# Set unicode when readline is compiled with USE=unicode, and
> 	# fix missing libtinfo if ncurses is compiled with USE=tinfo.
> 	if use readline; then
> 		# Check if readline is compiled with USE=unicode.
> 		local unicode=$(usex unicode w '')
> 
> 		# Use pkg-config to get the right ncurses libs for readline.
> 		local ncurses_libs=$($(tc-getPKG_CONFIG) ncurses${unicode} --libs)
> 
> 		# Use pkg-config to get the right ncurses lib names to search for.
> 		local search_libs
> 		for lib in $($(tc-getPKG_CONFIG) ncurses${unicode} --libs-only-l); do
> 			search_libs="${search_libs} ${lib#-l}"
> 		done
> 		sed -ri \
> 			-e "s:-lncurses:${ncurses_libs}:g" \
> 			-e "s:(AC_SEARCH_LIBS\(tgetent,) ncurses,:\1${search_libs},:g" \
> 			configure.ac || die
> 	fi
> 
> 	eautoreconf
> 
33,34d64
< 
< 	default
52a83
> 	find "${ED}" -type f -name "*.la" -delete || die
Comment 10 mehw 2020-11-23 19:54:18 UTC
Created attachment 674572 [details]
sys-fs/reiser4progs-1.2.1.ebuild configure log: ncurses could not be found

# USE=readline emerge =reiser4progs-1.2.1

configure: WARNING: ncurses could not be found which is required for the --with-readline option (which is enabled by default).
Comment 11 mehw 2020-11-23 19:57:47 UTC
Created attachment 674575 [details]
sys-fs/reiser4progs-2.0.2-r1 (link libreiser4 against static libmisc and fix libtinfo)

diff reiser4progs-1.2.1-r1.ebuild reiser4progs-2.0.2-r1.ebuild
3a4,5
> # Note that reiser4progs-2.0.2 doesn't provide the volume.reiser4.8 man page.
> 
17c19
< LIB_DEPEND=">=sys-libs/libaal-1.0.6:=[static-libs(+)]
---
> LIB_DEPEND=">=sys-libs/libaal-1.0.7:=[static-libs(+)]
20c22
< 	static-libs? ( >=sys-libs/libaal-1.0.6:=[static-libs(+)] )
---
> 	static-libs? ( >=sys-libs/libaal-1.0.7:=[static-libs(+)] )
28a31
> 	"${FILESDIR}"/${PN}-1.2.1-libmisc-static.patch
Comment 12 mehw 2020-11-23 20:01:01 UTC
Created attachment 674578 [details]
sys-fs/reiser4progs-2.0.3-r1 (link libreiser4 against static libmisc and fix libtinfo)

diff reiser4progs-2.0.2-r1.ebuild reiser4progs-2.0.3-r1.ebuild
4,5d3
< # Note that reiser4progs-2.0.2 doesn't provide the volume.reiser4.8 man page.
< 
32c30
< 	"${FILESDIR}"/${P}-libmisc-static.patch
---
> 	"${FILESDIR}"/${PN}-2.0.2-libmisc-static.patch
Comment 13 mehw 2020-11-23 20:03:12 UTC
Created attachment 674581 [details]
sys-fs/reiser4progs-2.0.4 (fix libtinfo)

diff reiser4progs-2.0.3-r1.ebuild reiser4progs-2.0.4.ebuild
29,30d28
< 	"${FILESDIR}"/${PN}-1.2.1-libmisc-static.patch
< 	"${FILESDIR}"/${PN}-2.0.2-libmisc-static.patch
Comment 14 mehw 2020-11-23 20:05:04 UTC
Created attachment 674584 [details]
sys-fs/reiser4progs Manifest file

Updated Manifest file.