qbittorrent / qBittorrent

qBittorrent BitTorrent client
https://www.qbittorrent.org
Other
28.25k stars 3.97k forks source link

Compiling with autotools fails or produces unusable executables if enabling/disabling GUI between compiles #11857

Closed FranciscoPombal closed 8 months ago

FranciscoPombal commented 4 years ago

qBittorrent version and Operating System

Latest/recent master, Ubuntu 18.04

If on linux, libtorrent-rasterbar and Qt version

libtorrent 1.2.3, Qt 5.9.5

What is the problem

Doing ./configure --enable-debug && make -j$NPROC produces a working executable with the GUI. However, attempting to compile without the GUI afterwards (./configure --disable-gui --enable-debug && make -j$NPROC) without running make clean first fails in the linking step.

Doing it in the opposite has a similar result. ./configure --disable-gui --enable-debug && make -j$NPROC produces a working executable. However, attempting to compile with the GUI afterwards (./configure --enable-debug && make -j$NPROC) without running make clean first will also fail in the linking step.

Additionally, make clean does not remove the final products src/qbittorrent or src/qbittorrent-nox.

I should also mention that I remember at least one case where building actually succeed, but running the resulting executable always crashed, due to a wrong QApplication type being used or something like that. However, I was not able to reproduce that for this report.

What is the expected behavior

Building with/without the GUI after having built without/with the GUI, respectively, should work without having to recompile everything from scratch. Additionally, make clean should remove all build products.

Steps to reproduce

1.

./configure --disable-gui --enable-debug && make -j$NPROC
./configure --enable-debug && make -j$NPROC
src/qbittorrent # crash

2.

./configure --enable-debug && make -j$NPROC
./configure --disable-gui --enable-debug && make -j$NPROC

also

./configure --disable-gui --enable-debug && make -j$NPROC
make clean # src/qbittorrent-nox survies this

Extra info(if any)

I ran into this problem when developing features for both the GUI and headless versions. A possible workaround is to just build the GUI version every time, which is not ideal.

Error output in the fist case:

linking qbittorrent
advancedsettings.o: In function `AdvancedSettings::saveAdvancedSettings()':
/home/francisco/Documents/qBittorrent/src/gui/advancedsettings.cpp:239: undefined reference to `Application::mainWindow()'
advancedsettings.o: In function `AdvancedSettings::loadAdvancedSettings()':
/home/francisco/Documents/qBittorrent/src/gui/advancedsettings.cpp:529: undefined reference to `Application::mainWindow()'
collect2: error: ld returned 1 exit status
Makefile:1078: recipe for target 'qbittorrent' failed
make[1]: *** [qbittorrent] Error 1
make[1]: Leaving directory '/home/francisco/Documents/qBittorrent/src'
Makefile:44: recipe for target 'sub-src-make_first' failed
make: *** [sub-src-make_first] Error 2

Second case:

linking qbittorrent-nox
application.o: In function `Application::allTorrentsFinished()':
/home/francisco/Documents/qBittorrent/src/app/application.cpp:443: undefined reference to `ShutdownConfirmDialog::askForConfirmation(QWidget*, ShutdownDialogAction const&)'
application.o: In function `Application::processParams(QStringList const&)':
/home/francisco/Documents/qBittorrent/src/app/application.cpp:529: undefined reference to `AddNewTorrentDialog::isEnabled()'
/home/francisco/Documents/qBittorrent/src/app/application.cpp:532: undefined reference to `AddNewTorrentDialog::show(QString const&, BitTorrent::AddTorrentParams const&, QWidget*)'
/home/francisco/Documents/qBittorrent/src/app/application.cpp:475: undefined reference to `MainWindow::activate()'
application.o: In function `Application::initializeTranslation()':
/home/francisco/Documents/qBittorrent/src/app/application.cpp:668: undefined reference to `QGuiApplication::setLayoutDirection(Qt::LayoutDirection)'
/home/francisco/Documents/qBittorrent/src/app/application.cpp:671: undefined reference to `QGuiApplication::setLayoutDirection(Qt::LayoutDirection)'
application.o: In function `Application::Application(QString const&, int&, char**)':
/home/francisco/Documents/qBittorrent/src/app/application.cpp:134: undefined reference to `QApplication::QApplication(int&, char**, int)'
/home/francisco/Documents/qBittorrent/src/app/application.cpp:141: undefined reference to `QGuiApplication::setDesktopFileName(QString const&)'
/home/francisco/Documents/qBittorrent/src/app/application.cpp:143: undefined reference to `QGuiApplication::setQuitOnLastWindowClosed(bool)'
/home/francisco/Documents/qBittorrent/src/app/application.cpp:144: undefined reference to `QPixmapCache::setCacheLimit(int)'
/home/francisco/Documents/qBittorrent/src/app/application.cpp:134: undefined reference to `QApplication::~QApplication()'
application.o: In function `Application::exec(QStringList const&)':
/home/francisco/Documents/qBittorrent/src/app/application.cpp:599: undefined reference to `UIThemeManager::initInstance()'
/home/francisco/Documents/qBittorrent/src/app/application.cpp:600: undefined reference to `MainWindow::MainWindow(QWidget*)'
/home/francisco/Documents/qBittorrent/src/app/application.cpp:601: undefined reference to `UIThemeManager::instance()'
/home/francisco/Documents/qBittorrent/src/app/application.cpp:601: undefined reference to `UIThemeManager::applyStyleSheet() const'
/home/francisco/Documents/qBittorrent/src/app/application.cpp:614: undefined reference to `QApplication::exec()'
/home/francisco/Documents/qBittorrent/src/app/application.cpp:571: undefined reference to `QMessageBox::QMessageBox(QWidget*)'
/home/francisco/Documents/qBittorrent/src/app/application.cpp:572: undefined reference to `QMessageBox::setIcon(QMessageBox::Icon)'
/home/francisco/Documents/qBittorrent/src/app/application.cpp:573: undefined reference to `QMessageBox::setText(QString const&)'
/home/francisco/Documents/qBittorrent/src/app/application.cpp:574: undefined reference to `QMessageBox::setInformativeText(QString const&)'
/home/francisco/Documents/qBittorrent/src/app/application.cpp:575: undefined reference to `QWidget::show()'
/home/francisco/Documents/qBittorrent/src/app/application.cpp:576: undefined reference to `Utils::Gui::screenCenter(QWidget const*)'
/home/francisco/Documents/qBittorrent/src/app/application.cpp:576: undefined reference to `QWidget::move(QPoint const&)'
/home/francisco/Documents/qBittorrent/src/app/application.cpp:577: undefined reference to `QDialog::exec()'
/home/francisco/Documents/qBittorrent/src/app/application.cpp:571: undefined reference to `QMessageBox::~QMessageBox()'
/home/francisco/Documents/qBittorrent/src/app/application.cpp:571: undefined reference to `QMessageBox::~QMessageBox()'
application.o: In function `Application::cleanup()':
/home/francisco/Documents/qBittorrent/src/app/application.cpp:717: undefined reference to `QWidget::hide()'
/home/francisco/Documents/qBittorrent/src/app/application.cpp:731: undefined reference to `MainWindow::cleanup()'
/home/francisco/Documents/qBittorrent/src/app/application.cpp:763: undefined reference to `UIThemeManager::freeInstance()'
application.o: In function `Application::~Application()':
/home/francisco/Documents/qBittorrent/src/app/application.cpp:184: undefined reference to `QApplication::~QApplication()'
main.o: In function `showSplashScreen()':
/home/francisco/Documents/qBittorrent/src/app/main.cpp:339: undefined reference to `QPixmap::QPixmap(QString const&, char const*, QFlags<Qt::ImageConversionFlag>)'
/home/francisco/Documents/qBittorrent/src/app/main.cpp:340: undefined reference to `QPainter::QPainter(QPaintDevice*)'
/home/francisco/Documents/qBittorrent/src/app/main.cpp:342: undefined reference to `QColor::QColor(Qt::GlobalColor)'
/home/francisco/Documents/qBittorrent/src/app/main.cpp:342: undefined reference to `QPen::QPen(QColor const&)'
/home/francisco/Documents/qBittorrent/src/app/main.cpp:342: undefined reference to `QPainter::setPen(QPen const&)'
/home/francisco/Documents/qBittorrent/src/app/main.cpp:342: undefined reference to `QPen::~QPen()'
/home/francisco/Documents/qBittorrent/src/app/main.cpp:343: undefined reference to `QFont::QFont(QString const&, int, int, bool)'
/home/francisco/Documents/qBittorrent/src/app/main.cpp:343: undefined reference to `QPainter::setFont(QFont const&)'
/home/francisco/Documents/qBittorrent/src/app/main.cpp:343: undefined reference to `QFont::~QFont()'
/home/francisco/Documents/qBittorrent/src/app/main.cpp:347: undefined reference to `QPainter::fontMetrics() const'
/home/francisco/Documents/qBittorrent/src/app/main.cpp:347: undefined reference to `QFontMetrics::width(QString const&, int) const'
main.o: In function `showSplashScreen()':
/usr/include/x86_64-linux-gnu/qt5/QtGui/qpainter.h:892: undefined reference to `QPainter::drawText(QPointF const&, QString const&)'
main.o: In function `showSplashScreen()':
/home/francisco/Documents/qBittorrent/src/app/main.cpp:347: undefined reference to `QFontMetrics::~QFontMetrics()'
/home/francisco/Documents/qBittorrent/src/app/main.cpp:349: undefined reference to `QSplashScreen::QSplashScreen(QPixmap const&, QFlags<Qt::WindowType>)'
/home/francisco/Documents/qBittorrent/src/app/main.cpp:350: undefined reference to `QWidget::show()'
/home/francisco/Documents/qBittorrent/src/app/main.cpp:340: undefined reference to `QPainter::~QPainter()'
/home/francisco/Documents/qBittorrent/src/app/main.cpp:339: undefined reference to `QPixmap::~QPixmap()'
/home/francisco/Documents/qBittorrent/src/app/main.cpp:340: undefined reference to `QPainter::~QPainter()'
/home/francisco/Documents/qBittorrent/src/app/main.cpp:339: undefined reference to `QPixmap::~QPixmap()'
/home/francisco/Documents/qBittorrent/src/app/main.cpp:347: undefined reference to `QFontMetrics::~QFontMetrics()'
/home/francisco/Documents/qBittorrent/src/app/main.cpp:343: undefined reference to `QFont::~QFont()'
/home/francisco/Documents/qBittorrent/src/app/main.cpp:342: undefined reference to `QPen::~QPen()'
main.o: In function `userAgreesWithLegalNotice()':
/home/francisco/Documents/qBittorrent/src/app/main.cpp:398: undefined reference to `QMessageBox::QMessageBox(QWidget*)'
/home/francisco/Documents/qBittorrent/src/app/main.cpp:399: undefined reference to `QMessageBox::setText(QString const&)'
/home/francisco/Documents/qBittorrent/src/app/main.cpp:400: undefined reference to `QMessageBox::setWindowTitle(QString const&)'
/home/francisco/Documents/qBittorrent/src/app/main.cpp:401: undefined reference to `QMessageBox::addButton(QString const&, QMessageBox::ButtonRole)'
/home/francisco/Documents/qBittorrent/src/app/main.cpp:402: undefined reference to `QMessageBox::addButton(QString const&, QMessageBox::ButtonRole)'
/home/francisco/Documents/qBittorrent/src/app/main.cpp:403: undefined reference to `QWidget::show()'
/home/francisco/Documents/qBittorrent/src/app/main.cpp:404: undefined reference to `Utils::Gui::screenCenter(QWidget const*)'
/home/francisco/Documents/qBittorrent/src/app/main.cpp:404: undefined reference to `QWidget::move(QPoint const&)'
/home/francisco/Documents/qBittorrent/src/app/main.cpp:405: undefined reference to `QDialog::exec()'
/home/francisco/Documents/qBittorrent/src/app/main.cpp:406: undefined reference to `QMessageBox::clickedButton() const'
/home/francisco/Documents/qBittorrent/src/app/main.cpp:398: undefined reference to `QMessageBox::~QMessageBox()'
/home/francisco/Documents/qBittorrent/src/app/main.cpp:398: undefined reference to `QMessageBox::~QMessageBox()'
misc.o: In function `Utils::Misc::shutdownComputer(ShutdownDialogAction const&)':
/home/francisco/Documents/qBittorrent/src/base/utils/misc.cpp:176: undefined reference to `QDBusConnection::systemBus()'
/home/francisco/Documents/qBittorrent/src/base/utils/misc.cpp:176: undefined reference to `QDBusInterface::QDBusInterface(QString const&, QString const&, QString const&, QDBusConnection const&, QObject*)'
misc.o: In function `Utils::Misc::shutdownComputer(ShutdownDialogAction const&)':
/usr/include/x86_64-linux-gnu/qt5/QtCore/qstring.h:1084: undefined reference to `QDBusConnection::~QDBusConnection()'
misc.o: In function `Utils::Misc::shutdownComputer(ShutdownDialogAction const&)':
/home/francisco/Documents/qBittorrent/src/base/utils/misc.cpp:177: undefined reference to `QDBusAbstractInterface::isValid() const'
/home/francisco/Documents/qBittorrent/src/base/utils/misc.cpp:181: undefined reference to `QDBusAbstractInterface::call(QString const&, QVariant const&, QVariant const&, QVariant const&, QVariant const&, QVariant const&, QVariant const&, QVariant const&, QVariant const&)'
/home/francisco/Documents/qBittorrent/src/base/utils/misc.cpp:208: undefined reference to `QDBusMessage::~QDBusMessage()'
/home/francisco/Documents/qBittorrent/src/base/utils/misc.cpp:209: undefined reference to `QDBusInterface::~QDBusInterface()'
/home/francisco/Documents/qBittorrent/src/base/utils/misc.cpp:206: undefined reference to `QDBusConnection::systemBus()'
/home/francisco/Documents/qBittorrent/src/base/utils/misc.cpp:206: undefined reference to `QDBusInterface::QDBusInterface(QString const&, QString const&, QString const&, QDBusConnection const&, QObject*)'
misc.o: In function `Utils::Misc::shutdownComputer(ShutdownDialogAction const&)':
/usr/include/x86_64-linux-gnu/qt5/QtCore/qstring.h:1084: undefined reference to `QDBusConnection::~QDBusConnection()'
misc.o: In function `Utils::Misc::shutdownComputer(ShutdownDialogAction const&)':
/home/francisco/Documents/qBittorrent/src/base/utils/misc.cpp:207: undefined reference to `QDBusAbstractInterface::isValid() const'
/home/francisco/Documents/qBittorrent/src/base/utils/misc.cpp:208: undefined reference to `QDBusAbstractInterface::call(QString const&, QVariant const&, QVariant const&, QVariant const&, QVariant const&, QVariant const&, QVariant const&, QVariant const&, QVariant const&)'
/home/francisco/Documents/qBittorrent/src/base/utils/misc.cpp:186: undefined reference to `QDBusConnection::systemBus()'
/home/francisco/Documents/qBittorrent/src/base/utils/misc.cpp:186: undefined reference to `QDBusInterface::QDBusInterface(QString const&, QString const&, QString const&, QDBusConnection const&, QObject*)'
misc.o: In function `Utils::Misc::shutdownComputer(ShutdownDialogAction const&)':
/usr/include/x86_64-linux-gnu/qt5/QtCore/qstring.h:1084: undefined reference to `QDBusConnection::~QDBusConnection()'
misc.o: In function `Utils::Misc::shutdownComputer(ShutdownDialogAction const&)':
/home/francisco/Documents/qBittorrent/src/base/utils/misc.cpp:187: undefined reference to `QDBusAbstractInterface::isValid() const'
/home/francisco/Documents/qBittorrent/src/base/utils/misc.cpp:191: undefined reference to `QDBusAbstractInterface::call(QString const&, QVariant const&, QVariant const&, QVariant const&, QVariant const&, QVariant const&, QVariant const&, QVariant const&, QVariant const&)'
/home/francisco/Documents/qBittorrent/src/base/utils/misc.cpp:215: undefined reference to `QDBusMessage::~QDBusMessage()'
/home/francisco/Documents/qBittorrent/src/base/utils/misc.cpp:216: undefined reference to `QDBusInterface::~QDBusInterface()'
/home/francisco/Documents/qBittorrent/src/base/utils/misc.cpp:213: undefined reference to `QDBusConnection::systemBus()'
/home/francisco/Documents/qBittorrent/src/base/utils/misc.cpp:213: undefined reference to `QDBusInterface::QDBusInterface(QString const&, QString const&, QString const&, QDBusConnection const&, QObject*)'
misc.o: In function `Utils::Misc::shutdownComputer(ShutdownDialogAction const&)':
/usr/include/x86_64-linux-gnu/qt5/QtCore/qstring.h:1084: undefined reference to `QDBusConnection::~QDBusConnection()'
misc.o: In function `Utils::Misc::shutdownComputer(ShutdownDialogAction const&)':
/home/francisco/Documents/qBittorrent/src/base/utils/misc.cpp:214: undefined reference to `QDBusAbstractInterface::isValid() const'
/home/francisco/Documents/qBittorrent/src/base/utils/misc.cpp:215: undefined reference to `QDBusAbstractInterface::call(QString const&, QVariant const&, QVariant const&, QVariant const&, QVariant const&, QVariant const&, QVariant const&, QVariant const&, QVariant const&)'
/home/francisco/Documents/qBittorrent/src/base/utils/misc.cpp:179: undefined reference to `QDBusAbstractInterface::call(QString const&, QVariant const&, QVariant const&, QVariant const&, QVariant const&, QVariant const&, QVariant const&, QVariant const&, QVariant const&)'
/home/francisco/Documents/qBittorrent/src/base/utils/misc.cpp:221: undefined reference to `QDBusConnection::systemBus()'
/home/francisco/Documents/qBittorrent/src/base/utils/misc.cpp:221: undefined reference to `QDBusInterface::QDBusInterface(QString const&, QString const&, QString const&, QDBusConnection const&, QObject*)'
misc.o: In function `Utils::Misc::shutdownComputer(ShutdownDialogAction const&)':
/usr/include/x86_64-linux-gnu/qt5/QtCore/qstring.h:1084: undefined reference to `QDBusConnection::~QDBusConnection()'
misc.o: In function `Utils::Misc::shutdownComputer(ShutdownDialogAction const&)':
/home/francisco/Documents/qBittorrent/src/base/utils/misc.cpp:222: undefined reference to `QDBusAbstractInterface::call(QString const&, QVariant const&, QVariant const&, QVariant const&, QVariant const&, QVariant const&, QVariant const&, QVariant const&, QVariant const&)'
/home/francisco/Documents/qBittorrent/src/base/utils/misc.cpp:222: undefined reference to `QDBusMessage::~QDBusMessage()'
/home/francisco/Documents/qBittorrent/src/base/utils/misc.cpp:197: undefined reference to `QDBusInterface::~QDBusInterface()'
/home/francisco/Documents/qBittorrent/src/base/utils/misc.cpp:186: undefined reference to `QDBusInterface::~QDBusInterface()'
/home/francisco/Documents/qBittorrent/src/base/utils/misc.cpp:176: undefined reference to `QDBusInterface::~QDBusInterface()'
/home/francisco/Documents/qBittorrent/src/base/utils/misc.cpp:197: undefined reference to `QDBusConnection::systemBus()'
/home/francisco/Documents/qBittorrent/src/base/utils/misc.cpp:197: undefined reference to `QDBusInterface::QDBusInterface(QString const&, QString const&, QString const&, QDBusConnection const&, QObject*)'
misc.o: In function `Utils::Misc::shutdownComputer(ShutdownDialogAction const&)':
/usr/include/x86_64-linux-gnu/qt5/QtCore/qstring.h:1084: undefined reference to `QDBusConnection::~QDBusConnection()'
misc.o: In function `Utils::Misc::shutdownComputer(ShutdownDialogAction const&)':
/home/francisco/Documents/qBittorrent/src/base/utils/misc.cpp:201: undefined reference to `QDBusAbstractInterface::call(QString const&, QVariant const&, QVariant const&, QVariant const&, QVariant const&, QVariant const&, QVariant const&, QVariant const&, QVariant const&)'
/home/francisco/Documents/qBittorrent/src/base/utils/misc.cpp:199: undefined reference to `QDBusAbstractInterface::call(QString const&, QVariant const&, QVariant const&, QVariant const&, QVariant const&, QVariant const&, QVariant const&, QVariant const&, QVariant const&)'
/home/francisco/Documents/qBittorrent/src/base/utils/misc.cpp:199: undefined reference to `QDBusMessage::~QDBusMessage()'
/home/francisco/Documents/qBittorrent/src/base/utils/misc.cpp:189: undefined reference to `QDBusAbstractInterface::call(QString const&, QVariant const&, QVariant const&, QVariant const&, QVariant const&, QVariant const&, QVariant const&, QVariant const&, QVariant const&)'
/home/francisco/Documents/qBittorrent/src/base/utils/misc.cpp:221: undefined reference to `QDBusInterface::~QDBusInterface()'
/home/francisco/Documents/qBittorrent/src/base/utils/misc.cpp:213: undefined reference to `QDBusInterface::~QDBusInterface()'
/home/francisco/Documents/qBittorrent/src/base/utils/misc.cpp:206: undefined reference to `QDBusInterface::~QDBusInterface()'
/home/francisco/Documents/qBittorrent/src/base/utils/misc.cpp:206: undefined reference to `QDBusConnection::~QDBusConnection()'
/home/francisco/Documents/qBittorrent/src/base/utils/misc.cpp:197: undefined reference to `QDBusInterface::~QDBusInterface()'
/home/francisco/Documents/qBittorrent/src/base/utils/misc.cpp:186: undefined reference to `QDBusInterface::~QDBusInterface()'
/home/francisco/Documents/qBittorrent/src/base/utils/misc.cpp:208: undefined reference to `QDBusConnection::~QDBusConnection()'
/home/francisco/Documents/qBittorrent/src/base/utils/misc.cpp:208: undefined reference to `QDBusConnection::~QDBusConnection()'
/home/francisco/Documents/qBittorrent/src/base/utils/misc.cpp:208: undefined reference to `QDBusConnection::~QDBusConnection()'
moc_application.o: In function `Application::qt_metacall(QMetaObject::Call, int, void**)':
/home/francisco/Documents/qBittorrent/src/moc_application.cpp:115: undefined reference to `QApplication::qt_metacall(QMetaObject::Call, int, void**)'
moc_application.o: In function `Application::qt_metacast(char const*)':
/home/francisco/Documents/qBittorrent/src/moc_application.cpp:110: undefined reference to `QApplication::qt_metacast(char const*)'
moc_application.o:(.data.rel.ro._ZTI11Application[_ZTI11Application]+0x10): undefined reference to `typeinfo for QApplication'
moc_application.o:(.data.rel.ro._ZTV11Application[_ZTV11Application]+0x38): undefined reference to `QApplication::event(QEvent*)'
moc_application.o:(.data.rel.ro._ZTV11Application[_ZTV11Application]+0x70): undefined reference to `QApplication::notify(QObject*, QEvent*)'
moc_application.o:(.data.rel.ro._ZTV11Application[_ZTV11Application]+0x78): undefined reference to `QApplication::compressEvent(QEvent*, QObject*, QPostEventList*)'
moc_application.o:(.data.rel.ro+0x0): undefined reference to `QApplication::staticMetaObject'
collect2: error: ld returned 1 exit status
Makefile:611: recipe for target 'qbittorrent-nox' failed
make[1]: *** [qbittorrent-nox] Error 1
make[1]: Leaving directory '/home/francisco/Documents/qBittorrent/src'
Makefile:44: recipe for target 'sub-src-make_first' failed
make: *** [sub-src-make_first] Error 2
xavier2k6 commented 10 months ago

@qbittorrent/bug-handlers The use of qmake etc. was removed in master so this can be classed as irrelevant at this stage correct?

thalieht commented 8 months ago

Yep.