简体   繁体   English

Ubuntu中的Qt:无法使用静态Boost库进行编译

[英]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. 我正在尝试使用Ubuntu 14.04,Qt和一些Boost库来编译C ++插件。

I built the boost libraries as follows: 我按如下方式构建了Boost库:

libboost-all-dev

If I use shared boost libraries, eg libboost_system.so, the project compiles just fine. 如果我使用共享的Boost库,例如libboost_system.so,则项目可以正常编译。 However, I want to compile using static boost libraries (libboost_system.a). 但是,我想使用静态增强库(libboost_system.a)进行编译。 I get the following error in my boost project: 我的boost项目中出现以下错误:

 "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: 这是我的Qt项目文件:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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