LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Blogs > Lumak's Guide to Random Things
User Name
Password

Notices


OK I don't really have a good title yet but I figure I can post works in progress and other tips I've come across or other interesting things.
Rate this Entry

Compiling with new static libs

Posted 03-01-2009 at 11:27 AM by lumak
Tags gtkpod, static

OK, had you read my other post on gnuCash, you know that I hate gnome dependencies. Some of the programs I use have up to 5 gnome dependencies and I don't feel it's worth it to install them. But I managed to compile them into the gtkpod binary using static libs. This goes against everything slackware has taught, but I feel that it was worth it in the end.

Basically, I have a build script that builds gtkpod. Before it does that, it will build its gnome dependencies as static libs only into a tmp folder and the user can freely delete them when they are done.

Before I begin, I will give the standard warning on such things. If the library is updated due to a security fix or other such things, your main program now has that security flaw. You have to recompile the main program with the static library again so that you can have the security fix.

This is why having 10 programs all with the same dependency should use shared library files so that they are updated all at once. But I'm sure you already knew this.

OK now here are the basics. gtkPod is missing the libgnomecanvas which is missing gail. We want to run gtkPod without infecting our /usr/{lib,include} with these files. We just have to compile using the proper options for the program.

Code:
GTKPOD=/tmp/location/of/gtkpod-src
# compile gale
# cd /to/gail-src
./configure \
  --prefix=$GTKPOD/staticlibs\
  --sysconfdir=/etc \
  --localstatedir=/var \
  --enable-static=yes \
  --enable-shared=no \
  --build=$ARCH-slackware-linux

make
# This installs the files to the --prefix which only contains the
# static libs.
make install-strip
Code:
# compile libgnomecanvas
# cd /to/libgnomecanvas-src
PKG_CONFIG_PATH="$PKG_CONFIG_PATH:$GTKPOD/staticlibs/lib/pkgconfig" \
./configure \
  --prefix=$GTKPOD/staticlibs \
  --sysconfdir=/etc \
  --localstatedir=/var \
  --enable-static=yes \
  --enable-shared=no \
  --build=$ARCH-slackware-linux

make
make install-strip
Now you just compile gtkpod as normal except you add "$PKG_CONFIG_PATH:$GTKPOD/staticlibs/lib/pkgconfig \" before typing ./configure in gtkpod's src directory.

This works nice for simple dependencies. I personally wouldn't use this method on things that used gconf as that installs stuff into /etc and does other retarded things.

What I belive can also be done is installing with the prefix /opt/gnucash for all programs and still keep shared libraries. However, I don't know the commands/settings to do it properly. The only way I could think to do it would be to "make install DESTDIR=/opt/gnucash" for everything. package opt/gnucash. then delete the directory and install the package. That seems messy.

Additionally, if you have static and shared libraries on your main system, you have to do something else to target specifically that static libraries. I'm not sure how to do that either. Enjoy.
Views 1488 Comments 0
« Prev     Main     Next »
Total Comments 0

Comments

 

  



All times are GMT -5. The time now is 07:26 AM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration