-
Notifications
You must be signed in to change notification settings - Fork 140
ostinato.git: mld.cpp:(.text+0x901): undefined reference to `unsigned long qbswap<unsigned long>(unsigned long) #265
Comments
@a17r What OS/Distro/Version are you running? What is the Qt version? |
This is Gentoo Linux with Qt 5.11.0. Other dependencies are |
See if adding a Is this happening with 32-bit compilation also? |
Unfortunately no change... |
I also saw this issue when attempting to use the latest ostinato commit (9a4e7e7) on a x86_64 Fedora 28 machine with Qt 5.10.1, protobuf 3.5.0 and libpcap 1.8.1. I was able to work around it by adding the following block of code to define the C++ template implementation to the common/mld.cpp file: template <> inline Q_DECL_CONSTEXPR unsigned long qbswap<unsigned long>(unsigned long source) {
if (sizeof(unsigned long) == 8) {
return qbswap<quint64>(quint64(source));
} else {
return qbswap<quint32>(quint32(source));
}
} I inserted the code block right after the #includes near the top of the file: #include "mld.h"
#include "iputils.h"
#include <QHostAddress>
#include <QStringList>
template <> inline Q_DECL_CONSTEXPR unsigned long qbswap<unsigned long>(unsigned long source) {
if (sizeof(unsigned long) == 8) {
return qbswap<quint64>(quint64(source));
} else {
return qbswap<quint32>(quint32(source));
}
} This probably is not the best solution, but it allowed the build to complete. |
@paul-blankenbaker Thanks Paul! That's a valid workaround. However, I'm still not clear why this is even needed. Going by the fact that this happens only for mld.cpp, I tried to find what is unique in that file and not used elsewhere - seems mld is the only .proto that uses the protobuf |
I am uncertain as to why it is needed as well - the fixed64 must not be mapping back to something that has a declared template body. Maybe it has something to do with the fact that I am building with v3.5.0 (protobuf-3.5.0-4.fc28.x86_64 package on fedora). I have attached the gmp.pb.h and stp.pb.h files that are generated during the build that fails (the github interface required that I put them in a zip file). Hope that helps. |
I confirm this fixed the build. |
@paul-blankenbaker Thanks for the files. But unfortunately the files show both I'm hesitant to commit the workaround without understanding why it happens. Also, I worry in other environments adding the workaround may lead to duplicate definition errors |
I agree, I would not commit my work around as I think it is specific to my environment. And as you've mentioned, I would be worried about duplicate definition errors when building in other environments. |
even with the suggested patch
|
The work-around by paul-blankenbaker actually breaks building on my Gentoo with GCC 6.4, QT 5.9.6, libpcap 1.9.0 and protobuf 3.5.2. (The Gentoo package had the work-around/patch included by default.) Compiling without the work-around worked ;-) Before I discovered this, I Googled a bit and found a goldendict issue that might be related - look at the patch. Or maybe it's something different. |
By chance I got a system where I saw this problem and was able to debug and find root cause. For 64-bit arch, Qt defines
It would be good to get confirmation that the attached patch fixes the problem for others too before I commit it to the repo. |
@pstavirs , i can submit, that i can successfully build Ostinato (7b8c5a8) after applying patch 👍 My Environment : Ubuntu 18.10 (x64), GCC 8.2.0, libpcap-dev 1.8.1, libprotobuf-dev 3.0.0, qmake 3.1, QT 5.11.1 Thank You! |
git master does not build for me at this point, full build.log:
https://gist.github.com/a17r/47c7e19db125400fce6affab7019f457#file-ostinato-git-build-log-L394
The text was updated successfully, but these errors were encountered: