Page 1 of 1

Deploying applications?

Posted: Tue May 05, 2009 3:31 pm
by smishra
I have a PB application that I want to deploy to different Linux based appliances. I am using Ubuntu 9.04 to compile the application.

Is there an easy way to see which libraries the application needs

- put them up on a server
- the application download it automatically from the server if it is not found on the appliance

When I run ldd against the application I see a lot of libraries. I am sure many of them are installed, but I don't want to manually tweak each installation. Is there a tool that automates this process?

Posted: Mon May 11, 2009 3:14 pm
by bembulak
Just make a DEB- or RPM-package of your program.
Then the user can install it just like any other program via package-manager.

Which distribution are you developin' in and what is your main target?

Posted: Sat May 16, 2009 5:38 pm
by Num3
I'm at the same problem, simple tar file or .deb package ...

I have a doubt: are PB linux executables dependency free or must it create a .deb package and point out all the necessary dependencies??

If so, how can i find which libraries are really needed :?

Posted: Sat May 16, 2009 9:35 pm
by bembulak
If you can wait a few days:
I'll try to write a tutorial how to build .deb packages for Ubuntu 9.04 based on PB executabels.
This includes finding out dependencies.

Promised.

Posted: Sun May 17, 2009 9:27 am
by Num3
SUPER! :o

Posted: Sun May 17, 2009 10:04 pm
by bembulak
First you've got to find out the dependencies of your program. I have tested this with two simple programs.

The first one is a simple console application:

Code: Select all

; program first
OpenConsole()

PrintN("Just a Test!")

