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

[qt5-base] [runtime-error] Qt5 port appears broken in WSL (Ubuntu 22.04) #43158

Open
tstrutz opened this issue Jan 7, 2025 · 1 comment
Open
Assignees
Labels
category:port-bug The issue is with a library, which is something the port should already support

Comments

@tstrutz
Copy link

tstrutz commented Jan 7, 2025

Describe the bug
I am using Qt5 within a WSL instance on Ubuntu 22.04 distro in a project using two dynamic libraries. One dynamic library contains the QApplication and a signal processing algorithm and the other library extends the original application's behavior. The Qt5 framework works properly within the base dynamic library and ONLY within that library when using vcpkg's port. I spent about a week investigating this before realizing that the port may be just broken in WSL. Apparently this works on normal Windows. I don't know if non-WSL Linux is affected.

I tested this using the Qt5 system packages and it works correctly. I removed qt5base requirements from everything including QCustomPlot (using a port overlay) to accomplish that.

Correct output using system qt packages (qtbase5-dev) which WORKS:

---- QApplication is created here ---
QStandardPaths: wrong permissions on runtime directory /run/user/1000/, 0755 instead of 0700
USING extension_lib processed detection figure factory
Application instance (main):  QApplication(0x55dd76ce4d20)
Waiting for first items to be streamed from algorithm. 
Thread Pool Reset
Starting algorithm.
Current QT version (base_lib.so)  5.15.3
Application instance (base_lib.so):  QApplication(0x55dd76ce4d20)
Application instance (extension_lib.so):  QApplication(0x55dd76ce4d20)
Current QT version (extension_lib.so)  5.15.3
Figure is fine.
extension_lib::gui::figures::ProcessedDetectionFigure(0x7f7460006fe0)
Parent is fine.
QCustomPlot(0x55dd77318ee0)

Environment

  • OS: [WSL2.3.26.0 Ubuntu 22.04]
  • Compiler: GCC 11.4.0

To Reproduce
Steps to reproduce the behavior (assuming the Qt build is simply busted on WSL):

  1. Create C++ project in WSL Ubuntu 22.04 with Qt used in a dynamic library.
  2. Link the library to an executable.
  3. Run the executable and see that application pointers are null in the main and other dynamic libraries using the base library. These may be retrieved using QApplication::instance().

Expected behavior
All pointers to QApplication::instance should never be null in ANY context especially if the QApplication was created in a valid way. Unfortunately I cannot provide exact code being used due to security reasons.

Failure logs

NOTE: extension_lib and base_lib are not the real names of the libraries. Those are replaced for security reasons.

QStandardPaths: wrong permissions on runtime directory /run/user/1000/, 0755 instead of 0700
---- QApplication is created here ---
USING extension_lib processed detection figure factory
**Application instance (main):  QObject(0x0) <--- THIS SHOULD NOT HAPPEN**
Waiting for first items to be streamed from algorithm. 
Thread Pool Reset
Starting algorithm.
Current QT version (base_lib.so)  5.15.12
**Application instance (base_lib.so):  QApplication(0x55591a8b4df0) <-- Valid instance... ?? but only in base lib.**
**Application instance (extension_lib.so):  QObject(0x0) <--- THIS ALSO SHOULD NOT HAPPEN**
Current QT version (extension_lib.so)  5.15.3
Figure is fine.
extension_lib::gui::figures::ProcessedDetectionFigure(0x7f0f24001fe0)
Parent is fine.
QCustomPlot(0x55591aec1bd0)
Segmentation fault (core dumped)

Additional context

We are using manifest mode with the vcpkg-registry commit id of 783c0fe1dcdf4616930f336377d65028ffb60f3e. I have tried others, but they have had the same problems. Or they present other issues such as replacing our intended python versioning within CMake when using pybind11.

@tstrutz tstrutz changed the title Qt5 port appears broken in WSL (Ubuntu 22.04) [qt5-base] Qt5 port appears broken in WSL (Ubuntu 22.04) Jan 7, 2025
@tstrutz tstrutz changed the title [qt5-base] Qt5 port appears broken in WSL (Ubuntu 22.04) [qt5-base] [runtime-error] Qt5 port appears broken in WSL (Ubuntu 22.04) Jan 7, 2025
@FrankXie05 FrankXie05 added the category:port-bug The issue is with a library, which is something the port should already support label Jan 9, 2025
@Osyotr
Copy link
Contributor

Osyotr commented Jan 9, 2025

Check which libraries are loaded.

lsof -P -T -p Application_PID

You've probably picked up system Qt (wrong rpath?)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category:port-bug The issue is with a library, which is something the port should already support
Projects
None yet
Development

No branches or pull requests

3 participants