You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Clang fails to export a single default destructor (out of thousands) #143
Sadly, it was impossible for me to come with a simple example ... so in order to reproduce it you'll have to compile the entire Qt. Because there are a few pending patches that you need to apply first, please let me know when you want to start working on this bug to tell you the steps.
If I'll write them now, probably in a few weeks they will be outdated.
Yep, you must compile the entire Qt in order to reproduce it.
To do that you'll need a linux box and to run the following commands:
$ git clone -b 5.7 git://code.qt.io/qt/qt5.git
$ cd qt5
Next command will clone all qt submodules and might take some time, we're skipping qtwebkit qtwebkit-examples qtwebengine
$ ./init-repository -f --ignore-submodules qtwebkit qtwebkit-examples qtwebengine
After the above command succeeds you need to go to qtconnectivity and revert the workaround
$ cd qtconectivity
$ git revert 19e3ad566f77a5040781
$ cd ..
Next step is to configure Qt, by running configure script from top qt5 folder (not from qtbase)
Qt needs an NDK and an SDK with API 16(or better), latest tools & platform tools installed.
$ ./configure -xplatform android-clang -nomake tests -nomake examples -android-ndk /home/taipan/android/android-ndk -android-sdk /home/taipan/android/android-sdk -skip qtwebkit -skip qtserialport -skip qtwebkit-examples -skip qttranslations -developer-build -release
Replace /home/taipan/android/android-ndk/sdk with your paths
If the configure script succeeds, you can start to build it:
$ make -j10
The build take some time to complete (well in our case to fail), and should stop in qtconnectivity complaining that there is no QLlcpServerPrivate::~QLlcpServerPrivate.
*IF* you want to compile Qt using gcc, you need to clean everything (or clone it in another folder) and rerun configure script, with -xplatform android-g++ instead of -xplatform android-clang:
$ ./configure -xplatform android-g++ -nomake tests -nomake examples -android-ndk /home/taipan/android/android-ndk -android-sdk /home/taipan/android/android-sdk -skip qtwebkit -skip qtserialport -skip qtwebkit-examples -skip qttranslations -developer-build -release
compiling with gcc will also show you how big are the binaries produced by clang comparing with the ones produced by gcc
@pirama-arumuga-nainar If you need more info on this matter, please feel free to contact me (or other folks) on freenode #necessitas channel, or here.
Can you double check if you've reverted my patch?
Also please try to run make (with no -jX) in qtconectivity folder to be sure there is no error ?
I tried it with r12a, I thought r12b just have minor fixes to scripts not to clang compiler...
It doesn't succeed, it's just hidden by themake -j10 which doesn't stop all jobs at first error. If you'll run only make (with no -jX) it will stop ;-)
You need to apply these two patches to qtbase, and you don't need to rebuild everything!
If you want to change the compiler/linker flags for clang, you need to edit qtbase/mkspecs/android-clang/qmake.conf . There are two more conf files (qtbase/mkspecs/common/android-base-head.conf and qtbase/mkspecs/common/android-base-tail.conf but most probably you'll not need to change them).
qllcpserver.cpp gets definition of class QLlcpServerPrivate from qllcpserver_p_p.h, which declares a (possibly) non-trivial destructor. So Clang generates an explicit call to the destructor in ~QLlcpServer.
OTOH, the definition of QLlcpServerPrivate in qllcpserver_android_p.h doesn't specify a destructor. Clang doesn't generate an explicit destructor probably because the trivial destructor can be inlined.
One possible design here seems to be for the class in qllcpserver_android_p.h to be a subclass of the one defined in qllcpserver_p_p.h
PS: Not sure why gcc generates the destructor. Finding which object file among the gcc-built qllcpserver.o and qllcpserver_android.o has the destructor may shed some light.
Thanks a lot @pirama-arumuga-nainar, it was my fault because I didn't checked the code properly, sorry...
Indeed that part of the code is very wrong, the reviewers didn't spot the problems when it was contributed long time ago....
Activity
Android: Workaround clang default destructor export bug
pirama-arumuga-nainar commentedon Aug 9, 2016
@bog-dan-ro Can you provide instructions to reproduce the issue?
bog-dan-ro commentedon Aug 10, 2016
Yep, you must compile the entire Qt in order to reproduce it.
To do that you'll need a linux box and to run the following commands:
@pirama-arumuga-nainar If you need more info on this matter, please feel free to contact me (or other folks) on freenode #necessitas channel, or here.
pirama-arumuga-nainar commentedon Aug 10, 2016
Is this with r12b? My build with r12b completed succesfully. I am doing a clean rebuild to double check.
bog-dan-ro commentedon Aug 10, 2016
Can you double check if you've reverted my patch?
Also please try to run
make(with no -jX) in qtconectivity folder to be sure there is no error ?I tried it with r12a, I thought r12b just have minor fixes to scripts not to clang compiler...
pirama-arumuga-nainar commentedon Aug 10, 2016
I am able to see that error if I run make in qtconnectivity. Not sure why the top-level build succeeds.
I am trying to drop-in a newer Clang and reproduce.
bog-dan-ro commentedon Aug 11, 2016
It doesn't succeed, it's just hidden by the
make -j10which doesn't stop all jobs at first error. If you'll run onlymake(with no -jX) it will stop ;-)BTW I created two more patches for clang:
clang -gcc-toolchain path/to/toolchaininstead of gcc to link the binaries (though it's just sugar syntax for linking)You need to apply these two patches to qtbase, and you don't need to rebuild everything!
If you want to change the compiler/linker flags for clang, you need to edit
qtbase/mkspecs/android-clang/qmake.conf. There are two more conf files (qtbase/mkspecs/common/android-base-head.confandqtbase/mkspecs/common/android-base-tail.confbut most probably you'll not need to change them).pirama-arumuga-nainar commentedon Aug 11, 2016
There is an ODR violation here.
qllcpserver.cppgets definition of classQLlcpServerPrivatefromqllcpserver_p_p.h, which declares a (possibly) non-trivial destructor. So Clang generates an explicit call to the destructor in~QLlcpServer.OTOH, the definition of
QLlcpServerPrivateinqllcpserver_android_p.hdoesn't specify a destructor. Clang doesn't generate an explicit destructor probably because the trivial destructor can be inlined.One possible design here seems to be for the class in
qllcpserver_android_p.hto be a subclass of the one defined inqllcpserver_p_p.hpirama-arumuga-nainar commentedon Aug 11, 2016
PS: Not sure why gcc generates the destructor. Finding which object file among the gcc-built qllcpserver.o and qllcpserver_android.o has the destructor may shed some light.
DanAlbert commentedon Aug 11, 2016
Thanks for tracking that down, @pirama-arumuga-nainar!
bog-dan-ro commentedon Aug 16, 2016
Thanks a lot @pirama-arumuga-nainar, it was my fault because I didn't checked the code properly, sorry...
Indeed that part of the code is very wrong, the reviewers didn't spot the problems when it was contributed long time ago....
WL#10314 - InnoDB: Lock-sys optimization: sharded lock_sys mutex
WL#10314 - InnoDB: Lock-sys optimization: sharded lock_sys mutex