Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Rainer Weikusat Newsgroups: comp.os.linux.development.apps Subject: Re: Qt: Can't build statically linked app Date: Thu, 28 Aug 2014 16:11:25 +0100 Lines: 38 Message-ID: <87iolc4pk2.fsf@sable.mobileactivedefense.com> References: <74dce259-d20b-4683-94fd-253622114b22@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: individual.net KWUEus9GZ4o9VCglQij5mAsak/xLwumtQNLBkHmY8f9lO8oL4= Cancel-Lock: sha1:42WGgWjzmpmjKLX9iUuibRlNNBE= sha1:apuXFFwTCtruHjDq4FcVxpIDxbI= User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.4 (gnu/linux) Xref: csiph.com comp.os.linux.development.apps:753 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 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.