Groups | Search | Server Info | Keyboard shortcuts | Login | Register


Groups > comp.os.linux.development.apps > #753

Re: Qt: Can't build statically linked app

From Rainer Weikusat <rweikusat@mobileactivedefense.com>
Newsgroups comp.os.linux.development.apps
Subject Re: Qt: Can't build statically linked app
Date 2014-08-28 16:11 +0100
Message-ID <87iolc4pk2.fsf@sable.mobileactivedefense.com> (permalink)
References <74dce259-d20b-4683-94fd-253622114b22@googlegroups.com>

Show all headers | View raw


j.livermont.ericsson@gmail.com writes:
> I'm trying to build an Qt-based application that's recently been
> uplifted from Qt4.x to Qt5.  I am able to get the app to compile fine,
> but I would like to it to be statically linked for portability across
> our test and CI environments.

Are you trying to solve an actual problem by doing this or is the just
the usual "that's fishy and I'd rather not do that" reflex?

> A colleague of mine suggested that all I needed to do was add 'CONFIG
> += static' to my .pro file and rebuild.  I did that, but I still end
> up with a dynamically linked binary.

gcc will create a statically linked binary when the -static command-line
option is being used:


[rw@sable]/tmp#ed a.c
a.c: No such file or directory
a
#include <stdio.h>

int main(void)
{
        puts("I'm old-fashioned!");
        return 0;
}
.
wq
79
[rw@sable]/tmp#gcc -static a.c
[rw@sable]/tmp#./a.out 
I'm old-fashioned!
[rw@sable]/tmp#ldd a.out 
        not a dynamic executable

Whatever your integrated developer playpen may be, I figure it should
have a way to pass additional options to the linker.

Back to comp.os.linux.development.apps | Previous | NextPrevious in thread | Find similar


Thread

Qt: Can't build statically linked app j.livermont.ericsson@gmail.com - 2014-08-28 07:46 -0700
  Re: Qt: Can't build statically linked app Rainer Weikusat <rweikusat@mobileactivedefense.com> - 2014-08-28 16:11 +0100

csiph-web