Search code examples
c++qttemplatesobjdumpnm

I want to check object code with two versions of libQtCore.a


I am also making static library of Qt (qt.4.3.3) , the steps to do the same are

I downloaded a open source of qt-all-opensource-src-4.3.3. I built static libraries using following steps. The gcc version I am using is gcc 5.2.0

cd qt-all-opensource-src-4.3.3
gmake conflcean
./configure -release -static -largefile -qt3support -qt-libpng -qt-libmng -qt-libtiff -qt-libjpeg -glib -platform linux-g++-64 -confirm-license -no-openssl -no-qdbus -prefix ./static_new -prefix-install -opengl -sm -lSM -lICE -xshape -lX11 -xinerama -lXinerama -xcursor -lXcursor -xfixes -lXfixes -xrandr -lXrandr -xrender -lXrender -fontconfig -lfontconfig -tablet -lXi -xkb -glib -lglib-2.0 -lXext -lz -lgthread-2.0
gmake
gmake install

I am getting following error message

from ../../corelib/codecs/qsimplecodec_p.h:36, from ../../corelib/codecs/qsimplecodec.cpp:22: ../../../include/QtCore/../../src/corelib/thread/qatomic.h: In instantiation of ?QAtomicPointer::QAtomicPointer(T*) [with T = QByteArray]?: ../../corelib/codecs/qsimplecodec.cpp:592:74: required from here
../../../include/QtCore/../../src/corelib/thread/qatomic.h:190:7: error: ?init? was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive] ../../../include/QtCore/../../src/corelib/thread/qatomic.h:190:7: note: declarations in dependent base ?QBasicAtomicPointer? are not found by unqualified lookup ../../../include/QtCore/../../src/corelib/thread/qatomic.h:190:7: note: use ?this->init? instead gmake[1]: * [.obj/release-static/qsimplecodec.o] Error 1 gmake[1]: Leaving directory `/in/inndt69/Projects/oasys/QT/QT/qt-x11-commercial-src-4.3.3/qt-x11-commercial-src-4.3.3/src/tools/rcc' gmake: * [sub-rcc-make_default-ordered] Error 2

After following the suggestions from What is correct way to solve the build error while making static libraries of Qt

I did two experiments

1) Experiment1  : compiled the Qt4.3.3 with -fpermissive flag and I got version of libQtCore.a

2) Experiment2 : corrected the code and used this-init insted of init at line 190 and build passed

Now I have to compare the object code generated with two versions of libQtCore (from two experiments) . I tried to use following command

1) objdump -t /pathtoQt/experiment1/libQtCore.a  | grep -i atomic
1) objdump -t /pathtoQt/experiment2/libQtCore.a  | grep -i atomic

but I am not get any reference of QAtomicPointer in the objdumps .

Can someone guide me how to compare the object code generated with the -fpermissive flag against the corrected code that uses { this->init(t); } in the line that causes the error.


Solution

  • You're facing the error because the very old Qt code that you're using is not valid C++: the old compilers were more permissive and accepted that invalid code. You have to patch your copy of Qt to fix the bug.