[Lazarus] Deploying application with librarys

michael.vancanneyt at wisa.be michael.vancanneyt at wisa.be
Tue Aug 7 10:56:30 CEST 2012



On Tue, 7 Aug 2012, Krzysztof wrote:

> Hi,
>
> I have application which use openal.dll / openal.so library.
>
> On windows this is easy and clear. I just put all files into InnoSetup
> installer and my application find DLL in own directory.
>
> But what with linux? I have installation script which:
>
> - Copy executable to /usr/bin
> - Copy icons to /usr/share/icons
> - Add application to desktop menu bo copying .destkop file to
> /usr/share/applications
>
> I also have uninstall script which delete those files.
>
> But don't know what to do with openal.so library. Should I copy it to
> /usr/lib directory? But what if:
>
> - This library already exists (installed e.g by apt-get install
> libopenal) and my uninstall script try to delete it?
> - This library doesn't exists an my install script copy it to lib
> directory and then user try to install it by apt-get install
> libopenal. What will happen?
>
> Can I create some my application dir in /usr/bin where I copy all
> files with librarys and only my application manage those librarys?
>
> BTW: How linux librarys works? I mean, how portable application works.
> If I run executable from unzipped folder, this application find .SO
> library in that folder? (like on windows) Or must I create run.sh
> script which export this path?

You should not do it like this. Never every copy files to /usr/lib or so.
If the user decides to install openal later, it will conflict with your
install.

If your app requires openal/sdl or whatever, make sure that these libraries
are installed through the packaging system. Either make a debian/rpm package, 
and add it to the dependencies.

If you want to create a script that installs it anyway, make sure it
installs in to /opt/yourprogram/
with directories
bin
lib

Libraries go into lib. 
Then create a startup shell script in /opt/yourprogram/bin that adds 
/opt/yourprogram/lib
to the
LD_LIBRARY_PATH 
environment variable, after which it starts the real binary.
(the installer should create this script)

Make a symlink to this shell script in /usr/bin or /usr/local/bin.

It's by far the easiest system.

Michael.




More information about the Lazarus mailing list