Static libraries on Linux

21 views
Skip to first unread message

Frederic Bosche

unread,
May 29, 2012, 8:29:09 AM5/29/12
to Qtilities
Hi,

First of all. Thanks for the work done. I've been looking for a proper
Qt Logging library with Gui for a while. Yours works well for me and
changing my project to include Qtilities ended up being quite easy.
My question is about using Qtil static libraries. I'd like to share my
application with a colleague, and for this I'd rather link statically
to the libraries.
Building the Qtil libraries statically seems to have worked properly
by replacing "dll" by "staticlib" in the different .pro files.
However, I'm not successful in linking my application with those
static libraries. Everytime I build and then run "ldd <app>" I see
Qtil shared libraries in the list of dependencies. I know this is more
a "Qt" than "Qtililities" issue, but any help would be great.I guess
something needs to be changed in the Qtilities.pri file but it's
unclear.
Or would you suggest to ship the shared libraries and make sure the
application searches its own folder for the Qtil libraries?

Thanks

Jaco Naude

unread,
May 29, 2012, 9:08:21 AM5/29/12
to qtil...@googlegroups.com
Hi

I'm glad you find Qtilities useful. 

Unfortunately I have not done a static build of Qtilities myself, I always distributed the dlls using an installer and linked against them dynamically. I would be interested to know how to do it myself, but I don't have time to figure it out at the moment. Thus, sorry I've not done it before and can't be of much help at the moment.

Just curious, are you building against the master branch, or which version? I pushed a couple of fixes to the logging part in the last week. It mostly fixes the logger config widget not sorting and viewing logs correctly. 

Cheers,
Jaco


--
To post to this group, send email to qtil...@googlegroups.com
To unsubscribe from this group, send email to
qtilities+...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/qtilities?hl=en?hl=en



--
Jaco Naude'

Qtilities: Building blocks for Qt applications.

Jaco Naude

unread,
May 29, 2012, 10:05:18 AM5/29/12
to qtil...@googlegroups.com
Hi again,

A quick check, I assume you have a static build of Qt? That would be needed off course.

Cheers,
Jaco

FredB

unread,
May 30, 2012, 5:05:18 AM5/30/12
to qtil...@googlegroups.com
Hi,

First of all, I've been using V1.2. But, I don't think that the version was an issue in my case because I didn't implement (yet) the configuration widget. I just used the Logging dockwidget (and html file).

For the shared vs. static library issue, I think I found what I need to do. Using the $$ORIGIN variable in the LIBS paths in the .pro file, I should be able to link shared libraries located in the same folder as the executable (just like Windows does by default). This would remove the need for linking statically.

In any case, does one really need the static Qt libs to build other static libs that use it? Can't static libs link to shared libs? This shows my limited knowledge about all this, but it seemed to me that a static lib could link to shared libs, just like executables do.

Fred.
Jaco

Jaco



For more options, visit this group at
http://groups.google.com/group/qtilities?hl=en?hl=en
--
Jaco Naude'

Qtilities: Building blocks for Qt applications.

FredB

unread,
May 30, 2012, 7:22:38 AM5/30/12
to qtil...@googlegroups.com
Hi again,

Ok, I've just tried what I was talking about regarding adding the Qtil libs to the executable's path. Here is what I did:

1) Add to my .pro file: QMAKE_LFLAGS += -Wl, -rpath=\'\$\$ORIGIN\'

2) Add the required Qtilities libraries to the executable folder + create links to them that correspond to what the executable looks for (ldd <app> to have that info). For example, in my case I had to copy-paste the *-1.2.so.1.0.0 libs for Core, CoreGui and Logging and then create links to each of them that have the names *-1.2.so.1.

RESULT: My app works, even when the Qtil file *.conf is not present in the etc/ld.conf.d/ folder (as suggested in your installation notes). Despite my original issue, it means that by replacing \'\$\$ORIGIN\' by \'\$\$ORIGIN\relative\path\fomr\exec\to\qtil\libs\', then the need for the *conf file is removed altogether... (note that alternatively "make install" could be setup so that the libs are directly installed in standard search paths).

IMPORTANT NOTE: What I have tried could enable me to ship my app with the Qtil .so files, so that colleagues who do know much about linux library compilation/installation can use it without having to install/compile Qtilities. However, I have not tried that yet, and it is possible that other runtime linking issues come up on their machines...

I hope this was not too confusing.

Fred.

PS: So, this conversation ends up not being about static libs anymore... :)



On Tuesday, May 29, 2012 3:05:18 PM UTC+1, Jaco Naude wrote:
Jaco

Jaco



For more options, visit this group at
http://groups.google.com/group/qtilities?hl=en?hl=en
--
Jaco Naude'

Qtilities: Building blocks for Qt applications.

Jaco Naude

unread,
Jun 1, 2012, 10:16:20 AM6/1/12
to qtil...@googlegroups.com
Hi Fred

Apologies for the delay on my side.

Thank you very much for the info. I did not know that is possible, and to be honest my knowledge of deployment on Linux is pretty slim, thus its always good to get feedback like this.

Did it work in the end, thus could your colleagues use it without problems?

Cheers,
Jaco






For more options, visit this group at
http://groups.google.com/group/qtilities?hl=en?hl=en
Reply all
Reply to author
Forward
0 new messages