[CMake] Installation package

Eric Noulard eric.noulard at gmail.com
Wed Jun 10 05:03:56 EDT 2009


2009/6/10 Mathieu Malaterre <mathieu.malaterre at gmail.com>:
> On Wed, Jun 10, 2009 at 10:17 AM, Pascale B<chose29 at hotmail.com> wrote:
>> Hi,
>>
>>    I work on a software that I am porting onto Linux. I used CMake with
>> success and now want to use CPack. I successfully created a package file
>> with a bin and lib path, both containing the exec file and the .so libraries
>> needed.
>>
>>    Now  here is my problem: when I send this package to a user, after he
>> unzips the package, he needs to move the shared libraries to the /usr/lib
>> directory and proceed with the ldconfig command, otherwise when launching
>> the exec file the shared libraries aren't found.
>>
>>    Is there a way to automatically do this? I can't find it in the doc or in
>> mailing lists either. Should a makefile be included with the package that
>> would proceed with the installation or does it need to be done manually each
>> time?
>
> No this is standard UNIX mechanism. On Win32 system, executables will
> look for dll within the same directory and simple packaging works out
> of the box.
> The closest thing to reproduce this mechanism on *nix system is
> implemented within kwsys (see SharedForward.h.in). Please note that
> this is an invasive solution.
>
> A user can simply extent the LD_LIBRARY_PATH to accommodate for your
> particular package, else you have to install you lib in system path
> (/usr/lib for example).

I did not see this as Mathieu did, in fact this is another solution,
pursuing the same idea
May be you can use Full RPATH:

http://www.cmake.org/Wiki/CMake_RPATH_handling#Always_full_RPATH

Another "easy" solution would be to ship with your executable(s) a simple
(shell) script wrapper, let's call it runme.sh, which may run any of
your executable by doing automatically updating the LD_LIBRARY_PATH.

assume your software is always installed like this

<varbase>/bin/runme.sh
<varbase>/bin/me
<varbase>/lib/lib4me.so

if you do

runme.sh me

then you will obtain something like:
$ runme.sh me.sh
I am </home/eric/Test/bin/runme.sh> and my full path is </home/eric/Test/bin>
Setting LD_LIBRARY_PATH to <:/home/eric/Test/lib>
Executing <me.sh>...
Hi that's me.

I join the runme.sh and me.sh example, in my case I have no executable
and lib4me.so
but it should work in this case too, whereever you put  /lib and /bin
dirs as soon
as you /bin is in the path.

Note that letting user playing with LD_LIBRARY_PATH with your
application is generally
a security breach but security may not be your primary objective.

-- 
Erk
-------------- next part --------------
A non-text attachment was scrubbed...
Name: runme.sh
Type: application/x-sh
Size: 406 bytes
Desc: not available
URL: <http://www.cmake.org/pipermail/cmake/attachments/20090610/c5a79c91/attachment.sh>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: me.sh
Type: application/x-sh
Size: 30 bytes
Desc: not available
URL: <http://www.cmake.org/pipermail/cmake/attachments/20090610/c5a79c91/attachment-0001.sh>


More information about the CMake mailing list