[CMake] ctest puts LD_LIBRARY_PATH into environment impacts sub-runs of cmake/ctest

Bill Hoffman bill.hoffman at kitware.com
Mon Sep 8 15:48:50 EDT 2008


Wheeler, Frederick W (GE, Research) wrote:
> CMake List:
> 
> I have a ctest/cmake issue where LD_LIBRARY_PATH must be set to run
> test execs produced by ctest but that LD_LIBRARY_PATH setting causes
> ctest/cmake to not run due to a library mismatch.  Does anyone have a
> solution or any advice?  Details below.
> 
> After a recent upgrade to FreeBSD 7.0, using cmake/ctest compiled from
> the FreeBSD /usr/ports using the system gcc (4.2.1), but using a
> non-system gcc installed in /home/wheeler/dev/gcc-4.0.4 as the
> compiler for the VXL project being built by cmake/ctest, I'm getting
> errors like this when I run ctest:
> 
> /libexec/ld-elf.so.1: /home/wheeler/dev/gcc-4.0.4/lib/libstdc++.so.6:
> version GLIBCXX_3.4.9 required by cmake not found
> /libexec/ld-elf.so.1: /home/wheeler/dev/gcc-4.0.4/lib/libstdc++.so.6:
> version GLIBCXX_3.4.9 required by ctest not found
> Unable to run cmake:
> /libexec/ld-elf.so.1: /home/wheeler/dev/gcc-4.0.4/lib/libstdc++.so.6:
> version GLIBCXX_3.4.9 required by cmake not found
> 
> The file /home/wheeler/dev/gcc-4.0.4/lib/libstdc++.so.6 is present,
> but apparently it is not version GLIBCXX_3.4.9.
> 
> In my ctest config file I use CTEST_ENVIRONMENT to set LD_LIBRARY_PATH
> like you see below because that LD_LIBRARY_PATH setting is needed to
> run test executables created by the ctest run.  LD_LIBRARY_PATH is not
> set in the environment when ctest is run initially.
> 
> SET(CTEST_ENVIRONMENT
>   "LD_LIBRARY_PATH=/home/wheeler/dev/gcc-4.0.4/lib"
>   "CVS_RSH=ssh"
>   "http_proxy=proxy.research.ge.com:8080"
>   "FTP_PROXY=proxy.research.ge.com:8080"
> )
> 
> The problem seems to be that this LD_LIBRARY_PATH setting is in the
> environment when ctest runs cmake and ctest (ctest running itself I
> guess), and this causes those programs to not run.  I think a solution
> might be for ctest to put the contents of CTEST_ENVIRONMENT into the
> environment when running 'make' or one of the tests, but not when it
> is running cmake or ctest.  This, however sounds like a difficult fix.
> 

Not sure if this will work, but....

If you used the command based ctest scripts, you have much more control 
of when the env vars are set.

This came up recently in a bug report:
http://public.kitware.com/Bug/view.php?id=4954

Basically, you want something like this:

CTEST_START (Nightly)
CTEST_UPDATE (SOURCE "${CTEST_SOURCE_DIRECTORY}")
CTEST_CONFIGURE (BUILD "${CTEST_BINARY_DIRECTORY}")
CTEST_READ_CUSTOM_FILES("${CTEST_BINARY_DIRECTORY}")
CTEST_BUILD (BUILD "${CTEST_BINARY_DIRECTORY}")
SET(ENV{LD_LIBRARY_PATH} "...=....")
CTEST_TEST (BUILD "${CTEST_BINARY_DIRECTORY}")
CTEST_SUBMIT ()

That will use the LD_LIBRARY_PATH for just the tests.  You can keep it 
out of the configure step if you need to.

-Bill

-- 
Bill Hoffman
Kitware, Inc.
28 Corporate Drive
Clifton Park, NY 12065
bill.hoffman at kitware.com
http://www.kitware.com
518-371-3971 (phone and fax)


More information about the CMake mailing list