[GHC] #7062: Spurious undefined reference to `openpty'
GHC
cvs-ghc at haskell.org
Fri Jul 27 22:25:43 CEST 2012
#7062: Spurious undefined reference to `openpty'
---------------------------------+------------------------------------------
Reporter: simonmar | Owner:
Type: bug | Status: merge
Priority: high | Milestone: 7.4.3
Component: Compiler | Version: 7.4.2
Keywords: | Os: Unknown/Multiple
Architecture: Unknown/Multiple | Failure: None/Unknown
Difficulty: Unknown | Testcase:
Blockedby: | Blocking:
Related: |
---------------------------------+------------------------------------------
Comment(by trommler):
Replying to [comment:12 nus]:
> Replying to [comment:8 trommler]:
> I'm not sure what's going on with that build. After applying
http://hackage.haskell.org/trac/ghc/changeset/301b37255fb9ea3abd634cf9caf774c6dab647b7
to the pristine ghc-7.4.2 sources the `process001(dyn)` test from the
7.4.2 testsuite finishes OK here.
My executable also contains a RUNPATH tag in addition to the RPATH tag:
{{{
Dynamic section at offset 0x2d78 contains 27 entries:
Tag Type Name/Value
0x0000000000000001 (NEEDED) Shared library:
[libHSprocess-1.1.0.2-ghc7.7.20120724.so]
0x0000000000000001 (NEEDED) Shared library:
[libHSbase-4.6.0.0-ghc7.7.20120724.so]
0x0000000000000001 (NEEDED) Shared library: [libHSghc-
prim-0.3.0.0-ghc7.7.20120724.so]
0x0000000000000001 (NEEDED) Shared library: [libHSrts-
ghc7.7.20120724.so]
0x0000000000000001 (NEEDED) Shared library: [libc.so.6]
0x000000000000000f (RPATH) Library rpath:
[/home/peter/projects/haskell/ghc-validate/libraries/process/dist-
install/build:/home/peter/projects/haskell/ghc-
validate/libraries/directory/dist-
install/build:/home/peter/projects/haskell/ghc-validate/libraries/unix
/dist-install/build:/home/peter/projects/haskell/ghc-
validate/libraries/bytestring/dist-
install/build:/home/peter/projects/haskell/ghc-validate/libraries/time
/dist-install/build:/home/peter/projects/haskell/ghc-validate/libraries
/old-locale/dist-install/build:/home/peter/projects/haskell/ghc-
validate/libraries/filepath/dist-
install/build:/home/peter/projects/haskell/ghc-validate/libraries/deepseq
/dist-install/build:/home/peter/projects/haskell/ghc-
validate/libraries/array/dist-install/build:/home/peter/projects/haskell
/ghc-validate/libraries/base/dist-
install/build:/home/peter/projects/haskell/ghc-validate/libraries/integer-
gmp/dist-install/build:/home/peter/projects/haskell/ghc-validate/libraries
/ghc-prim/dist-install/build:/home/peter/projects/haskell/ghc-
validate/rts/dist/build]
0x000000000000001d (RUNPATH) Library runpath:
[/home/peter/projects/haskell/ghc-validate/libraries/process/dist-
install/build:/home/peter/projects/haskell/ghc-
validate/libraries/directory/dist-
install/build:/home/peter/projects/haskell/ghc-validate/libraries/unix
/dist-install/build:/home/peter/projects/haskell/ghc-
validate/libraries/bytestring/dist-
install/build:/home/peter/projects/haskell/ghc-validate/libraries/time
/dist-install/build:/home/peter/projects/haskell/ghc-validate/libraries
/old-locale/dist-install/build:/home/peter/projects/haskell/ghc-
validate/libraries/filepath/dist-
install/build:/home/peter/projects/haskell/ghc-validate/libraries/deepseq
/dist-install/build:/home/peter/projects/haskell/ghc-
validate/libraries/array/dist-install/build:/home/peter/projects/haskell
/ghc-validate/libraries/base/dist-
install/build:/home/peter/projects/haskell/ghc-validate/libraries/integer-
gmp/dist-install/build:/home/peter/projects/haskell/ghc-validate/libraries
/ghc-prim/dist-install/build:/home/peter/projects/haskell/ghc-
validate/rts/dist/build]
0x000000000000000c (INIT) 0x401c00
[snip]
}}}
The default on openSUSE's binutils is to {{{--enable-new-dtags}}} for ld.
Then shared libraries will have both RUNPATH and RPATH. If I understand a
discussion between Duncan Coutts and Andrew Suffield right
[http://www.haskell.org/pipermail/cvs-ghc/2010-January/052251.html] then
RUNPATH overrides RPATH . So I needed to look at RUNPATH. RUNPATH is only
searched in the object that caused the load. Since {{{libHSdirectory}}}
does not contain a RUNPATH but needs {{{libHSunix}}} the latter cannot be
found. The RUNPATH in {{{process001}}} will not be searched as
{{{process001}}} does not (directly) load {{{libHSunix}}} as a consequence
of {{{--asneeded}}}.
A temporary solution would be to add {{{--disable-new-dtags}}} to the
linker flags in {{{settings}}}. I'll prepare a patch for this and add it
to the ticket.
Long term we should consider adding RUNPATHs to all libraries as Duncan
suggested in the above posting.
> > This matches nus' results with readelf above. In number 2) note that
libHSunix... is missing in {{{readelf -d process001}}} output. That means
the Rpath to libHSunix... is also not included in process001 and hence the
"No such file or directory."
> Perhaps you're checking a different executable? Here RPATH of the
produced executable has the path to the directory containing `HSunix`:
What I said about RPATH was wrong. My RPATH looks exactly like yours.
Sorry about the confusion.
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/7062#comment:13>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the Glasgow-haskell-bugs
mailing list