Reputation: 373
I am trying to create and application to cross compile with the raspberry pi 3. Originally I just had a project named "application" and everything worked great. Knowing the scope of the project I thought it would be a good idea to abstract out the classes I am bound to add. So I turned the project into a subdirs project. That is were the issues started.
The directory looks like this
IntegratedSmartHome.pro subdirs
-->Application.pro app
-->Libs.pro subdirs
---->common.pro library
I followed this guide and a couple of dozen others looking for guidance and none was found.
The error I am getting is:
10:37:03: Starting /home/jesse/Projects/build-integratedSmartHome-Desktop_Qt_5_11_1_GCC_64bit-Debug/application/application...
/home/jesse/Projects/build-integratedSmartHome-Desktop_Qt_5_11_1_GCC_64bit-Debug/application/application: error while loading shared libraries: libcommon.so.1: cannot open shared object file: No such file or directory
10:37:03: /home/jesse/Projects/build-integratedSmartHome-Desktop_Qt_5_11_1_GCC_64bit-Debug/application/application exited with code 127
Picture of libs folder after build
Any guidance on how to fix this would be appreciated! I will include my 4 .pro files below. note: I get no build errors
IntegratedSmartHome.pro:
TEMPLATE = subdirs
SUBDIRS += \
libs \
application
application.depends = libs
CONFIG += ordered
Application.pro
QT += gui quick
CONFIG += c++11
DEFINES += QT_DEPRECATED_WARNINGS
SOURCES += \
main.cpp \
smartdevicesmodel.cpp \
globalproperties.cpp
HEADERS += \
smartdevicesmodel.h \
globalproperties.h
RESOURCES += \
res/res.qrc
INCLUDEPATH += ../libs/common
LIBS += \
-L../libs/common -lcommon
# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target
Libs.pro
TEMPLATE = subdirs
SUBDIRS += \
common
CONFIG += ordered
Common.pro
QT -= gui
CONFIG += c++11
CONFIG -= app_bundle
DEFINES += QT_DEPRECATED_WARNINGS
SOURCES += \
main.cpp \
devicetype.cpp \
smartdevice.cpp
HEADERS += \
devicetype.h \
smartdevice.h
! include( ../libs.pri ) {
error( "Couldn't find the libs.pri file!" )
}
# Default rules for deployment.
#qnx: target.path = /tmp/$${TARGET}/bin
#else: unix:!android: target.path = /opt/$${TARGET}/bin
#!isEmpty(target.path): INSTALLS += target
Libs.pri
INCLUDEPATH += . ..
WARNINGS += -Wall
TEMPLATE = lib
UI_DIR = uics
MOC_DIR = mocs
OBJECTS_DIR = objs
EDIT: I have a little experience writing build shell scripts, if you think it is worth my time, or that it won't be too difficult to continue to support the raspi with one of those, I could try that and then I would be a little more explicit with linking
Upvotes: 2
Views: 1687
Reputation: 11966
This is not a build failure, judging by the log output you posted. This is a runtime failure, because the loader can't find the shared library. It can't find the shared library because it is not on the default LD_LIBRARY_PATH
(or as configured via /etc/ld.so.conf
).
To run your application you probably want to edit the run configuration in the IDE to set LD_LIBRARY_PATH
to point to the folder with your libcommon.so
in it.
Upvotes: 2