简体   繁体   English

Qwt版本冲突QTCREATOR

[英]Qwt version conflict QTCREATOR

I'm having trouble deploying .exe generated with QtCreator on Ubuntu 14.04. 我在Ubuntu 14.04上部署用QtCreator生成的.exe遇到麻烦。 I got several versions of qwt installed (and i need those, one compiled with qt4 the other with qt5). 我安装了多个版本的qwt(我需要这些版本,一个版本是用qt4编译的,另一个版本是qt5)。 Problem is, i don't know why but Qt seems to link the wrong version of qwt to my .exe whatever i do .. When i use LDD on my .exe, it always show /usr/lib/libqwt.so.6. 问题是,我不知道为什么,但是无论我做什么,Qt似乎都将错误版本的qwt链接到我的.exe。当我在.exe上使用LDD时,它始终显示/usr/lib/libqwt.so.6 。 Thing is i'm linking the version i need in my .pro like this : 我正在像这样在.pro中链接我需要的版本:

LIBS += -L/usr/local/qwt-6.1.2/lib/ -lqwt LIBS + = -L / usr / local / qwt-6.1.2 / lib / -lqwt

And in project configuration i set LD_LIBRARY_PATH with /usr/local/qwt-6.1.2/lib 在项目配置中,我使用/usr/local/qwt-6.1.2/lib设置LD_LIBRARY_PATH

Still my .exe doesn't link to the right library. 我的.exe仍然没有链接到正确的库。 Any idea why and how to fix this ? 知道为什么以及如何解决这个问题吗? It causes segmentation fault on launch of course as my program is compiled with qt5 and not qt4.. Thanks in advance 由于我的程序是使用qt5而不是qt4编译的,因此在启动过程中会导致分段错误。

You can try adding a runtime path to the linker flags. 您可以尝试将运行时路径添加到链接器标志。 In your .pro file you can add the following line (Its probably worth printing your QMAKE_LFLAGS in your pro file as well): 在您的.pro文件中,您可以添加以下行(也可能值得在您的pro文件中打印QMAKE_LFLAGS):

QMAKE_LFLAGS += "-Wl,-rpath,/usr/local/qwt-6.1.2/lib/"
message ("QMAKE_LFLAGS = $$QMAKE_LFLAGS")

Re-compile and then run ldd again. 重新编译,然后再次运行ldd。 During runtime also ldd) your program should now point to this location first. 在运行时,也ldd),您的程序现在应该首先指向该位置。

Note This is assuming that you are using a gnu compiler! 注意这是假设您使用的是gnu编译器!

I sorted out my problem, seems like settings the environment variables in QtCreator is not enough. 我解决了我的问题,似乎在QtCreator中设置环境变量还不够。 You have to do it in the terminal aswell before launching the .exe, that was my bad. 在启动.exe之前,您还必须在终端中执行此操作,这对我来说很糟糕。 Just had to set LD_LIBRARY_PATH correctly. 只需正确设置LD_LIBRARY_PATH。

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

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