2017-04-09 3 views
0

Raspberry Pi 3에 프로그램을 컴파일하고 싶습니다.라즈베리에 Qt5 응용 프로그램 컴파일

나는 최신 Raspbian를 설치하고 this manual에 설명 된대로 Qt 5.8을 crosscompiled 후 나는 보드에서 실행하는 GST을 구축하려고했습니다했습니다. 컴파일 과정은하지만, 내가 링커 오류 다음 주 잖아, 마무리 할 것 같다

[email protected]:/home/pi/headunit-WIP-headunit-gst/gst# make 
g++ -fPIC -std=c++11 `pkg-config --cflags gstreamer-1.0 gstreamer-app-1.0 gstreamer-video-1.0 libcrypto libusb-1.0 openssl` -I../jni -I/opt/Qt5.8/include/QtWidgets -I/opt/Qt5.8/include -I/opt/Qt5.8/include/QtGui -c main.cc -o main.o 
g++ -o headunit ../jni/hu_aad.o ../jni/hu_aap.o ../jni/hu_ssl.o ../jni/hu_usb.o ../jni/hu_uti.o main.o `pkg-config --libs gstreamer-1.0 gstreamer-app-1.0 gstreamer-video-1.0 libcrypto libusb-1.0 openssl` -L/opt/Qt5.8/include/QtCore/QtCore -L/opt/Qt5.8/include/QtWidgets/QtWidgets -L/opt/Qt5.8/include/QtGui/QtGui 
main.o: In function `gst_loop(gst_app_t*, QApplication*)': 
main.cc:(.text+0xb5c): undefined reference to `QApplication::exec()' 
main.o: In function `main': 
main.cc:(.text+0x10e0): undefined reference to `QApplication::QApplication(int&, char**, int)' 
main.cc:(.text+0x10f0): undefined reference to `qFlagLocation(char const*)' 
main.cc:(.text+0x1104): undefined reference to `qFlagLocation(char const*)' 
main.cc:(.text+0x1134): undefined reference to `QObject::connect(QObject const*, char const*, QObject const*, char const*, Qt::ConnectionType)' 
main.cc:(.text+0x1140): undefined reference to `QMetaObject::Connection::~Connection()' 
main.cc:(.text+0x1178): undefined reference to `QWidget::show()' 
main.cc:(.text+0x11bc): undefined reference to `QWidget::winId() const' 
main.cc:(.text+0x1280): undefined reference to `QWidget::hide()' 
main.cc:(.text+0x12c4): undefined reference to `QApplication::~QApplication()' 
main.cc:(.text+0x12e4): undefined reference to `QApplication::~QApplication()' 
main.o: In function `QWidget::resize(int, int)': 
main.cc:(.text._ZN7QWidget6resizeEii[_ZN7QWidget6resizeEii]+0x38): undefined reference to `QWidget::resize(QSize const&)' 
main.o: In function `HuMainWindow::HuMainWindow()': 
main.cc:(.text._ZN12HuMainWindowC2Ev[_ZN12HuMainWindowC5Ev]+0x38): undefined reference to `QMainWindow::QMainWindow(QWidget*, QFlags<Qt::WindowType>)' 
main.o: In function `HuMainWindow::~HuMainWindow()': 
main.cc:(.text._ZN12HuMainWindowD2Ev[_ZN12HuMainWindowD5Ev]+0x48): undefined reference to `QMainWindow::~QMainWindow()' 
main.o:(.data.rel.ro._ZTV12HuMainWindow[_ZTV12HuMainWindow]+0x8): undefined reference to `QMainWindow::metaObject() const' 
main.o:(.data.rel.ro._ZTV12HuMainWindow[_ZTV12HuMainWindow]+0xc): undefined reference to `QMainWindow::qt_metacast(char const*)' 
main.o:(.data.rel.ro._ZTV12HuMainWindow[_ZTV12HuMainWindow]+0x10): undefined reference to `QMainWindow::qt_metacall(QMetaObject::Call, int, void**)' 
main.o:(.data.rel.ro._ZTV12HuMainWindow[_ZTV12HuMainWindow]+0x1c): undefined reference to `QMainWindow::event(QEvent*)' 
main.o:(.data.rel.ro._ZTV12HuMainWindow[_ZTV12HuMainWindow]+0x20): undefined reference to `QObject::eventFilter(QObject*, QEvent*)' 
main.o:(.data.rel.ro._ZTV12HuMainWindow[_ZTV12HuMainWindow]+0x24): undefined reference to `QObject::timerEvent(QTimerEvent*)' 
main.o:(.data.rel.ro._ZTV12HuMainWindow[_ZTV12HuMainWindow]+0x28): undefined reference to `QObject::childEvent(QChildEvent*)' 
main.o:(.data.rel.ro._ZTV12HuMainWindow[_ZTV12HuMainWindow]+0x2c): undefined reference to `QObject::customEvent(QEvent*)' 
main.o:(.data.rel.ro._ZTV12HuMainWindow[_ZTV12HuMainWindow]+0x30): undefined reference to `QObject::connectNotify(QMetaMethod const&)' 
main.o:(.data.rel.ro._ZTV12HuMainWindow[_ZTV12HuMainWindow]+0x34): undefined reference to `QObject::disconnectNotify(QMetaMethod const&)' 
main.o:(.data.rel.ro._ZTV12HuMainWindow[_ZTV12HuMainWindow]+0x38): undefined reference to `QWidget::devType() const' 
main.o:(.data.rel.ro._ZTV12HuMainWindow[_ZTV12HuMainWindow]+0x3c): undefined reference to `QWidget::setVisible(bool)' 
main.o:(.data.rel.ro._ZTV12HuMainWindow[_ZTV12HuMainWindow]+0x40): undefined reference to `QWidget::sizeHint() const' 
main.o:(.data.rel.ro._ZTV12HuMainWindow[_ZTV12HuMainWindow]+0x44): undefined reference to `QWidget::minimumSizeHint() const' 
main.o:(.data.rel.ro._ZTV12HuMainWindow[_ZTV12HuMainWindow]+0x48): undefined reference to `QWidget::heightForWidth(int) const' 
main.o:(.data.rel.ro._ZTV12HuMainWindow[_ZTV12HuMainWindow]+0x4c): undefined reference to `QWidget::hasHeightForWidth() const' 
main.o:(.data.rel.ro._ZTV12HuMainWindow[_ZTV12HuMainWindow]+0x50): undefined reference to `QWidget::paintEngine() const' 
main.o:(.data.rel.ro._ZTV12HuMainWindow[_ZTV12HuMainWindow]+0x5c): undefined reference to `QWidget::mouseDoubleClickEvent(QMouseEvent*)' 
main.o:(.data.rel.ro._ZTV12HuMainWindow[_ZTV12HuMainWindow]+0x64): undefined reference to `QWidget::wheelEvent(QWheelEvent*)' 
main.o:(.data.rel.ro._ZTV12HuMainWindow[_ZTV12HuMainWindow]+0x68): undefined reference to `QWidget::keyPressEvent(QKeyEvent*)' 
main.o:(.data.rel.ro._ZTV12HuMainWindow[_ZTV12HuMainWindow]+0x6c): undefined reference to `QWidget::keyReleaseEvent(QKeyEvent*)' 
main.o:(.data.rel.ro._ZTV12HuMainWindow[_ZTV12HuMainWindow]+0x70): undefined reference to `QWidget::focusInEvent(QFocusEvent*)' 
main.o:(.data.rel.ro._ZTV12HuMainWindow[_ZTV12HuMainWindow]+0x74): undefined reference to `QWidget::focusOutEvent(QFocusEvent*)' 
main.o:(.data.rel.ro._ZTV12HuMainWindow[_ZTV12HuMainWindow]+0x78): undefined reference to `QWidget::enterEvent(QEvent*)' 
main.o:(.data.rel.ro._ZTV12HuMainWindow[_ZTV12HuMainWindow]+0x7c): undefined reference to `QWidget::leaveEvent(QEvent*)' 
main.o:(.data.rel.ro._ZTV12HuMainWindow[_ZTV12HuMainWindow]+0x80): undefined reference to `QWidget::paintEvent(QPaintEvent*)' 
main.o:(.data.rel.ro._ZTV12HuMainWindow[_ZTV12HuMainWindow]+0x84): undefined reference to `QWidget::moveEvent(QMoveEvent*)' 
main.o:(.data.rel.ro._ZTV12HuMainWindow[_ZTV12HuMainWindow]+0x88): undefined reference to `QWidget::resizeEvent(QResizeEvent*)' 
main.o:(.data.rel.ro._ZTV12HuMainWindow[_ZTV12HuMainWindow]+0x8c): undefined reference to `QWidget::closeEvent(QCloseEvent*)' 
main.o:(.data.rel.ro._ZTV12HuMainWindow[_ZTV12HuMainWindow]+0x90): undefined reference to `QMainWindow::contextMenuEvent(QContextMenuEvent*)' 
main.o:(.data.rel.ro._ZTV12HuMainWindow[_ZTV12HuMainWindow]+0x94): undefined reference to `QWidget::tabletEvent(QTabletEvent*)' 
main.o:(.data.rel.ro._ZTV12HuMainWindow[_ZTV12HuMainWindow]+0x98): undefined reference to `QWidget::actionEvent(QActionEvent*)' 
main.o:(.data.rel.ro._ZTV12HuMainWindow[_ZTV12HuMainWindow]+0x9c): undefined reference to `QWidget::dragEnterEvent(QDragEnterEvent*)' 
main.o:(.data.rel.ro._ZTV12HuMainWindow[_ZTV12HuMainWindow]+0xa0): undefined reference to `QWidget::dragMoveEvent(QDragMoveEvent*)' 
main.o:(.data.rel.ro._ZTV12HuMainWindow[_ZTV12HuMainWindow]+0xa4): undefined reference to `QWidget::dragLeaveEvent(QDragLeaveEvent*)' 
main.o:(.data.rel.ro._ZTV12HuMainWindow[_ZTV12HuMainWindow]+0xa8): undefined reference to `QWidget::dropEvent(QDropEvent*)' 
main.o:(.data.rel.ro._ZTV12HuMainWindow[_ZTV12HuMainWindow]+0xac): undefined reference to `QWidget::showEvent(QShowEvent*)' 
main.o:(.data.rel.ro._ZTV12HuMainWindow[_ZTV12HuMainWindow]+0xb0): undefined reference to `QWidget::hideEvent(QHideEvent*)' 
main.o:(.data.rel.ro._ZTV12HuMainWindow[_ZTV12HuMainWindow]+0xb4): undefined reference to `QWidget::nativeEvent(QByteArray const&, void*, long*)' 
main.o:(.data.rel.ro._ZTV12HuMainWindow[_ZTV12HuMainWindow]+0xb8): undefined reference to `QWidget::changeEvent(QEvent*)' 
main.o:(.data.rel.ro._ZTV12HuMainWindow[_ZTV12HuMainWindow]+0xbc): undefined reference to `QWidget::metric(QPaintDevice::PaintDeviceMetric) const' 
main.o:(.data.rel.ro._ZTV12HuMainWindow[_ZTV12HuMainWindow]+0xc0): undefined reference to `QWidget::initPainter(QPainter*) const' 
main.o:(.data.rel.ro._ZTV12HuMainWindow[_ZTV12HuMainWindow]+0xc4): undefined reference to `QWidget::redirected(QPoint*) const' 
main.o:(.data.rel.ro._ZTV12HuMainWindow[_ZTV12HuMainWindow]+0xc8): undefined reference to `QWidget::sharedPainter() const' 
main.o:(.data.rel.ro._ZTV12HuMainWindow[_ZTV12HuMainWindow]+0xcc): undefined reference to `QWidget::inputMethodEvent(QInputMethodEvent*)' 
main.o:(.data.rel.ro._ZTV12HuMainWindow[_ZTV12HuMainWindow]+0xd0): undefined reference to `QWidget::inputMethodQuery(Qt::InputMethodQuery) const' 
main.o:(.data.rel.ro._ZTV12HuMainWindow[_ZTV12HuMainWindow]+0xd4): undefined reference to `QWidget::focusNextPrevChild(bool)' 
main.o:(.data.rel.ro._ZTV12HuMainWindow[_ZTV12HuMainWindow]+0xd8): undefined reference to `QMainWindow::createPopupMenu()' 
main.o:(.data.rel.ro._ZTV12HuMainWindow[_ZTV12HuMainWindow]+0xec): undefined reference to `non-virtual thunk to QWidget::devType() const' 
main.o:(.data.rel.ro._ZTV12HuMainWindow[_ZTV12HuMainWindow]+0xf0): undefined reference to `non-virtual thunk to QWidget::paintEngine() const' 
main.o:(.data.rel.ro._ZTV12HuMainWindow[_ZTV12HuMainWindow]+0xf4): undefined reference to `non-virtual thunk to QWidget::metric(QPaintDevice::PaintDeviceMetric) const' 
main.o:(.data.rel.ro._ZTV12HuMainWindow[_ZTV12HuMainWindow]+0xf8): undefined reference to `non-virtual thunk to QWidget::initPainter(QPainter*) const' 
main.o:(.data.rel.ro._ZTV12HuMainWindow[_ZTV12HuMainWindow]+0xfc): undefined reference to `non-virtual thunk to QWidget::redirected(QPoint*) const' 
main.o:(.data.rel.ro._ZTV12HuMainWindow[_ZTV12HuMainWindow]+0x100): undefined reference to `non-virtual thunk to QWidget::sharedPainter() const' 
main.o:(.data.rel.ro._ZTI12HuMainWindow[_ZTI12HuMainWindow]+0x8): undefined reference to `typeinfo for QMainWindow' 
collect2: error: ld returned 1 exit status 
Makefile:23: recipe for target 'headunit' failed 
make: *** [headunit] Error 1 

