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

Build fails: undefined reference #185

Closed
alphapapa opened this issue Nov 2, 2017 · 13 comments
Closed

Build fails: undefined reference #185

alphapapa opened this issue Nov 2, 2017 · 13 comments
Assignees
Labels
question A question on Quaternion usage or development

Comments

@alphapapa
Copy link

I'm on Ubuntu 14.04.

$ git clone --recursive https://github.com/QMatrixClient/Quaternion.git
$ git submodule init
$ git submodule update
$ mkdir build_dir && cd build_dir
$ cmake ..
$ cmake --build . --target all
...
lib/libqmatrixclient.a(room.cpp.o): In function `QMatrixClient::operator<<(QDebug, QMatrixClient::Event::Type)':
/home/me/src/misc/Quaternion/lib/events/event.h:75: undefined reference to `QMatrixClient::Event::staticMetaObject'
/home/me/src/misc/Quaternion/lib/events/event.h:75: undefined reference to `QMatrixClient::Event::staticMetaObject'
lib/libqmatrixclient.a(roommessageevent.cpp.o): In function `QMatrixClient::operator<<(QDebug, QMatrixClient::RoomMessageEvent::MsgType)':
/home/me/src/misc/Quaternion/lib/events/roommessageevent.h:68: undefined reference to `QMatrixClient::RoomMessageEvent::staticMetaObject'
/home/me/src/misc/Quaternion/lib/events/roommessageevent.h:68: undefined reference to `QMatrixClient::Event::staticMetaObject'

Thanks.

@KitsuneRal KitsuneRal self-assigned this Nov 2, 2017
@KitsuneRal
Copy link
Member

Judging by the looks of it, there's something wrong with REGISTER_ENUM macro. I cannot reproduce the issue though. Do you have Qt4 include files around, by any chance? What versions did cmake .. report?

@alphapapa
Copy link
Author

Do you have Qt4 include files around, by any chance?

I do have the libqt4-dev package installed. I build KDE/Qt4 apps occasionally.

What versions did cmake .. report?

$ cmake ..
-- The CXX compiler identification is GNU 4.8.4
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- 
-- =============================================================================
--                           Quaternion Build Information
-- =============================================================================
-- Build type: Debug
-- Using compiler: GNU 4.8.4
-- Using Qt 5.2.1 at /usr
-- Quaternion install prefix: /usr/local
-- =============================================================================
-- 
-- The C compiler identification is GNU 4.8.4
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- 
-- =============================================================================
--                        libqmatrixclient Build Information
-- =============================================================================
-- Build type: Debug
-- Using compiler: GNU 4.8.4
-- Using Qt 5.2.1 at /usr
-- =============================================================================
-- 
CMake Warning (dev) at /usr/lib/x86_64-linux-gnu/cmake/Qt5Core/Qt5CoreMacros.cmake:224 (configure_file):
  configure_file called with unknown argument(s):

   COPY_ONLY

Call Stack (most recent call first):
  CMakeLists.txt:88 (QT5_ADD_RESOURCES)
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Configuring done
-- Generating done
-- Build files have been written to: /home/me/src/misc/Quaternion/build_dir

Thanks.

@alphapapa
Copy link
Author

I was able to build https://github.com/mujx/nheko following its instructions to use Qt 5.8, so I tried building Quaternion with Qt 5.8 and it worked.

I would really prefer to build it with the distro Qt, because I had to install 5.8 from a PPA that nheko recommends, but which I don't know anything about. But I don't know if it is feasible for you to fix it with 5.2.1. If not, maybe the minimum version should be increased in the instructions.

Thanks for your help.

@alphapapa
Copy link
Author

alphapapa commented Nov 2, 2017

Well, I say it worked: it appeared to work, but it doesn't run:

