[Interest] mingw64: can't compile a lib such that a Qt signal can connect successfully to a binary slot

Filippo Rusconi listes.rusconi at laposte.net
Sat Apr 11 10:51:50 CEST 2020


Greetings, Thiago,

thank you for your follow-up.

On Thu, Apr 09, 2020 at 11:37:57AM -0300, Thiago Macieira wrote:
>On Thursday, 9 April 2020 09:02:32 -03 Filippo Rusconi via Interest wrote:
>
>Why not?

Evidently, my previous mail was somehow crippled. This is my story:

I develop a scientific program using Qt5.12.5 / CMake / Debian testing, with:

gcc (Debian 9.3.0-3) 9.3.0.

The program makes heavy use of QThread, and, of course Signal/Slot connections.
It runs beautifully in my Debian box, with now apparent bugs since weeks of
testing.

I build two artifacts:

- a library with classes that emit Qt signals (pappso lib below);
- an executable binary that connects slots to these library-emitted signals.

When I want to craft a Win10 binary, I'm used to just dump the source code into
Win10/MingW64 (in the msys64 installment) and build it. I magically have a
perfect match of behaviours under Linux and Win10.

My last successful creation of Win binaries dates back roughly one year. At that
time the gcc version was 7.x, if I recall correctly. This last year, I have
rewritten the software almost entirely and now that it is in good shape, I want
to create binaries for Win10 (Qt5.14.1, here).  In this new version, I am making
use of many more signal/slot connections between my executable and the dll.

The program builds just fine, but when I run it, I get this kind of message:

Warning: QObject::connect: signal not found in pappso::PrecisionWidget (:0, )

Note that the pappso::PrecisionWidget class emits a signal that is very simple:
it just has a conventional pointer as its argument:

8<~~~~~~
typedef const PrecisionBase *PrecisionPtr;

signals:
   void precisionChanged(pappso::PrecisionPtr precision) const;
~~~~~~>8

I hope somebody can answer the following questions:

First question: 
----------------

What is the (:0, ) string element above ?

Second question:
----------------

Is the windows-specific dllexport macro art required when using the MinGW64
build environment and using CMake to build shared libs and executable binaries ?

The program does not work as expected without the connections, understandably,
although it loads and performs well where signal/slot exe<-->lib connections are
not required (like clicking buttons located in the executable, for example).

This observation makes me think that I am using MinGW64 in an overall good
manner.

Then I tried building the library by specifying the following, according to the
CMake docs:

-DCMAKE_WINDOWS_EXPORT_ALL_SYMBOLS=TRUE -DBUILD_SHARED_LIBS=TRUE

but, although the md5 checksums of the libs are different, the sizes of the libs
(with or without this dllexport art) are identical. So, I gather that the
defines above are not essential ?

Third question:
---------------

When building the library, I get systematically two dll artifacts: the
libname.dll and the libname.dll.a. What are the differences between the two? I
tried linking against one or the other, but that does not solve my problem. I
thought the dll.a file was a static library, which indeed seems to be (I could
extract *.o files out of it using ar). However, when I link against the dll.a
file, the dll is still required at run time.

What other information should I provide to help you help me fix the problem ?

FYI, I am using -G "Unix Makefiles" and have confirmed that WIN32 is indeed
defined during the configuration of the build. What about using -G "MinGW
Makefiles". I tried, but the build seems to go the exact same way as the other
"Unix way". What is the difference between the two, in a msys64/mingw64 context?

Thank you for your patience and hoping help,
Sincerely, Filippo
Greetings,



-- 

⢀⣴⠾⠻⢶⣦⠀  Filippo Rusconi, PhD
⣾⠁⢠⠒⠀⣿⡁   Scientist at CNRS
⢿⡄⠘⠷⠚⠋⠀   Debian Developer
⠈⠳⣄⠀⠀⠀⠀  http://msxpertsuite.org
           http://www.debian.org

~~~~
book: http://www.lavoisier.fr/livre/notice.asp?id=3LKW2OAR2KROWZ
http://books.google.fr/books?id=2NmguxmEI1sC&printsec=frontcover&dq=rusconi+f+lavoisier&hl=fr&sa=X&ei=nGGOUt2SH_Ly0gX0uIHoBQ&ved=0CDUQ6AEwAA#v=onepage&q&f=false
~~~~
Génétique Quantitative et Évolution & Plateforme PAPPSO
UMR CNRS 8120 – INRA – Université Paris-Sud – AgroParisTech - Université Paris-Saclay
http://moulon.inra.fr/ & http://pappso.inra.fr/
Ferme du Moulon
91190 Gif-sur-Yvette
France
Tel : +33 (0)1 69 33 23 54
Fax : +33 (0)1 69 33 23 40


More information about the Interest mailing list