지금까지 내가 이해, QApplication에 대한 참조가없는,하지만 난 Makefile에 쓴 :

CC=gcc 
CPP=g++ 
LD=ld 
INCLUDES=`pkg-config --cflags gstreamer-1.0 gstreamer-app-1.0 gstreamer-video-1.0 libcrypto libusb-1.0 openssl` -I$(TOP)/jni -I/opt/Qt5.8/include/QtWidgets -I/opt/Qt5.8/include -I/opt/Qt5.8/include/QtGui 
CFLAGS= 
CPPFLAGS=-fPIC -std=c++11 
LFLAGS=`pkg-config --libs gstreamer-1.0 gstreamer-app-1.0 gstreamer-video-1.0 libcrypto libusb-1.0 openssl` -L/opt/Qt5.8/include/QtCore/QtCore -L/opt/Qt5.8/include/QtWidgets/QtWidgets -L/opt/Qt5.8/include/QtGui/QtGui 
TOP = .. 
AASRCS = $(TOP)/jni/hu_aad.c \ 
     $(TOP)/jni/hu_aap.c \ 
      $(TOP)/jni/hu_ssl.c \ 
     $(TOP)/jni/hu_usb.c \ 
     $(TOP)/jni/hu_uti.c 
HSRCS =  main.cc 
OBJS = $(AASRCS:.c=.o) $(HSRCS:.cc=.o) 
APP = headunit 

