LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 08-23-2010, 07:37 AM   #1
futlib
LQ Newbie
 
Registered: Aug 2010
Posts: 4

Rep: Reputation: 0
Packaging proprietary software for Linux


Hi,

we are working on an independent game and are planning to support Linux, but don't know how to best package it. Would you mind sharing your experience with us?

We want only a tar.gz archive for now. No distribution specific package, no installer. We also don't want to require the user to manually install required shared libraries, so we are shipping them. We cannot distribute the files across the filesystem as the FSHS would require, so it'll all go to /opt.

Do you know of any tools that aid in packaging for Linux with support for including shared libs? We use CMake for building, but it doesn't seem to support packaging.

Our game's (let's call it foo structure currently looks like this:
  • foo (binary)
  • data

For the package, we'll also need:
  • foo.sh
  • libs

The libs directory contains all required shared libraries. foo.sh is a shell script that sets LD_LIBRARY_PATH to include the libs directory and launches the binary.

For packaging the software, we have a shell script that does the following:
  1. Create a directory and copy foo.sh to it
  2. Invoke the build process and make install into the new directory
  3. Copy shared libraries from the filesystem
  4. Package everything as tar.gz

What do you think of this approach? Are you doing it in a similar way?

There are some problems: We have to hard code all dependencies twice (once in CMake, once in the packaging script) and we have to define the version number twice (once in the source code, once in the packaging script). Any ideas?

Furthermore, we have difficulties to determine which shared libraries to ship, ldd foo shows an awfully long list. How can we figure out which libraries are supposed to be part of a typical Linux distribution and which we'll have to ship? WorldOfGoo for instance ships only very few libraries.

We thought about picking a few distributions that we want to support (probably the top 4 from distrowatch) and see with what they ship. Is there a better way?
 
Old 08-23-2010, 08:27 AM   #2
grail
Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 7,689

Rep: Reputation: 1987Reputation: 1987Reputation: 1987Reputation: 1987Reputation: 1987Reputation: 1987Reputation: 1987Reputation: 1987Reputation: 1987Reputation: 1987Reputation: 1987
Quote:
We thought about picking a few distributions that we want to support (probably the top 4 from distrowatch) and see with what they ship. Is there a better way?
Not sure I can help on the rest, but sticking with the big 3:

rpm
apt-get
source

You probably will find it hard to wrong, plus other distros will then find a way to make this work with their packaging systems.
 
Old 08-23-2010, 12:18 PM   #3
Sergei Steshenko
Senior Member
 
Registered: May 2005
Posts: 4,481

Rep: Reputation: 453Reputation: 453Reputation: 453Reputation: 453Reputation: 453
Distribute as much as possible statically linked executable.
 
Old 08-23-2010, 06:00 PM   #4
iam_techno
Member
 
Registered: Aug 2006
Location: Oregon
Distribution: Ubuntu 9.04, Windows 7
Posts: 48

Rep: Reputation: 16
Sergei,

You might also look in to makeself http://megastep.org/makeself/. It is how id software and (I think) Epic Games packaged there stuff. It's a self extracting archive that can use either gzip or bzip2 compression and it'll all you to automatically run your make/install or whatever when installing.

Quote:
Furthermore, we have difficulties to determine which shared libraries to ship, ldd foo shows an awfully long list. How can we figure out which libraries are supposed to be part of a typical Linux distribution and which we'll have to ship? WorldOfGoo for instance ships only very few libraries.
Is there a way you could post or pastebin your ldd? Things like glibc, libGl are standard on about any Linux distro.

