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

test qt components #5922

Closed
wants to merge 2 commits into from

Conversation

AndreyMlashkin
Copy link
Contributor

@AndreyMlashkin AndreyMlashkin commented Jun 16, 2021

Specify library name and version: qt/5.15.2

I think, I am not an only one who would like to have a working example, demonstrating how to include different Qt modules in CMakeLists or *.pro file. test_package/ is a perfect place for it.

This is also a good place to share with all of us why you are submitting this PR (specially if it is a new addition to ConanCenter): is it a dependency of other libraries you want to package? Are you the author of the library? Thanks!


  • I've read the guidelines for contributing.
  • I've followed the PEP8 style guides for Python code in the recipes.
  • I've used the latest Conan client version.
  • I've tried at least one configuration locally with the
    conan-center hook activated.

@AndreyMlashkin
Copy link
Contributor Author

The test does not work for me:

[100%] Built target test_package
qt/5.15.2 (test package): Running test()
qt/5.15.2 (test package): Testing qmake
Resource content: "Hello World From Resource\n"
"Hello World!"
qt/5.15.2 (test package): Testing CMake_find_package_multi
qt.qpa.plugin: Could not find the Qt platform plugin "xcb" in ""
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Aborted (core dumped)
ERROR: qt/5.15.2 (test package): Error in test() method, line 115
self._test_with_cmake_find_package_multi()
while calling '_test_with_cmake_find_package_multi', line 109
self.run(os.path.join("bin", "test_package"), run_environment=True)
ConanException: Error 134 while executing bin/test_package

Does anyone have the same problem?

@conan-center-bot

This comment has been minimized.

@AndreyMlashkin
Copy link
Contributor Author

There is exactly the same problem in CI as I have locally

@ruilvo
Copy link
Contributor

ruilvo commented Jun 16, 2021

That probably means lack of deployment. Does this build Qt as a shared library? You can't use a Qt application before running [win/linux/mac]deployqt on it (that basically copies dlls over and creates files). It works magically on Qt Creator because it adds the Qt libs to path when you click the play button.

Now with the PR of proper Qt5 components, if you want to know how to use it, you can read the official documentation...

@ericLemanissier
Copy link
Contributor

ericLemanissier commented Jun 16, 2021

Do you have the problem only when using qt as a static library (which is the default)? Can you please try to use Q_IMPORT_PLUGIN ?

EDIT: the error you have is different from the one reported by the bot. In you case the executable built by qmake is able to run properly, but the executable built by cmake fails to find the xcb plugin. The bot fails to run the executable built by qmake because qt.qpa.xcb: could not connect to display, which is most probably because it runs in a headless environment.

@ruilvo
Copy link
Contributor

ruilvo commented Jun 16, 2021

Yeah, as @ericLemanissier said, this seems to be an issue with headless environments, and definitely lack of "deployment". Qt Applications aren't trivial to run.

@AndreyMlashkin
Copy link
Contributor Author

I have removed a gui part, so an example should be able to run on a headless system.

@ruilvo
Copy link
Contributor

ruilvo commented Jun 17, 2021

We'll find out in a couple hours after this really have library rebuilds in the CI :)

@AndreyMlashkin
Copy link
Contributor Author

I have tried to run macdeployqt with the old bincrafters recipe out of conanfile, but it didn't work on some reason for me.
If you have a working example of using it with conan installation, please share it.
Almost every user of this recipe will need it I think.

@ruilvo
Copy link
Contributor

ruilvo commented Jun 17, 2021

If you read the commit log, there was a patch explicitly for macdeploy Qt. I don't have a mac, sorry, so I can't give input.

@conan-center-bot
Copy link
Collaborator