.PHONY: depend clean 

all: $(APP) 

$(APP): $(OBJS) 
    $(CPP) -o $(APP) $(OBJS) $(LFLAGS) 

.c.o: 
    $(CC) $(CFLAGS) $(INCLUDES) -c $< -o [email protected] 

.cc.o: 
    $(CPP) $(CPPFLAGS) $(INCLUDES) -c $< -o [email protected] 

clean: 
    rm -f $(OBJS) *~ $(APP) 

depend: $(SRCS) 
    makedepend $^ 

# DO NOT DELETE 

또한 qmake -project를 사용하여 프로젝트 파일을 얻은 다음 qmake 및 make를 시도했습니다. 하지만 다른 오류가 나타납니다.

어쩌면 누군가가이 프로그램을 최종적으로 컴파일하기 위해 이러한 문제를 해결할 수 있습니다.

답변

0

당신은 Pi가 Qt 설치의/lib 폴더를 ld.so.conf에 추가하여 라이브러리를 찾도록하려고 했습니까? 는 귀하의 경우에는이 어쩌면 당신은 지금 링커가 당신의 메이크에 대한 추가없이 Qt는-libs와 찾을 수 sudo ldconfig

를 사용하여 ld.so.conf를 다시로드해야 그 후 echo /opt/Qt5.8/lib | sudo tee /etc/ld.so.conf.d/qt5pi.conf

과 같을 것이다. 아마도 도움이 될 것입니다.

관련 문제