简体   繁体   中英

Qt in Ubuntu: Cannot compile using static boost libraries

I am trying to compile a C++ plugin using Ubuntu 14.04, Qt, and some boost libraries.

I built the boost libraries as follows:

libboost-all-dev

If I use shared boost libraries, eg libboost_system.so, the project compiles just fine. However, I want to compile using static boost libraries (libboost_system.a). I get the following error in my boost project:

 "relocation R_X86-64-32 against '.rodata.str1.1' cannot be used when making a shared object; recompile with -fPIC". 

This is my Qt project file:

VERSION = 1.3.1
TEMPLATE = lib
QT -= gui
CONFIG += warn_on plugin release 
CONFIG -= thread exceptions qt rtti debug 
CONFIG += c++11

INCLUDEPATH += /usr/include

LIBS += "/usr/lib/x86_64-linux-gnu/libboost_system.a" 
LIBS += "/usr/lib/x86_64-linux-gnu/libboost_filesystem.a"

DEFINES += APL=0 IBM=0 LIN=1 
DEFINES += IGOCONNECT_LIN_LIBRARY

TARGET = lin.xpl

QMAKE_CXXFLAGS += -fvisibility=hidden 
QMAKE_CXXFLAGS += -fPIC

SOURCES += igoconnect_lin.cpp
HEADERS +=
unix {  
target.path = /usr/lib  
INSTALLS += target 
}

Anything I am doing wrong? Thank you so much!

试试看

LIBS += -lboost_system

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM