I am a noob so if what I am asking is straight forward, or something basic that I have missed, please excuse me.
Im trying to link Lua with Qt creator so that I can run a basic Lua script. I included all of the header files required by Lua in my main.cpp file. And low I'm trying to link the liblua.a library to the project; so what I did is, I manually added the library.
The Creator then generated this code, and added it to my .pro - file :
unix:!macx: LIBS += L$$PWD/ -llua
INCLUDEPATH += $$PWD/
DEPENDPATH += $$PWD/
unix:!macx: PRE_TARGETDEPS += $$PWD/liblua.a
Then when I start the debugger, I get two errors:
-Skipping incompatible /home/..path to Lua source files../liblua.a when searching for -llua
-cannot find -llua
I'm running Ubuntu 12.04, and the version of Lua that I'm currently working with is 5.2.3
Can someone please advise me as to what I am doing wrong?
EDIT:
Compile Output:
16:48:10: Running steps for project testApp...
16:48:10: Configuration unchanged, skipping qmake step.
16:48:10: Starting: "/usr/bin/make"
arm-linux-gnueabihf-g++ -Wl,-rpath,/usr/local/Trolltech/QtEmbedded-4.8.4-arm/lib -o
testApp main.o -L/usr/local/Trolltech/QtEmbedded-4.8.4-arm/lib -ldl -L/home/david
/workspace/testApp/ -llua -lQtNetwork -L/usr/local/Trolltech/QtEmbedded-4.8.4-
arm/lib -lQtCore -lpthread
/usr/lib/gcc/arm-linux-gnueabihf/4.6/../../../../arm-linux-gnueabihf/bin/ld:
skipping incompatible /home/david/workspace/testApp//liblua.a when searching for
-llua
/usr/lib/gcc/arm-linux-gnueabihf/4.6/../../../../arm-linux-gnueabihf/bin/ld: cannot
find -llua
collect2: ld returned 1 exit status
make: *** [testApp] Error 1
16:48:10: The process "/usr/bin/make" exited with code 2.
Error while building/deploying project testApp (kit: SAP)
When executing step 'Make'
16:48:10: Elapsed time: 00:00.
解决方案
Finally, I got it solved!
The problem was that that I had to cross compile the Lua library for the ARM core. The architecture of the original Lua library was not recognizable by the core, as the execution of the program took place on the core itself when debugging.
I did this by :
$ make linux CC=PATH/arm-linux-gnueabihf-gcc AR=”PATH/arm-linux-gnueabihf-ar rcu” RANLIB=PATH/arm-linux-gnueabihf-ranlib
and removing all references to readline in the makefile and config file before executing above command.
本文介绍了如何解决在Qt Creator中集成Lua遇到的问题,包括错误的库文件路径和不兼容的架构问题。通过交叉编译Lua库以匹配目标平台,最终实现了Lua脚本在Qt Creator中的正确运行。

2600

被折叠的 条评论
为什么被折叠?