Failure in build 2 (1982f81df9765d60f879e957e3b5388d1cbd6882):

  • qt/5.15.2@:
    CI failed to create some packages (All logs)

    Logs for packageID 5b01e44949b1acabd1cc7618e5cbbc0301b7c487:
    [settings]
    arch=x86_64
    arch_build=x86_64
    build_type=Release
    compiler=clang
    compiler.libcxx=libstdc++
    compiler.version=5.0
    os=Linux
    os_build=Linux
    [options]
    qt:shared=True
    
    [...]
    /home/conan/w/BuildSingleReference/.conan/data/qt/5.15.2/_/_/package/5b01e44949b1acabd1cc7618e5cbbc0301b7c487/lib/libQt5Network.so: undefined reference to `OpenSSL_version'
    /home/conan/w/BuildSingleReference/.conan/data/qt/5.15.2/_/_/package/5b01e44949b1acabd1cc7618e5cbbc0301b7c487/lib/libQt5Network.so: undefined reference to `BIO_meth_set_ctrl'
    /home/conan/w/BuildSingleReference/.conan/data/qt/5.15.2/_/_/package/5b01e44949b1acabd1cc7618e5cbbc0301b7c487/lib/libQt5Network.so: undefined reference to `BIO_meth_free'
    /home/conan/w/BuildSingleReference/.conan/data/qt/5.15.2/_/_/package/5b01e44949b1acabd1cc7618e5cbbc0301b7c487/lib/libQt5Network.so: undefined reference to `OPENSSL_sk_pop_free'
    /home/conan/w/BuildSingleReference/.conan/data/qt/5.15.2/_/_/package/5b01e44949b1acabd1cc7618e5cbbc0301b7c487/lib/libQt5Network.so: undefined reference to `SSL_SESSION_is_resumable'
    /home/conan/w/BuildSingleReference/.conan/data/qt/5.15.2/_/_/package/5b01e44949b1acabd1cc7618e5cbbc0301b7c487/lib/libQt5Network.so: undefined reference to `OPENSSL_sk_new_null'
    /home/conan/w/BuildSingleReference/.conan/data/qt/5.15.2/_/_/package/5b01e44949b1acabd1cc7618e5cbbc0301b7c487/lib/libQt5Network.so: undefined reference to `BIO_meth_set_puts'
    /home/conan/w/BuildSingleReference/.conan/data/qt/5.15.2/_/_/package/5b01e44949b1acabd1cc7618e5cbbc0301b7c487/lib/libQt5Network.so: undefined reference to `SSL_SESSION_get_ticket_lifetime_hint'
    /home/conan/w/BuildSingleReference/.conan/data/qt/5.15.2/_/_/package/5b01e44949b1acabd1cc7618e5cbbc0301b7c487/lib/libQt5Network.so: undefined reference to `SSL_set_options'
    /home/conan/w/BuildSingleReference/.conan/data/qt/5.15.2/_/_/package/5b01e44949b1acabd1cc7618e5cbbc0301b7c487/lib/libQt5Network.so: undefined reference to `OpenSSL_version_num'
    /home/conan/w/BuildSingleReference/.conan/data/qt/5.15.2/_/_/package/5b01e44949b1acabd1cc7618e5cbbc0301b7c487/lib/libQt5Network.so: undefined reference to `BN_is_word'
    /home/conan/w/BuildSingleReference/.conan/data/qt/5.15.2/_/_/package/5b01e44949b1acabd1cc7618e5cbbc0301b7c487/lib/libQt5Network.so: undefined reference to `OPENSSL_sk_value'
    /home/conan/w/BuildSingleReference/.conan/data/qt/5.15.2/_/_/package/5b01e44949b1acabd1cc7618e5cbbc0301b7c487/lib/libQt5Network.so: undefined reference to `DH_get0_pqg'
    /home/conan/w/BuildSingleReference/.conan/data/qt/5.15.2/_/_/package/5b01e44949b1acabd1cc7618e5cbbc0301b7c487/lib/libQt5Network.so: undefined reference to `TLS_client_method'
    /home/conan/w/BuildSingleReference/.conan/data/qt/5.15.2/_/_/package/5b01e44949b1acabd1cc7618e5cbbc0301b7c487/lib/libQt5Network.so: undefined reference to `EVP_PKEY_up_ref'
    /home/conan/w/BuildSingleReference/.conan/data/qt/5.15.2/_/_/package/5b01e44949b1acabd1cc7618e5cbbc0301b7c487/lib/libQt5Network.so: undefined reference to `X509_up_ref'
    /home/conan/w/BuildSingleReference/.conan/data/qt/5.15.2/_/_/package/5b01e44949b1acabd1cc7618e5cbbc0301b7c487/lib/libQt5Network.so: undefined reference to `BIO_get_data'
    /home/conan/w/BuildSingleReference/.conan/data/qt/5.15.2/_/_/package/5b01e44949b1acabd1cc7618e5cbbc0301b7c487/lib/libQt5Network.so: undefined reference to `BIO_set_init'
    /home/conan/w/BuildSingleReference/.conan/data/qt/5.15.2/_/_/package/5b01e44949b1acabd1cc7618e5cbbc0301b7c487/lib/libQt5Network.so: undefined reference to `DTLSv1_listen'
    /home/conan/w/BuildSingleReference/.conan/data/qt/5.15.2/_/_/package/5b01e44949b1acabd1cc7618e5cbbc0301b7c487/lib/libQt5Network.so: undefined reference to `X509_getm_notAfter'
    /home/conan/w/BuildSingleReference/.conan/data/qt/5.15.2/_/_/package/5b01e44949b1acabd1cc7618e5cbbc0301b7c487/lib/libQt5Network.so: undefined reference to `DSA_bits'
    /home/conan/w/BuildSingleReference/.conan/data/qt/5.15.2/_/_/package/5b01e44949b1acabd1cc7618e5cbbc0301b7c487/lib/libQt5Network.so: undefined reference to `SSL_in_init'
    /home/conan/w/BuildSingleReference/.conan/data/qt/5.15.2/_/_/package/5b01e44949b1acabd1cc7618e5cbbc0301b7c487/lib/libQt5Network.so: undefined reference to `SSL_get_client_random'
    /home/conan/w/BuildSingleReference/.conan/data/qt/5.15.2/_/_/package/5b01e44949b1acabd1cc7618e5cbbc0301b7c487/lib/libQt5Network.so: undefined reference to `X509_STORE_set_ex_data'
    /home/conan/w/BuildSingleReference/.conan/data/qt/5.15.2/_/_/package/5b01e44949b1acabd1cc7618e5cbbc0301b7c487/lib/libQt5Network.so: undefined reference to `BIO_set_shutdown'
    /home/conan/w/BuildSingleReference/.conan/data/qt/5.15.2/_/_/package/5b01e44949b1acabd1cc7618e5cbbc0301b7c487/lib/libQt5Network.so: undefined reference to `BIO_meth_set_read'
    /home/conan/w/BuildSingleReference/.conan/data/qt/5.15.2/_/_/package/5b01e44949b1acabd1cc7618e5cbbc0301b7c487/lib/libQt5Network.so: undefined reference to `SSL_CTX_set_ciphersuites'
    /home/conan/w/BuildSingleReference/.conan/data/qt/5.15.2/_/_/package/5b01e44949b1acabd1cc7618e5cbbc0301b7c487/lib/libQt5Network.so: undefined reference to `X509_get_version'
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    ninja: build stopped: subcommand failed.
    dpkg-query: no packages found matching libgl1-mesa-dev
    debconf: delaying package configuration, since apt-utils is not installed
    dpkg-query: no packages found matching xorg-dev
    dpkg-query: no packages found matching libxcb-render-util0-dev
    dpkg-query: no packages found matching libxcb-xkb-dev
    dpkg-query: no packages found matching libxcb-icccm4-dev
    dpkg-query: no packages found matching libxcb-image0-dev
    dpkg-query: no packages found matching libxcb-keysyms1-dev
    dpkg-query: no packages found matching libxcb-xinerama0-dev
    dpkg-query: no packages found matching xkb-data
    dpkg-query: no packages found matching libxcb-util-dev
    debconf: delaying package configuration, since apt-utils is not installed
    
    Generating targets:   0%|                                                     | 0/2 [00:00<?, ?it/s]
                                                                                                        
    
    Writing build.ninja:   0%|                                                   | 0/32 [00:00<?, ?it/s]
                                                                                                        
    ninja/1.10.2: WARN: Lib folder doesn't exist, can't collect libraries: /home/conan/w/BuildSingleReference/.conan/data/ninja/1.10.2/_/_/package/24647d9fe8ec489125dfbae4b3ebefaf7581674c/lib
    xorg/system: WARN: Lib folder doesn't exist, can't collect libraries: /home/conan/w/BuildSingleReference/.conan/data/xorg/system/_/_/package/5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9/lib
    meson/0.57.1: WARN: Lib folder doesn't exist, can't collect libraries: /home/conan/w/BuildSingleReference/.conan/data/meson/0.57.1/_/_/package/5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9/lib
    ERROR: qt/5.15.2 (test package): Error in build() method, line 89
    	self._build_with_meson()
    while calling '_build_with_meson', line 74
    	meson.build()
    	ConanException: Error 1 while executing ninja -C "/home/conan/w/BuildSingleReference/conan-center-index/recipes/qt/5.x.x/test_package/build/86bd178fe3d9cca7db66975d8353900dac10e60c/meson_folder"
    

