Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'undefined reference' after autofilereloader commit #13755

Closed
mccowanm opened this issue Oct 11, 2024 · 18 comments · Fixed by #13756
Closed

'undefined reference' after autofilereloader commit #13755

mccowanm opened this issue Oct 11, 2024 · 18 comments · Fixed by #13756
Labels

Comments

@mccowanm
Copy link

mccowanm commented Oct 11, 2024

Bug Description

Hello,
After 45363b7 builds no longer work against main, failing when linking the mixxx executable with the errors below.
Fresh builds (on Gentoo x86, QT 6.7.2) on prior commits run to completion.
Unfortunately I don't have the Qt skills to attempt a patch.

Many thanks for a great piece of software
Matt

/usr/lib/gcc/x86_64-pc-linux-gnu/13/../../../../x86_64-pc-linux-gnu/bin/ld: libmixxx-qml-lib.a(qmlapplication.cpp.o): in function `mixxx::qml::QmlApplication::~QmlApplication()':
/home/matt/mixxx/src/qml/qmlapplication.cpp:80:(.text+0x11c6): undefined reference to `vtable for AutoFileReloader'
/usr/lib/gcc/x86_64-pc-linux-gnu/13/../../../../x86_64-pc-linux-gnu/bin/ld: libmixxx-qml-lib.a(qmlapplication.cpp.o): in function `AutoFileReloader::~AutoFileReloader()':
/home/matt/mixxx/src/util/autofilereloader.h:9:(.text._ZN16AutoFileReloaderD2Ev[_ZN16AutoFileReloaderD5Ev]+0x1c): undefined reference to `vtable for AutoFileReloader'
/usr/lib/gcc/x86_64-pc-linux-gnu/13/../../../../x86_64-pc-linux-gnu/bin/ld: libmixxx-qml-lib.a(qmlapplication.cpp.o): in function `AutoFileReloader::~AutoFileReloader()':
/home/matt/mixxx/src/util/autofilereloader.h:9:(.text._ZN16AutoFileReloaderD0Ev[_ZN16AutoFileReloaderD5Ev]+0x1c): undefined reference to `vtable for AutoFileReloader'
/usr/lib/gcc/x86_64-pc-linux-gnu/13/../../../../x86_64-pc-linux-gnu/bin/ld: libmixxx-qml-lib.a(qmlautoreload.cpp.o): in function `mixxx::qml::QmlAutoReload::QmlAutoReload()':
/home/matt/mixxx/src/qml/qmlautoreload.cpp:15:(.text+0x234c): undefined reference to `AutoFileReloader::AutoFileReloader(RuntimeLoggingCategory const&)'
/usr/lib/gcc/x86_64-pc-linux-gnu/13/../../../../x86_64-pc-linux-gnu/bin/ld: /home/matt/mixxx/src/qml/qmlautoreload.cpp:17:(.text+0x236e): undefined reference to `AutoFileReloader::fileChanged(QString const&)'
/usr/lib/gcc/x86_64-pc-linux-gnu/13/../../../../x86_64-pc-linux-gnu/bin/ld: libmixxx-qml-lib.a(qmlautoreload.cpp.o): in function `QMetaObject::Connection QObject::connect<void (AutoFileReloader::*)(QString const&), void (mixxx::qml::QmlAutoReload::*)()>(QtPrivate::FunctionPointer<void (AutoFileReloader::*)(QString const&)>::Object const*, void (AutoFileReloader::*)(QString const&), QtPrivate::ContextTypeForFunctor<void (mixxx::qml::QmlAutoReload::*)(), void>::ContextType const*, void (mixxx::qml::QmlAutoReload::*&&)(), Qt::ConnectionType)':
/usr/include/qt6/QtCore/qobject.h:263:(.text+0x23d6): undefined reference to `AutoFileReloader::staticMetaObject'
/usr/lib/gcc/x86_64-pc-linux-gnu/13/../../../../x86_64-pc-linux-gnu/bin/ld: libmixxx-qml-lib.a(qmlautoreload.cpp.o): in function `non-virtual thunk to mixxx::qml::QmlAutoReload::~QmlAutoReload()':
/home/matt/mixxx/src/qml/qmlautoreload.h:11:(.text._ZN5mixxx3qml13QmlAutoReloadD2Ev[_ZN5mixxx3qml13QmlAutoReloadD5Ev]+0x2f): undefined reference to `vtable for AutoFileReloader'
/usr/lib/gcc/x86_64-pc-linux-gnu/13/../../../../x86_64-pc-linux-gnu/bin/ld: libmixxx-qml-lib.a(qmlautoreload.cpp.o): in function `mixxx::qml::QmlAutoReload::~QmlAutoReload()':
/home/matt/mixxx/src/qml/qmlautoreload.h:11:(.text._ZN5mixxx3qml13QmlAutoReloadD2Ev[_ZN5mixxx3qml13QmlAutoReloadD5Ev]+0x44f): undefined reference to `vtable for AutoFileReloader'
/usr/lib/gcc/x86_64-pc-linux-gnu/13/../../../../x86_64-pc-linux-gnu/bin/ld: libmixxx-qml-lib.a(qmlautoreload.cpp.o): in function `non-virtual thunk to mixxx::qml::QmlAutoReload::~QmlAutoReload()':
/home/matt/mixxx/src/qml/qmlautoreload.h:11:(.text._ZN5mixxx3qml13QmlAutoReloadD0Ev[_ZN5mixxx3qml13QmlAutoReloadD5Ev]+0x33): undefined reference to `vtable for AutoFileReloader'
/usr/lib/gcc/x86_64-pc-linux-gnu/13/../../../../x86_64-pc-linux-gnu/bin/ld: libmixxx-qml-lib.a(qmlautoreload.cpp.o): in function `mixxx::qml::QmlAutoReload::~QmlAutoReload()':
/home/matt/mixxx/src/qml/qmlautoreload.h:11:(.text._ZN5mixxx3qml13QmlAutoReloadD0Ev[_ZN5mixxx3qml13QmlAutoReloadD5Ev]+0x45f): undefined reference to `vtable for AutoFileReloader'

Version

34dde6f

OS

gentoo

@mccowanm mccowanm added the bug label Oct 11, 2024
@acolombier
Copy link
Member

src/qml/qmlautoreload.cpp:15:(.text+0x234c): undefined reference to `AutoFileReloader::AutoFileReloader(RuntimeLoggingCategory const&)

