[PATCH] fix runtests to set LD_LIBRARY_PATH environment variable

Simon Marlow marlowsd at gmail.com
Fri Jan 25 21:40:57 CET 2013


On 25/01/13 19:12, Karel Gardas wrote:
>
> Hi Simon,
>
> it's simple, every lib is rpath-ed except the libffi. See:

Then that sounds like a bug, no?  I'm not up to speed on this rpath 
stuff, maybe Ian knows what's going on.  I'd rather not hide the bug by 
committing a workaround to the testsuite.

Cheers,
	Simon




> End of readFile001 compilation with -v looks:
>
> *** Linker:
> /usr/sfw/bin/gcc -DTABLES_NEXT_TO_CODE -o readFile001 readFile001.o
> -L/export/home/karel/vcs/ghc-src/ghc-head/libraries/base/dist-install/build
> -Wl,-rpath
> -Wl,/export/home/karel/vcs/ghc-src/ghc-head/libraries/base/dist-install/build
> -L/export/home/karel/vcs/ghc-src/ghc-head/libraries/integer-gmp/dist-install/build
> -Wl,-rpath
> -Wl,/export/home/karel/vcs/ghc-src/ghc-head/libraries/integer-gmp/dist-install/build
> -L/export/home/karel/vcs/ghc-src/ghc-head/libraries/ghc-prim/dist-install/build
> -Wl,-rpath
> -Wl,/export/home/karel/vcs/ghc-src/ghc-head/libraries/ghc-prim/dist-install/build
> -L/export/home/karel/vcs/ghc-src/ghc-head/rts/dist/build -Wl,-rpath
> -Wl,/export/home/karel/vcs/ghc-src/ghc-head/rts/dist/build
> /tmp/ghc28147_0/ghc28147_0.o -lHSbase-4.7.0.0-ghc7.7.20130125
> -lHSinteger-gmp-0.5.1.0-ghc7.7.20130125 -lgmp
> -lHSghc-prim-0.3.1.0-ghc7.7.20130125 -lHSrts-ghc7.7.20130125 -lm -lrt
> -ldl -u ghczmprim_GHCziTypes_Izh_static_info -u
> ghczmprim_GHCziTypes_Czh_static_info -u
> ghczmprim_GHCziTypes_Fzh_static_info -u
> ghczmprim_GHCziTypes_Dzh_static_info -u base_GHCziPtr_Ptr_static_info -u
> ghczmprim_GHCziTypes_Wzh_static_info -u base_GHCziInt_I8zh_static_info
> -u base_GHCziInt_I16zh_static_info -u base_GHCziInt_I32zh_static_info -u
> base_GHCziInt_I64zh_static_info -u base_GHCziWord_W8zh_static_info -u
> base_GHCziWord_W16zh_static_info -u base_GHCziWord_W32zh_static_info -u
> base_GHCziWord_W64zh_static_info -u
> base_GHCziStable_StablePtr_static_info -u
> ghczmprim_GHCziTypes_Izh_con_info -u ghczmprim_GHCziTypes_Czh_con_info
> -u ghczmprim_GHCziTypes_Fzh_con_info -u
> ghczmprim_GHCziTypes_Dzh_con_info -u base_GHCziPtr_Ptr_con_info -u
> base_GHCziPtr_FunPtr_con_info -u base_GHCziStable_StablePtr_con_info -u
> ghczmprim_GHCziTypes_False_closure -u ghczmprim_GHCziTypes_True_closure
> -u base_GHCziPack_unpackCString_closure -u
> base_GHCziIOziException_stackOverflow_closure -u
> base_GHCziIOziException_heapOverflow_closure -u
> base_ControlziExceptionziBase_nonTermination_closure -u
> base_GHCziIOziException_blockedIndefinitelyOnMVar_closure -u
> base_GHCziIOziException_blockedIndefinitelyOnSTM_closure -u
> base_ControlziExceptionziBase_nestedAtomically_closure -u
> base_GHCziWeak_runFinalizzerBatch_closure -u
> base_GHCziTopHandler_flushStdHandles_closure -u
> base_GHCziTopHandler_runIO_closure -u
> base_GHCziTopHandler_runNonIO_closure -u
> base_GHCziConcziIO_ensureIOManagerIsRunning_closure -u
> base_GHCziConcziSync_runSparks_closure -u
> base_GHCziConcziSignal_runHandlers_closure
> link: done
> *** Deleting temp files:
> Deleting: /tmp/ghc28147_0/ghc28147_0.o /tmp/ghc28147_0/ghc28147_0.c
> *** Deleting temp dirs:
> Deleting: /tmp/ghc28147_0
>
>
> there is no libffi linked there as it's linked in RTS lib already. it's
> probably not rpath-ed there (for obvious reason) so ldd's output on the
> test looks:
>
> $ ldd readFile001
>      libHSbase-4.7.0.0-ghc7.7.20130125.so =>
> /export/home/karel/vcs/ghc-src/ghc-head/libraries/base/dist-install/build/libHSbase-4.7.0.0-ghc7.7.20130125.so
>
>      libHSinteger-gmp-0.5.1.0-ghc7.7.20130125.so =>
> /export/home/karel/vcs/ghc-src/ghc-head/libraries/integer-gmp/dist-install/build/libHSinteger-gmp-0.5.1.0-ghc7.7.20130125.so
>
>      libgmp.so.3 =>     /usr/lib/libgmp.so.3
>      libHSghc-prim-0.3.1.0-ghc7.7.20130125.so =>
> /export/home/karel/vcs/ghc-src/ghc-head/libraries/ghc-prim/dist-install/build/libHSghc-prim-0.3.1.0-ghc7.7.20130125.so
>
>      libHSrts-ghc7.7.20130125.so =>
> /export/home/karel/vcs/ghc-src/ghc-head/rts/dist/build/libHSrts-ghc7.7.20130125.so
>
>      libm.so.2 =>     /lib/libm.so.2
>      librt.so.1 =>     /lib/librt.so.1
>      libdl.so.1 =>     /lib/libdl.so.1
>      libc.so.1 =>     /lib/libc.so.1
>      libgcc_s.so.1 =>     /usr/lib/libgcc_s.so.1
>      libffi.so.6 =>     (file not found)
>
>
> And of course for the purpose of the test I've unset LD_LIBRARY_PATH
> completely:
> karel at silence:~/vcs/ghc-src/ghc-head/libraries/base/tests/IO$ echo
> $LD_LIBRARY_PATH
>
> karel at silence:~/vcs/ghc-src/ghc-head/libraries/base/tests/IO$
>
>
> So that's why I've thought my solution of setting LD_LIBRARY_PATH in
> runtests is the most easiest one but if you prefer something different
> just let me know.
>
> Thanks!
> Karel
>
> On 01/25/13 09:02 AM, Simon Marlow wrote:
>> Hold on a minute. Why do you need to set LD_LIBRARY_PATH? It should be
>> unnecessary because the binaries are linked with -rpath options so they
>> can find their libraries.
>>
>> Cheers,
>> Simon
>>
>> On 25/01/13 01:33, David Terei wrote:
>>> Committed. Thanks!
>>>
>>> On 24 January 2013 13:28, Karel Gardas <karel.gardas at centrum.cz> wrote:
>>>> This patch follows Windows and Darwin way of setting environment
>>>> variable
>>>> to set the file-system paths to GHC's shared libraries. It does the
>>>> same
>>>> thing for any other OS, which should be Unix-like OS presumably. This
>>>> patch fixes a lot of `dyn' tests failures on Solaris which fail with
>>>> following
>>>> error message:
>>>> Failed to open shared library: ld.so.1: T3807-load: fatal:
>>>> libffi.so.6: open failed: No such file or directory
>>>> ---
>>>> driver/runtests.py | 48
>>>> ++++++++++++++++++++++++++----------------------
>>>> 1 files changed, 26 insertions(+), 22 deletions(-)
>>>>
>>>> diff --git a/driver/runtests.py b/driver/runtests.py
>>>> index 66e3bf4..16deda6 100644
>>>> --- a/driver/runtests.py
>>>> +++ b/driver/runtests.py
>>>> @@ -181,28 +181,32 @@ from testlib import *
>>>>
>>>> # On Windows we need to set $PATH to include the paths to all the DLLs
>>>> # in order for the dynamic library tests to work.
>>>> -if windows or darwin:
>>>> - pkginfo = getStdout([config.ghc_pkg, 'dump'])
>>>> - topdir = config.libdir
>>>> - for line in pkginfo.split('\n'):
>>>> - if line.startswith('library-dirs:'):
>>>> - path = line.rstrip()
>>>> - path = re.sub('^library-dirs: ', '', path)
>>>> - path = re.sub('\\$topdir', topdir, path)
>>>> - if path.startswith('"'):
>>>> - path = re.sub('^"(.*)"$', '\\1', path)
>>>> - path = re.sub('\\\\(.)', '\\1', path)
>>>> - if windows:
>>>> - if config.cygwin:
>>>> - # On cygwin we can't put "c:\foo" in $PATH, as : is a
>>>> - # field separator. So convert to /cygdrive/c/foo instead.
>>>> - # Other pythons use ; as the separator, so no problem.
>>>> - path = re.sub('([a-zA-Z]):', '/cygdrive/\\1', path)
>>>> - path = re.sub('\\\\', '/', path)
>>>> - os.environ['PATH'] = os.pathsep.join([path, os.environ.get("PATH",
>>>> "")])
>>>> - else:
>>>> - # darwin
>>>> - os.environ['DYLD_LIBRARY_PATH'] = os.pathsep.join([path,
>>>> os.environ.get("DYLD_LIBRARY_PATH", "")])
>>>> +# if windows or darwin:
>>>> +pkginfo = getStdout([config.ghc_pkg, 'dump'])
>>>> +topdir = config.libdir
>>>> +for line in pkginfo.split('\n'):
>>>> + if line.startswith('library-dirs:'):
>>>> + path = line.rstrip()
>>>> + path = re.sub('^library-dirs: ', '', path)
>>>> + path = re.sub('\\$topdir', topdir, path)
>>>> + if path.startswith('"'):
>>>> + path = re.sub('^"(.*)"$', '\\1', path)
>>>> + path = re.sub('\\\\(.)', '\\1', path)
>>>> + if windows:
>>>> + if config.cygwin:
>>>> + # On cygwin we can't put "c:\foo" in $PATH, as : is a
>>>> + # field separator. So convert to /cygdrive/c/foo instead.
>>>> + # Other pythons use ; as the separator, so no problem.
>>>> + path = re.sub('([a-zA-Z]):', '/cygdrive/\\1', path)
>>>> + path = re.sub('\\\\', '/', path)
>>>> + os.environ['PATH'] = os.pathsep.join([path, os.environ.get("PATH",
>>>> "")])
>>>> + elif darwin:
>>>> + # darwin
>>>> + os.environ['DYLD_LIBRARY_PATH'] = os.pathsep.join([path,
>>>> os.environ.get("DYLD_LIBRARY_PATH", "")])
>>>> + else:
>>>> + # unix
>>>> + os.environ['LD_LIBRARY_PATH'] = os.pathsep.join([path,
>>>> os.environ.get("LD_LIBRARY_PATH", "")])
>>>> +
>>>>
>>>> global testopts_local
>>>> testopts_local.x = TestOptions()
>>>> --
>>>> 1.7.3.2
>>>>
>>>>
>>>> _______________________________________________
>>>> ghc-devs mailing list
>>>> ghc-devs at haskell.org
>>>> http://www.haskell.org/mailman/listinfo/ghc-devs
>>>
>>> _______________________________________________
>>> ghc-devs mailing list
>>> ghc-devs at haskell.org
>>> http://www.haskell.org/mailman/listinfo/ghc-devs
>>>
>>
>>
>




More information about the ghc-devs mailing list