Quantcast
Viewing all articles
Browse latest Browse all 5979

Issue with Separating Dynamic Library and Executable Targets in CMake Project on Ubuntu 22.04 + GCC + Qt

I have a CMake project that works perfectly on Windows. However, when I try to build it on Ubuntu 22.04 with GCC, I encounter runtime errors. The project consists of a dynamic library and an executable. If I place the source code for both the library and the executable together, the build and execution succeed. But when I separate them into distinct targets (a dynamic library and an executable), the build succeeds, but the executable fails at runtime.

Has anyone experienced a similar issue or can provide guidance on how to resolve this?

This is the source code :https://github.com/QiuYilin/bugs/tree/main/ubuntu%2Bcmake%2Bqt

vcpkg version qt6 output:

Execute debugger commands using "-exec <command>", for example "-exec info registers" will list registers in use (when GDB is the debugger)[New Thread 0x7ffff2787640 (LWP 62053)][New Thread 0x7ffff1f86640 (LWP 62054)]Thread 1 "customWidget" received signal SIGSEGV, Segmentation fault.0x00007ffff39420fa in QScopedPointer<QObjectData, QScopedPointerDeleter<QObjectData> >::get (this=0x8) at /home/user/vcpkg/buildtrees/qtbase/src/here-src-6-ac50939fe7.clean/src/corelib/tools/qscopedpointer.h:112

apt version qt6 output:

[Thread 0x7ffff6136900 (LWP 64001) exited][Thread 0x7ffff3332640 (LWP 64018) exited][New process 64001][Inferior 1 (process 64001) exited with code 0177]The program '/home/user/Program/own/bugs/ubuntu+cmake+qt/out/build/gcc_vcpkg_debug/bin/customWidget' has exited with code 177 (0x000000b1).

Viewing all articles
Browse latest Browse all 5979

Trending Articles