$ quaternion
quaternion: /usr/lib/x86_64-linux-gnu/libQt5Qml.so.5: no version information available (required by quaternion)
quaternion: /usr/lib/x86_64-linux-gnu/libQt5Quick.so.5: no version information available (required by quaternion)
quaternion: /usr/lib/x86_64-linux-gnu/libQt5Network.so.5: no version information available (required by quaternion)
quaternion: /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5: no version information available (required by quaternion)
quaternion: /usr/lib/x86_64-linux-gnu/libQt5Core.so.5: no version information available (required by quaternion)
quaternion: /usr/lib/x86_64-linux-gnu/libQt5Core.so.5: no version information available (required by quaternion)
quaternion: /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5: no version information available (required by quaternion)
quaternion: relocation error: quaternion: symbol qt_version_tag, version Qt_5.8 not defined in file libQt5Core.so.5 with link time reference

It looks like it's trying to use the distro Qt instead of the PPA package that installed into /opt/qt58.

I built it like this:

$ cd build_dir
$ cmake -DCMAKE_PREFIX_PATH=/opt/qt58/ ..
$ cmake --build . --target all

@alphapapa
Copy link
Author

I remembered something from the PPA description:

Source /opt/qt58/bin/qt58-env.sh to set the correct environment.

Using that (it also works as a wrapper script), it seems to work!

@alphapapa
Copy link
Author

Well, I say it seems to work, but no messages are displayed. I see in the readme that it is likely a problem with QtQuick, and I don't see a 5.8 version of that in the PPA I'm using for Qt 5.8, so I guess I'm stuck.

@KitsuneRal
Copy link
Member

In fact, libqmatrixclient should build just fine with Qt 5.2.1, and the CI environment ensures that on a daily basis. So there's clearly some trouble with your environment. Just to check, can you remove libqt4-dev for a minute and try building with the stock Trusty Qt again? We'll at least localise the trouble then.

@KitsuneRal
Copy link
Member

And yes, no messages mean that Quaternion could not get a hold of Qt Quick (+plugins - as mentioned in README.md). Let's figure what's wrong with the Qt 5.2.1 environment.

@alphapapa
Copy link
Author

alphapapa commented Nov 2, 2017

Ok, I removed libqt4-dev and rebuilt, and the build completed without errors. Then I installed and ran it. It runs, and I can send messages, but still no messages are displayed. I see this in the console:

$ quaternion
Debug:  false 
qrc:///qml/chat.qml:5:1: module "Qt.labs.settings" is not installed 
--- Show time! 
QXcbWindow: Unhandled client message: "_QTCURVE_ACTIVE_WINDOW_" 
libqmatrixclient.jobs: "MediaThumbnailJob" status 104 : "Error downloading https://matrix.org/_matrix/media/v1/thumbnail/?width=16&height=16&method=scale - server replied: Not Found" 
Connected to room "!nnldzrRaEKzhEnLmjB:matrix.org" as "@alphapapa:matrix.org" 
2 user(s) in the room 
libqmatrixclient.jobs: "MediaThumbnailJob" status 104 : "Error downloading https://matrix.org/_matrix/media/v1/thumbnail/?width=30&height=30&method=scale - server replied: Not Found" 
libqmatrixclient.jobs: "MediaThumbnailJob" status 104 : "Error downloading https://matrix.org/_matrix/media/v1/thumbnail/?width=25&height=25&method=scale - server replied: Not Found" 
QXcbWindow: Unhandled client message: "_QTCURVE_ACTIVE_WINDOW_"

Thanks.

@alphapapa
Copy link
Author

alphapapa commented Nov 2, 2017

Ok, fixed that by installing the qtdeclarative5-settings-plugin package. I guess that should be added to the prereqs list. Seems to be working pretty well now!

@KitsuneRal KitsuneRal added the question A question on Quaternion usage or development label Nov 2, 2017
@KitsuneRal
Copy link
Member

Uhm, that is a good catch indeed. Quaternion does use Qt.lab.settings these days but the respective plugin is not mentioned in README.md. Thanks for finding out!

@alphapapa
Copy link
Author

You might also want to mention that libqt4-dev and/or other Qt4-related dev packages may cause conflicts in the build process.

@KitsuneRal
Copy link
Member

Mentioned that, thank you; and in the end removed Qt.labs.Settings usage entirely.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question A question on Quaternion usage or development
Projects
None yet
Development

No branches or pull requests

2 participants