Looks like the signal symbol is not autogen correctly. What's strange is your are using 45363b7 but the QML file loader (introducing the AutoFileReloader changes) was only merged one commit after. Could you try with 21f4c88? Also, may I ask you to try with a clean build as well?

image

@Swiftb0y
Copy link
Member

thats, weird. I'll try to look into it.

@Swiftb0y
Copy link
Member

@mccowanm unfortunately I can't reproduce locally. Nevertheless, I did forget to declare a virtual destructor explicitly, so that may be the issue. Can you please try a clean build and additionally #13756?

@Swiftb0y
Copy link
Member

Actually, this is failing to link libmixxx-qml-lib. I have QML=OFF locally unfortunately due to (imo) broken fedora packages.

I think I figured it out. 707a08f

Shouldn't this have been caught by the CI though?

@acolombier
Copy link
Member

Shouldn't this have been caught by the CI though?

This doesn't seem to occur on Qt 6.2.4 with QML=ON, which is the Qt version used by our 22.04 runner. I guess we could soon consider adding 24.04 runners, thought they are only using Qt 6.4.

@Swiftb0y
Copy link
Member

Swiftb0y commented Oct 12, 2024

I don't think the qt version matters much. The problem is simply that qmlfilereloader depends on autoreloader, but the latter was not getting linked to the former because the former is part of a different target. I didn't catch this at that time because due to the packaging issues, I'm currently not building the qml target, but those linker errors should've been caught by CI which does build it.

@acolombier
Copy link
Member

As I said I cannot reproduce it either, so I don't think it's fair to expect the CI to catch those either. This means that there is something else that seems to come in the equation.
As the original logs, the symbol to the signal was missing, a symbol generated by autogen AFAIK, thus why I suggested the Qt version.

@Swiftb0y
Copy link
Member

I think its the entire vtable

/home/matt/mixxx/src/qml/qmlapplication.cpp:80:(.text+0x11c6): undefined reference to `vtable for AutoFileReloader'

But anyways. Pretty sure its fixed by 707a08f. @mccowanm could you do us a favor and test that since no else can currently reproduce this commit?

@pvagner
Copy link

pvagner commented Oct 12, 2024

Hello,
I am on arch-linux with qt6 6.7.3 and I also need this commit in order to link successfully.
Thanks for looking into it.

@Swiftb0y
Copy link
Member

Thank you for confirming.

@daschuer
Copy link
Member

Launchpad has also caught the issue:
https://launchpad.net/~mixxx/+archive/ubuntu/nightlies/+packages

I was pinged by it but have not instantly found the failing error message which is on line 9523 of 9685. We have also the issue that Launchpad build fails now and then because of stalled tests. So I did a rebuild as a first try.

Unlike on Launchpad we use mold as linker on GitHub? This probably manage to find the missing reference in the final link stage.

@Swiftb0y I think you can in addition remove src/util/autofilereloader.cpp from mixxx-lib

@fwcd
Copy link
Member

fwcd commented Oct 13, 2024

Ran into the same issue with my mostly static Linux build, but wasn't sure if this was some issue with my unusual build environment. CI seems to have reproduced it reliably for the past few days: https://github.com/fwcd/m1xxx/actions/runs/11310446122/job/31455509966

@Swiftb0y
Copy link
Member

I think you can in addition remove src/util/autofilereloader.cpp from mixxx-lib

I could in theory, though the purpose of the autofilereloader is to be used outside of QML. So when someone eventually incorporates it into the mixxx-lib, we'll repeat this same debacle again. So I would prefer to keep it in both because I don't see any downside to it tbh.

@daschuer
Copy link
Member

I don't agree. We should only add currently required link scripts to libraries to avoid to have two time the same function in the linker resources. I think this debacle is an indicator that our library structure is not yet correct. We have a criss cross dependency between mixxx-lib and mixxx-qml-lib which need to be solved.
Since QML will allways be defined in main, maybe it would be staright forward to retire that flag?
Alternative would be to add a new independent lib for all these QML/Widget less classes-

@Swiftb0y
Copy link
Member

I agree that we should start separating mixxx into smaller modules.

We have a criss cross dependency between mixxx-lib and mixxx-qml-lib which need to be solved.

I think this is technically more similar to a diamond dependency problem. Why is this a problem? I would expect the linker to deduplicate symbols used multiple times.

@fwcd
Copy link
Member

fwcd commented Oct 13, 2024

If we still have a way of building the GUI without QML it would be really useful to keep that flag IMO, if only for testing purposes.

@Swiftb0y
Copy link
Member

I agree, especially since its currently broken (for me) on fedora 40.

@mccowanm
Copy link
Author

707a08f does indeed fix a build on Gentoo thanks @Swiftb0y

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants