Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 283644 - sys-libs/readline-6.0_p4 requires fix to compile when upgrading from readline-5.2 (on IRIX?)
Summary: sys-libs/readline-6.0_p4 requires fix to compile when upgrading from readline...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo/Alt
Classification: Unclassified
Component: Prefix Support (show other bugs)
Hardware: All IRIX
: High major (vote)
Assignee: Gentoo Prefix
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-09-04 10:17 UTC by Stuart Shelton
Modified: 2009-09-29 13:07 UTC (History)
1 user (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Stuart Shelton 2009-09-04 10:17:15 UTC
I'm not quite sure how to best approach this one...

When building examples/rlfe/rlfe.c, the build process fails with:

cc -Wl,-s,-x,-n32,-mips4,-rdata_shared,-allow_jump_at_eop,-rpath,/opt/gentoo/usr/lib32:/opt/gentoo/lib32 -L/opt/gentoo/usr/lib32 -L/opt/gentoo/lib32 -o rlfe rlfe.o pty.o -L ../../shlib -lreadline -lhistory -lcurses
ld32: ERROR   33 : Unresolved data symbol "_rl_echoing_p" -- 1st referenced by rlfe.o.
        Use linker option -v to see when and which objects, archives and dsos are loaded.
ld32: INFO    152: Output file removed because of error.
cc ERROR:  /usr/lib32/cmplrs/ld32 returned non-zero status 2
make: *** [rlfe] Error 2
 * ERROR: sys-libs/readline-6.0_p4 failed:
 *   make rlfe failed


... which appears to occur because the libraries are actually in ../../shlib, so the above line should either contain "-Lreadline/shlib" or the "readline" symlink should be to "../../shlib" rather than "../..".

Even then, though, the libraries in this directory are libhistory.so.6 and libreadline.so.6 - but the linker is looking for libhistory.so and libreadline.so.  With symlinks created for these two libraries, the build succeeds.

Without both of these fixes, the build picks up the installed readline-5.2 libraries, and fails due to missing symbols.

(Of course, once any version of readline-6 is installed, the problem goes away since then the installed libraries will have the correct symbols.)

Might a solution be to only install rlfe (which is what, incidentally?) if upgrading from a readline with the same major version - or to do a portage-style stop and restart the build process when upgrading readline major versions and building readline twice - once without rlfe and once with?  I guess it's probably easier to fix the initial build, what with only three symlink changes needed ;)
Comment 1 Fabian Groffen gentoo-dev 2009-09-08 15:48:00 UTC
perhaps this fix also solves the compilation problem on Solaris, let me see.
Comment 2 Fabian Groffen gentoo-dev 2009-09-08 16:03:42 UTC
ok, it solves the problems on Solaris only partially, but at least it's a step ahead.  Commited, thanks.
Comment 3 Fabian Groffen gentoo-dev 2009-09-08 16:18:24 UTC
this was wrong
Comment 4 Fabian Groffen gentoo-dev 2009-09-08 16:20:13 UTC
../.. contains libreadline.a and libhistory.a, the rlfe example should link against the static libs, not the dynamic libs

why doesn't the IRIX linker take the static libs?
Comment 5 Stuart Shelton 2009-09-23 16:18:51 UTC
The IRIX linker attempts to open any dynamic library anywhere in the library-search path before attempting to open any static library.

This means that the linker is looking in "../.." and finding no dynamic libraries, then looking in "$EPREFIX/usr/$(get-libdir)/" and finding the readline-5.x dynamic libraries, and loading these.

If the symlink is changed (wrongly, as you point out) to "../../shlibs", then the dynamic libraries are found here and all appears fine.

In order to use static libraries when dynamic libraries of the same name are present anywhere in the library-search path, the LDFLAG '-B static' is required.  This instructs the linker to *only* link against static libraries, though, so for normal linkage to resume, something akin to the following is needed:

    cc object.o -o out -B static -lstaticlib -lstaticlib2 -B dynamic -ldylib

... so I guess this needs to be patched into the rlfe Makefile:

--- readline-6.0/examples/rlfe/Makefile.in.dist
+++ readline-6.0/examples/rlfe/Makefile.in
@@ -25,7 +25,7 @@
 CPPFLAGS = @CPPFLAGS@
 #LDFLAGS = -L$(READLINE_DIR)
 LDFLAGS = @LDFLAGS@
-LIBS = -lreadline -lhistory @LIBS@
+LIBS = -B static -lreadline -lhistory -B dynamic @LIBS@
 
 CPP=@CPP@
 CPP_DEPEND=$(CC) -MM

Even so, the '-Lreadline' directive must appear first (so that the installed static libraries in $EPREFIX/usr/$(get-libdir) aren't used), and flag-o-matic.eclass really needs a 'prepend-ldflags' function... failing this:

--- readline-6.0_p4.ebuild.dist
+++ readline-6.0_p4.ebuild
@@ -87,7 +87,8 @@
 
        if ! tc-is-cross-compiler ; then
                cd examples/rlfe
-               append-ldflags -Lreadline
+               #append-ldflags -Lreadline
+               LDFLAGS="-Lreadline ${LDFLAGS}"
                econf || die
                emake || die "make rlfe failed"
        fi


Comment 6 Fabian Groffen gentoo-dev 2009-09-25 15:53:35 UTC
(In reply to comment #5)
> Even so, the '-Lreadline' directive must appear first (so that the installed
> static libraries in $EPREFIX/usr/$(get-libdir) aren't used), and
> flag-o-matic.eclass really needs a 'prepend-ldflags' function... failing this:

this is due to you're on LDFLAGS, and not on an ld-wrapper like most prefix arches

I did some attempt with a non-portable patch for IRIX now, can you try if that makes it build for you?
Comment 7 Stuart Shelton 2009-09-29 13:03:19 UTC
That seems to work - readline-6.0_p4 now builds successfully straight from portage! :)
Comment 8 Fabian Groffen gentoo-dev 2009-09-29 13:07:12 UTC
small problem is that gx86 now changed this code as well, trying to fix a similar but not quite teh same issue