Note: To save resources, CI tries to finish as soon as an error is found. For this reason you might find that not all the references have been launched or not all the configurations for a given reference. Also, take into account that we cannot guarantee the order of execution as it depends on CI workload and workers availability.

@AndreyMlashkin
Copy link
Contributor Author

For all interested, this code allows to create a runnable qt executable with all plugins for gui.
The only problem is that it fails on Linux because of symlinks, but still imports all needed files.

def imports(self):
   self.copy("*.dll",           dst="bin", src="bin"    , keep_path=True)
   self.copy("*.dll",           dst="bin", src="plugins", keep_path=True)
   
   self.copy("*.dylib",         dst="bin", src="lib"    , keep_path=True)
   self.copy("*.dylib",         dst="bin", src="plugins", keep_path=True)
   
   self.copy("*.so",            dst="bin", src="lib"    , keep_path=True)
   self.copy("*.so",            dst="bin", src="plugins", keep_path=True)

I have reported this issue a while ago
conan-io/conan#9084

@ruilvo
Copy link
Contributor

ruilvo commented Jun 17, 2021

Wouldn't run [win|mac|linux]deployqt be must better in this scenario?
This is an example of the code I've used before in Windows + CMake:

  # On Windows, run windeployqt after building
  if(WIN32)
    # Run winddeployqt if it can be found
    find_program(
      WINDEPLOYQT_EXECUTABLE
      NAMES windeployqt
      HINTS ${QTDIR} ENV QTDIR
      PATH_SUFFIXES bin)
    add_custom_command(
      TARGET qt5_example
      POST_BUILD
      COMMAND ${WINDEPLOYQT_EXECUTABLE} $<TARGET_FILE:qt5_example>)
  endif()

