kdebindings, generator, LD_LIBRARY_PATH

Alexander Neundorf neundorf at kde.org
Sat Oct 31 21:47:38 CET 2009


On Saturday 31 October 2009, Yury G. Kudryashov wrote:
> On Saturday 31 October 2009 20:45:16 you wrote:
> > On Friday 30 October 2009, Yury G. Kudryashov wrote:
> > > Hi!
> > > if( UNIX )
> > >    # Generator library is used during compilation. If some environment
> > > not # have previous kdebindings installed, will fail, then we need add
> > > local path
> > >    set( ENV{LD_LIBRARY_PATH} ${CMAKE_CURRENT_BINARY_DIR}/generator/bin
> > > ) endif( UNIX )
> >
> > If you set(ENV{FOO} bar) in a CMakeLists.txt, this sets the env.var FOO
> > at the moment when this command is executed, i.e. at cmake-time. This
> > means it won't be set later at build time (when the makefiles are
> > executed).
>
> Yes, I've read about this before sending e-mail.
>
> > You may file a feature request to support an ENVIRONMENT argument so that
> >  it is possible to set env.vars for the executed process.
> >
> > What's going wrong without this patch ?
>
> The generator fails to load plugin
> BUILD_DIR/generator/bin/generator_smoke.so at build (make) time. It uses
> QLibrary lib("generator_smoke"); lib.load().

Can you tell QLibrary to search in an additional directory ?

You could add a command line argument to the generator where you can specifiy 
one or more additional plugin directories, and then give this to QLibrary,
something like $ generator -plugin_dir=${CMAKE_CURRENT_BINARY_DIR}

If that's not directly possible, you could do a setenv(LD_LIBRARY_PATH ...) in 
the generator executable when such an extra search path has been specified.

Alternatively, if you don't want to modify the generator, you could use a 
wrapper script. E.g. in kdelibs/cmake/modules/KDE4Macros.cmake, 
KDE4_HANDLE_RPATH_FOR_EXECUTABLE() this is done for every executable created 
via KDE4_ADD_EXECUTABLE(), for the case that KDE4 is built with RPATH 
completely disabled and still some executables have to be executed during the 
build.

> > So I assume that the patch actually does nothing at all, it neither fixes
> >  or breaks something.
>
> Yes, this patch does nothing.

Can you please revert it then ?

Alex



More information about the Kde-buildsystem mailing list