#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 nus):

 Replying to [comment:8 trommler]:
 > Replying to [comment:7 simonmar]:
 > > @trommler does the patch fix it for you?
 > Yes, it fixes the linker issue.
 >
 > The test, however, still fails for me. Now libHSunix*.so cannot be
 found:
 >
 > {{{
 > =====> process001(dyn) 1 of 13 [0, 0, 0]
 > cd . && '/local/home/peter/ghc-HEAD-validate/inplace/bin/ghc-stage2'
 -fforce-recomp -dcore-lint -dcmm-lint -dno-debug-output -no-user-package-
 db -rtsopts  -fno-ghci-history -o process001 process001.hs -O -dynamic
 >process001.comp.stderr 2>&1
 > cd . && ./process001    </dev/null >process001.run.stdout
 2>process001.run.stderr
 > Wrong exit code (expected 0 , actual 127 )
 > Stdout:
 >
 > Stderr:
 > ./process001: error while loading shared libraries:
 libHSunix-2.5.1.0-ghc7.5.20120713.so: cannot open shared object file: No
 such file or directory
 > }}}
 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.
 > 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`:
 {{{
 $ cd ~/dev/ghc-7.4.2/libraries/process/tests
 $ /home/user/dev/ghc-7.4.2/inplace/bin/ghc-stage2 -fforce-recomp -dcore-
 lint -dcmm-lint -dno-debug-output -no-user-package-conf -rtsopts  -fno-
 ghci-history -o process001 process001.hs -O -dynamic
 [1 of 1] Compiling Main             ( process001.hs, process001.o )
 Linking process001 ...
 $ readelf -d process001
 Dynamic section at offset 0x2d98 contains 25 entries:
   Tag        Type                         Name/Value
  0x0000000000000001 (NEEDED)             Shared library:
 [libHSprocess-1.1.0.1-ghc7.4.2.so]
  0x0000000000000001 (NEEDED)             Shared library:
 [libHSbase-4.5.1.0-ghc7.4.2.so]
  0x0000000000000001 (NEEDED)             Shared library: [libHSghc-
 prim-0.2.0.0-ghc7.4.2.so]
  0x0000000000000001 (NEEDED)             Shared library: [libHSrts-
 ghc7.4.2.so]
  0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]
  0x000000000000000f (RPATH)              Library rpath:
 [/home/user/dev/ghc-7.4.2/libraries/process/dist-
 install/build:/home/user/dev/ghc-7.4.2/libraries/directory/dist-
 install/build:/home/user/dev/ghc-7.4.2/libraries/unix/dist-
 install/build:/home/user/dev/ghc-7.4.2/libraries/bytestring/dist-
 install/build:/home/user/dev/ghc-7.4.2/libraries/old-time/dist-
 install/build:/home/user/dev/ghc-7.4.2/libraries/old-locale/dist-
 install/build:/home/user/dev/ghc-7.4.2/libraries/filepath/dist-
 install/build:/home/user/dev/ghc-7.4.2/libraries/base/dist-
 install/build:/home/user/dev/ghc-7.4.2/libraries/integer-gmp/dist-
 install/build:/home/user/dev/ghc-7.4.2/libraries/ghc-prim/dist-
 install/build:/home/user/dev/ghc-7.4.2/rts/dist/build]
 [...snip...]
 }}}

 From the libraries involved in the link, produced after applying the
 patch, `HSprocess`, `HSdirectory`, `HSunix`, only `HSunix` and
 `HSdirectory` have changed their DT_NEEDED tags in the dynamic sections,
 `HSprocess` remains same.
 {{{
 --- non-patched-elf-HSdirectory.so      2012-07-26 07:20:31.783083933
 +0400
 +++ patched-elf-HSdirectory.so  2012-07-26 09:26:01.773447158 +0400
 @@ -1,9 +1,7 @@

 -Dynamic section at offset 0x1a9e8 contains 30 entries:
 +Dynamic section at offset 0x1aa08 contains 28 entries:
    Tag        Type                         Name/Value
   0x0000000000000001 (NEEDED)             Shared library:
 [libHSunix-2.5.1.1-ghc7.4.2.so]
 - 0x0000000000000001 (NEEDED)             Shared library: [libutil.so.1]
 - 0x0000000000000001 (NEEDED)             Shared library: [libdl.so.2]
 [...snip...]
 }}}
 {{{
 --- non-patched-elf-HSunix.so   2012-07-26 07:20:27.843084217 +0400
 +++ patched-elf-HSunix.so       2012-07-26 09:25:44.133448671 +0400
 @@ -1,6 +1,9 @@

 -Dynamic section at offset 0xb1798 contains 26 entries:
 +Dynamic section at offset 0xb1768 contains 29 entries:
    Tag        Type                         Name/Value
 + 0x0000000000000001 (NEEDED)             Shared library: [libutil.so.1]
 + 0x0000000000000001 (NEEDED)             Shared library: [libdl.so.2]
 + 0x0000000000000001 (NEEDED)             Shared library:
 [libpthread.so.0]
 [...snip...]
 }}}

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/7062#comment:12>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler

_______________________________________________
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to