As far as prepackaging you game, I completely agree with grail:
rpm (Red Hat/Fedora-like systems)
deb (Debian/Ubuntu-like)
source (everything + BSD + Solaris- if you'd like)

You might also consider Slackware .lzma (I think) packages too.

Hope this helps.

iamtechno
 
Old 08-23-2010, 06:18 PM   #5
Sergei Steshenko
Senior Member
 
Registered: May 2005
Posts: 4,481

Rep: Reputation: 453Reputation: 453Reputation: 453Reputation: 453Reputation: 453
Quote:
Originally Posted by iam_techno View Post
Sergei,

You might also look in to makeself http://megastep.org/makeself/. ...
I don't think the issue of static vs dynamic linking is related to the script. My point was to make the product as little dependent on the Linux distro as possible.
 
Old 08-23-2010, 09:24 PM   #6
wje_lq
Member
 
Registered: Sep 2007
Location: Mariposa
Distribution: Debian lenny, Slackware 12
Posts: 809

Rep: Reputation: 178Reputation: 178
Quote:
Originally Posted by Sergei Steshenko View Post
Distribute as much as possible statically linked executable.
wje_lq likes this.
 
Old 08-23-2010, 09:34 PM   #7
iam_techno
Member
 
Registered: Aug 2006
Location: Oregon
Distribution: Ubuntu 9.04, Windows 7
Posts: 48

Rep: Reputation: 16
Quote:
Originally Posted by Sergei Steshenko View Post
I don't think the issue of static vs dynamic linking is related to the script. My point was to make the product as little dependent on the Linux distro as possible.
Makeself allows you to create a self extracting file like some of the installers on Windows. Whether you want to static or dynamic link your libraries is up to you. I was thinking that since you were making a proprietary product you would want to precompile as much as possible. This would just be one more distro dependent option.

Sorry for the confusion.

iamtechno
 
Old 08-23-2010, 09:41 PM   #8
Sergei Steshenko
Senior Member
 
Registered: May 2005
Posts: 4,481

Rep: Reputation: 453Reputation: 453Reputation: 453Reputation: 453Reputation: 453
Quote:
Originally Posted by wje_lq View Post
wje_lq likes this.
The latest somewhat off-topic (but still on-topic) discovery.

I am building a lot of FOSS stuff from sources with the intent to be independent of my Linux distro. The stock 'make' is v3.81. I built from sources make-3.82 and using it got hit by this:

Code:
make[4]: Entering directory `/mnt/sdb8/sergei/AFSWD_debug/build/gstreamer-0.10.30/docs/gst'
Makefile:939: *** missing separator (did you mean TAB instead of 8 spaces?).  Stop.
.

Indeed, it's 8 spaces instead of tab, though the stock 'make' somehow tolerates it. I decided to build from sources make-3.81 - the same version as the stock one. Still the same problem !

So, apparently the stock 'make' is somehow patched or whatever.

Thus, again, distribute your product in as much encapsulated form as possible, static linking being part of encapsulation.
 
Old 08-24-2010, 01:51 AM   #9
futlib
LQ Newbie
 
Registered: Aug 2010
Posts: 4

Original Poster
Rep: Reputation: 0
I can't really offer the source, since it's proprietary. There will also be deb and rpm packages someday, but I don't worry about the actual package format right now, tar.gz will do. I'm focusing on my problems with shared libraries.

I've found the awesome Linux Application Checker in the meantime, and I included most libraries it complains about, but the transitive dependencies are still a lot. The resulting binary does not work on Debian lenny - probably due to the newer versions of glibc and stdc++ required by some of our libraries.

Would you recommend building such a package on an older system to make sure that it is compatible with more distributions? I don't like the thought of downgrading all of our dependencies because of that.

I tried to do static linking, but CMake doesn't really seem to support it.
 
Old 08-24-2010, 04:10 AM   #10
iam_techno
Member
 
Registered: Aug 2006
Location: Oregon
Distribution: Ubuntu 9.04, Windows 7
Posts: 48

Rep: Reputation: 16
futlib,

Quote:
Originally Posted by futlib View Post
I can't really offer the source, since it's proprietary.
Is there anyway to post just the ldd output, censored to protect your product? Or at least the libs you have questions about?

Sergei,

I apologize. I was still half asleep when I addressed those two responses to you about makeself I meant to address them to futlib.

iamtechno
 
Old 08-24-2010, 04:36 AM   #11
futlib
LQ Newbie
 
Registered: Aug 2010
Posts: 4

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by iam_techno View Post
futlib,
Is there anyway to post just the ldd output, censored to protect your product? Or at least the libs you have questions about?
I don't think our ldd output has to be protected Here it is (Lots of "not found" because I invoked ldd on a server):

Code:
        linux-gate.so.1 =>  (0xf57fe000)
        libboost_filesystem.so.1.40.0 => not found
        libboost_system.so.1.40.0 => not found
        libboost_program_options.so.1.40.0 => not found
        libSDL-1.2.so.0 => not found
        libpthread.so.0 => /lib/libpthread.so.0 (0xb7f5e000)
        libSDL_image-1.2.so.0 => not found
        libSDL_ttf-2.0.so.0 => not found
        libGLU.so.1 => not found
        libGL.so.1 => not found
        libSM.so.6 => not found
        libICE.so.6 => not found
        libX11.so.6 => /usr/lib/libX11.so.6 (0xb7e6e000)
        libXext.so.6 => /usr/lib/libXext.so.6 (0xb7e60000)
        libopenal.so.1 => not found
        libogg.so.0 => not found
        libvorbis.so.0 => not found
        libvorbisfile.so.3 => not found
        libvorbisenc.so.2 => not found
        libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0xb7d70000)
        libm.so.6 => /lib/libm.so.6 (0xb7d4a000)
        libgcc_s.so.1 => /lib/libgcc_s.so.1 (0xb7d3d000)
        libc.so.6 => /lib/libc.so.6 (0xb7bff000)
        /lib/ld-linux.so.2 (0xb7f7e000)
        libxcb-xlib.so.0 => /usr/lib/libxcb-xlib.so.0 (0xb7bfd000)
        libxcb.so.1 => /usr/lib/libxcb.so.1 (0xb7be5000)
        libdl.so.2 => /lib/libdl.so.2 (0xb7be0000)
        libXau.so.6 => /usr/lib/libXau.so.6 (0xb7bdd000)
        libXdmcp.so.6 => /usr/lib/libXdmcp.so.6 (0xb7bd8000)
This was linked on Ubuntu 10.04.

My actual dependencies are:
  • Boost 1.40
  • Boost.Filesystem 1.40
  • Boost.Program_Options 1.40
  • SDL 1.2
  • SDL_image 1.2
  • SDL_ttf 2.0
  • OpenAL 1.12
  • libogg 1.1.4
  • libvorbis 1.2.3

The rest is transitive.

I've read the advice of building the required libraries myself in the required version and on an older distribution (like Debian lenny). At least for Boost and SDL, this would solve a couple of problems. What do you think of this approach?

Last edited by futlib; 08-24-2010 at 04:37 AM.
 
Old 08-27-2010, 03:45 AM   #12
futlib
LQ Newbie
 
Registered: Aug 2010
Posts: 4

Original Poster
Rep: Reputation: 0
I ended up doing it as follows: I installed Debian lenny into a virtual machine and compiled SDL, SDL_image, SDL_ttf and boost in the exact versions I wanted myself. This resulted in libraries with very few dependencies - just the bare necessities. I then installed these into the system using make install and compiled my application against them - CMake was able to find them in /usr/local without problems.

That's a great approach, I have only a couple of dependencies now! Linux Application Checker showed that my application is now compatible with up to three year old versions of all the major distsributions - this is certainly enough for me.
 
  


Reply

Tags
packaging, proprietary


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Mixing Proprietary Software and Linux LXer Syndicated Linux News 1 07-01-2009 08:28 AM
LXer: The future of packaging software in Linux LXer Syndicated Linux News 0 02-18-2007 10:31 AM
Proprietary Software In Linux macpcperson Linux - General 5 12-10-2006 05:49 PM
LXer: Declare your independence from proprietary software (Or how to break the habit of proprietary software) LXer Syndicated Linux News 0 07-05-2006 02:54 PM


All times are GMT -5. The time now is 07:09 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration