PDA

View Full Version : QMAKE: Building static library without -fPIC



rainman110
2nd April 2008, 15:50
Hi,

i need to create a static library from some code which also contains assembler code. The code won't compile with the compiler option -fPIC.
My pro file looks a follows:


TEMPLATE = lib
CONFIG += staticlib debug

QMAKE_CXXFLAGS_WARN_ON = -Wall -pedantic -ansi

...


Now when compiling, the compiler option -fPIC is automatically added. There is a variable QMAKE_CXXFLAGS_SHLIB. If I let this empty, this would work, when I am building a shared library. Since I want to build a static library, setting this variable will not work.
Is there an equivalent variable for static libraries? Can't it be so hard to get rid of this fPIC option?
This is, what qmakes produces now:


g++ -c -g -fPIC -Wall -pedantic -ansi -I/usr/local/Trolltech/Qt-4.3.0/mkspecs/linux-g++-64 -I. -I. -I. -o cpucount.o cpucount.cpp


Thanks in advance,
Martin

nomegenerico@email.it
2nd May 2012, 17:07
Same situation, seems there is no solution from inside qmake project, all I was able to do is a
manual change ti generated makefile and a build. :-(