CloseConsole()
End
Whe you compile this to an executable (don't forget to put executable format to 'Console' in the compiler options) you'll get a very small binary:

Code: Select all

-rwxr-xr-x 1 bembulak bembulak  5440 2009-05-17 22:26 console_simple
Actually it's only 5,3 kib!
Next thing is to get the dependencies:

Code: Select all

ldd console_simple
	linux-gate.so.1 =>  (0xb80bd000)
	libc.so.6 => /lib/tls/i686/cmov/libc.so.6 (0xb7f49000)
	/lib/ld-linux.so.2 (0xb80be000)
(Note: I've compiled a basic "Hello World!"-programm with GCC 4.3.3 and it has completely the same dependencies, but is BIGGER --> 7,4 kiB! Therefore we know that PB does not load or link any unneeded stuff and Fred & freak do a great job!)

Building a package of this should be an easy task. I guess this will run on any common Linux system - you won't need to build a package.

Now, let's see, if we can build something more spectacular:
I've done same as above with the "GadgetAdvanced"-Demo. Take a look at it from bash shows the following:

Code: Select all

-rwxr-xr-x 1 bembulak bembulak 72444 2009-05-17 22:28 GadgetAdvanced
Filesize 70,7 kib.

Basically it's to say, that a common PB programm with GUI has the following dependencies:
GTK2. ;)
If you have this dependency solved on your system, you can be sure, the sub-dependencies to libs, that GTK may have, are solved as well.
For example, calling ldd on our demo gives us:

Code: Select all

ldd GadgetAdvanced 
	linux-gate.so.1 =>  (0xb7f42000)
	libgtk-x11-2.0.so.0 => /usr/lib/libgtk-x11-2.0.so.0 (0xb7b80000)
	libgdk-x11-2.0.so.0 => /usr/lib/libgdk-x11-2.0.so.0 (0xb7af3000)
	libatk-1.0.so.0 => /usr/lib/libatk-1.0.so.0 (0xb7ad7000)
	libpangoft2-1.0.so.0 => /usr/lib/libpangoft2-1.0.so.0 (0xb7aae000)
	libgdk_pixbuf-2.0.so.0 => /usr/lib/libgdk_pixbuf-2.0.so.0 (0xb7a94000)
	libm.so.6 => /lib/tls/i686/cmov/libm.so.6 (0xb7a6e000)
	libpangocairo-1.0.so.0 => /usr/lib/libpangocairo-1.0.so.0 (0xb7a62000)
	libgio-2.0.so.0 => /usr/lib/libgio-2.0.so.0 (0xb79f3000)
	libcairo.so.2 => /usr/lib/libcairo.so.2 (0xb7979000)
	libpango-1.0.so.0 => /usr/lib/libpango-1.0.so.0 (0xb7936000)
	libfreetype.so.6 => /usr/lib/libfreetype.so.6 (0xb78bf000)
	libfontconfig.so.1 => /usr/lib/libfontconfig.so.1 (0xb7892000)
	libgobject-2.0.so.0 => /usr/lib/libgobject-2.0.so.0 (0xb7853000)
	libgmodule-2.0.so.0 => /usr/lib/libgmodule-2.0.so.0 (0xb784e000)
	libglib-2.0.so.0 => /usr/lib/libglib-2.0.so.0 (0xb7796000)
	libgthread-2.0.so.0 => /usr/lib/libgthread-2.0.so.0 (0xb7790000)
	librt.so.1 => /lib/tls/i686/cmov/librt.so.1 (0xb7787000)
	libpthread.so.0 => /lib/tls/i686/cmov/libpthread.so.0 (0xb776d000)
	libc.so.6 => /lib/tls/i686/cmov/libc.so.6 (0xb760a000)
	libXext.so.6 => /usr/lib/libXext.so.6 (0xb75fa000)
	libXrender.so.1 => /usr/lib/libXrender.so.1 (0xb75f0000)
	libXinerama.so.1 => /usr/lib/libXinerama.so.1 (0xb75ed000)
	libXi.so.6 => /usr/lib/libXi.so.6 (0xb75e2000)
	libXrandr.so.2 => /usr/lib/libXrandr.so.2 (0xb75da000)
	libXcursor.so.1 => /usr/lib/libXcursor.so.1 (0xb75d1000)
	libX11.so.6 => /usr/lib/libX11.so.6 (0xb74e2000)
	libXcomposite.so.1 => /usr/lib/libXcomposite.so.1 (0xb74de000)
	libXdamage.so.1 => /usr/lib/libXdamage.so.1 (0xb74db000)
	libXfixes.so.3 => /usr/lib/libXfixes.so.3 (0xb74d5000)
	libz.so.1 => /lib/libz.so.1 (0xb74bf000)
	/lib/ld-linux.so.2 (0xb7f43000)
	libdl.so.2 => /lib/tls/i686/cmov/libdl.so.2 (0xb74bb000)
	libpcre.so.3 => /lib/libpcre.so.3 (0xb7489000)
	libselinux.so.1 => /lib/libselinux.so.1 (0xb746f000)
	libpixman-1.so.0 => /usr/lib/libpixman-1.so.0 (0xb742b000)
	libdirectfb-1.0.so.0 => /usr/lib/libdirectfb-1.0.so.0 (0xb73c5000)
	libfusion-1.0.so.0 => /usr/lib/libfusion-1.0.so.0 (0xb73bc000)
	libdirect-1.0.so.0 => /usr/lib/libdirect-1.0.so.0 (0xb73a7000)
	libpng12.so.0 => /usr/lib/libpng12.so.0 (0xb7381000)
	libxcb-render-util.so.0 => /usr/lib/libxcb-render-util.so.0 (0xb737b000)
	libxcb-render.so.0 => /usr/lib/libxcb-render.so.0 (0xb7373000)
	libxcb.so.1 => /usr/lib/libxcb.so.1 (0xb7359000)
	libexpat.so.1 => /usr/lib/libexpat.so.1 (0xb7332000)
	libXau.so.6 => /usr/lib/libXau.so.6 (0xb732e000)
	libXdmcp.so.6 => /usr/lib/libXdmcp.so.6 (0xb7328000)
Pretty long list, yes. But these are very common libs for Linux. If you run something with Gnome-Desktop-Enviroment, the deps should be solved.
Try the same on "gedit", Gnome's standard Text editor:

Code: Select all

ldd gedit
	linux-gate.so.1 =>  (0xb7f19000)
	libxml2.so.2 => /usr/lib/libxml2.so.2 (0xb7dcc000)
	libgthread-2.0.so.0 => /usr/lib/libgthread-2.0.so.0 (0xb7dc6000)
	liblaunchpad-integration.so.1 => /usr/lib/liblaunchpad-integration.so.1 (0xb7dc0000)
	libgtksourceview-2.0.so.0 => /usr/lib/libgtksourceview-2.0.so.0 (0xb7d7f000)
	libgtk-x11-2.0.so.0 => /usr/lib/libgtk-x11-2.0.so.0 (0xb79ce000)
	libgdk-x11-2.0.so.0 => /usr/lib/libgdk-x11-2.0.so.0 (0xb7941000)
	libatk-1.0.so.0 => /usr/lib/libatk-1.0.so.0 (0xb7926000)
	libgdk_pixbuf-2.0.so.0 => /usr/lib/libgdk_pixbuf-2.0.so.0 (0xb790b000)
	libm.so.6 => /lib/tls/i686/cmov/libm.so.6 (0xb78e5000)
	libgio-2.0.so.0 => /usr/lib/libgio-2.0.so.0 (0xb7877000)
	libcairo.so.2 => /usr/lib/libcairo.so.2 (0xb77fd000)
	libpango-1.0.so.0 => /usr/lib/libpango-1.0.so.0 (0xb77ba000)
	libgobject-2.0.so.0 => /usr/lib/libgobject-2.0.so.0 (0xb777b000)
	libgmodule-2.0.so.0 => /usr/lib/libgmodule-2.0.so.0 (0xb7776000)
	libgconf-2.so.4 => /usr/lib/libgconf-2.so.4 (0xb7744000)
	libglib-2.0.so.0 => /usr/lib/libglib-2.0.so.0 (0xb768c000)
	libSM.so.6 => /usr/lib/libSM.so.6 (0xb7683000)
	libattr.so.1 => /lib/libattr.so.1 (0xb767c000)
	libpthread.so.0 => /lib/tls/i686/cmov/libpthread.so.0 (0xb7663000)
	libc.so.6 => /lib/tls/i686/cmov/libc.so.6 (0xb7500000)
	libX11.so.6 => /usr/lib/libX11.so.6 (0xb7411000)
	libICE.so.6 => /usr/lib/libICE.so.6 (0xb73f9000)
	libdl.so.2 => /lib/tls/i686/cmov/libdl.so.2 (0xb73f5000)
	libz.so.1 => /lib/libz.so.1 (0xb73de000)
	librt.so.1 => /lib/tls/i686/cmov/librt.so.1 (0xb73d5000)
	libpcre.so.3 => /lib/libpcre.so.3 (0xb73a3000)
	libpangoft2-1.0.so.0 => /usr/lib/libpangoft2-1.0.so.0 (0xb737a000)
	libpangocairo-1.0.so.0 => /usr/lib/libpangocairo-1.0.so.0 (0xb736e000)
	libfreetype.so.6 => /usr/lib/libfreetype.so.6 (0xb72f7000)
	libfontconfig.so.1 => /usr/lib/libfontconfig.so.1 (0xb72c9000)
	libXext.so.6 => /usr/lib/libXext.so.6 (0xb72b9000)
	libXrender.so.1 => /usr/lib/libXrender.so.1 (0xb72af000)
	libXinerama.so.1 => /usr/lib/libXinerama.so.1 (0xb72ac000)
	libXi.so.6 => /usr/lib/libXi.so.6 (0xb72a2000)
	libXrandr.so.2 => /usr/lib/libXrandr.so.2 (0xb7299000)
	libXcursor.so.1 => /usr/lib/libXcursor.so.1 (0xb7290000)
	libXcomposite.so.1 => /usr/lib/libXcomposite.so.1 (0xb728c000)
	libXdamage.so.1 => /usr/lib/libXdamage.so.1 (0xb7289000)
	libXfixes.so.3 => /usr/lib/libXfixes.so.3 (0xb7284000)
	/lib/ld-linux.so.2 (0xb7f1a000)
	libselinux.so.1 => /lib/libselinux.so.1 (0xb7269000)
	libpixman-1.so.0 => /usr/lib/libpixman-1.so.0 (0xb7226000)
	libdirectfb-1.0.so.0 => /usr/lib/libdirectfb-1.0.so.0 (0xb71c0000)
	libfusion-1.0.so.0 => /usr/lib/libfusion-1.0.so.0 (0xb71b7000)
	libdirect-1.0.so.0 => /usr/lib/libdirect-1.0.so.0 (0xb71a2000)
	libpng12.so.0 => /usr/lib/libpng12.so.0 (0xb717b000)
	libxcb-render-util.so.0 => /usr/lib/libxcb-render-util.so.0 (0xb7176000)
	libxcb-render.so.0 => /usr/lib/libxcb-render.so.0 (0xb716e000)
	libxcb.so.1 => /usr/lib/libxcb.so.1 (0xb7154000)
	libORBit-2.so.0 => /usr/lib/libORBit-2.so.0 (0xb7101000)
	libdbus-glib-1.so.2 => /usr/lib/libdbus-glib-1.so.2 (0xb70e2000)
	libdbus-1.so.3 => /lib/libdbus-1.so.3 (0xb70aa000)
	libuuid.so.1 => /lib/libuuid.so.1 (0xb70a5000)
	libexpat.so.1 => /usr/lib/libexpat.so.1 (0xb707e000)
	libXau.so.6 => /usr/lib/libXau.so.6 (0xb707a000)
	libXdmcp.so.6 => /usr/lib/libXdmcp.so.6 (0xb7074000)
So: Gedit - Gnome's standard text editor has a longer list of dependencies than the PureBasic AdvancedGadget-Demo. I guess, when you write common Tools and Apps you can be sure they'll run perfect on your system.
It might be a bit different, when you use some external libs (*.so - files), API-Calls or PB's Database (ODBC) and 2D/Sprite/3D-functions.

To this point I don't tell anything new.
So, how to get to some package we can use on our lovley boxes?
I've been searching the web for some tutorials on building packages and the best ones are from debian/ubuntu-related websites.

English: https://wiki.ubuntu.com/PackagingGuide
German: http://wiki.ubuntuusers.de/Paketbau

I don't think that it's necessary to write a PB related tutorial on building packages when there are already such.
I'll try myself the next days and report some information.

Good night everyone!