Results 1 to 2 of 2

Thread: QMAKE: Building static library without -fPIC

  1. #1
    Join Date
    Feb 2008
    Posts
    6
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Question QMAKE: Building static library without -fPIC

    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:
    Qt Code:
    1. TEMPLATE = lib
    2. CONFIG += staticlib debug
    3.  
    4. QMAKE_CXXFLAGS_WARN_ON = -Wall -pedantic -ansi
    5.  
    6. ...
    To copy to clipboard, switch view to plain text mode 

    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:
    Qt Code:
    1. 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
    To copy to clipboard, switch view to plain text mode 

    Thanks in advance,
    Martin
    Last edited by rainman110; 2nd April 2008 at 15:06. Reason: Title not clear enough

  2. #2
    Join Date
    May 2012
    Posts
    1
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: QMAKE: Building static library without -fPIC

    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. :-(

Similar Threads

  1. Replies: 16
    Last Post: 23rd May 2008, 10:12
  2. Please Help-->have few doubts with Static build in Windows !
    By Krish in forum Installation and Deployment
    Replies: 1
    Last Post: 17th March 2008, 14:37
  3. Building qt program with static library
    By JonathanForQT4 in forum Newbie
    Replies: 2
    Last Post: 22nd June 2007, 23:15
  4. static library archiving question
    By ChasW in forum Qt Programming
    Replies: 1
    Last Post: 4th February 2007, 08:38
  5. Win32 qmake: building a static library
    By Amanda in forum Qt Programming
    Replies: 5
    Last Post: 8th November 2006, 19:32

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.