@ghost
Copy link

ghost commented Jun 17, 2021

I detected other pull requests that are modifying qt/5.x.x recipe:

This message is automatically generated by https://github.com/ericLemanissier/conan-center-conflicting-prs so don't hesitate to report issues/improvements there.

@Renari
Copy link
Contributor

Renari commented Jun 17, 2021

For all interested, this code allows to create a runnable qt executable with all plugins for gui.
The only problem is that it fails on Linux because of symlinks, but still imports all needed files.

def imports(self):
   self.copy("*.dll",           dst="bin", src="bin"    , keep_path=True)
   self.copy("*.dll",           dst="bin", src="plugins", keep_path=True)
   
   self.copy("*.dylib",         dst="bin", src="lib"    , keep_path=True)
   self.copy("*.dylib",         dst="bin", src="plugins", keep_path=True)
   
   self.copy("*.so",            dst="bin", src="lib"    , keep_path=True)
   self.copy("*.so",            dst="bin", src="plugins", keep_path=True)

I have reported this issue a while ago
conan-io/conan#9084

It fails because you copy the symlinks e.g. mylibrary.so which is a symlink to mylibrary.so.5.15.2 which does not get copied by the above commands, thus you end up with a broken symlink.

@AndreyMlashkin
Copy link
Contributor Author

This code worked with bincrafters recipe:

   self.copy("*.so.*.*.*", dst="bin", src="lib", keep_path=True)
   self.copy("*.so", dst="bin", src="plugins", keep_path=True)

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 this pull request may close these issues.

5 participants