gcc-2.95.3 can't compile a c++ sample SuSE 8.2 x86
Hi, I would like to report a problem about compiling a simple code with gcc (g++) from: /opt/gcc295/bin/gcc Im using the old gcc compiler. stefan@jupiter:~> gcc --version 2.95.3 stefan@jupiter:~> which gcc /opt/gcc295/bin/gcc Lyx-1.3.2 can't compile using gcc-2.95.3 due some problems I think with libstd++ . Have a look: #include <qglobal.h> #include <qstring.h> #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { QString s("mangle_failure"); #if (QT_VERSION < 221) break_me_(\\); #endif ; return 0; } This code works fine with gcc-3.3.1 When I set my PATH to /opt/gcc295/bin the compiler will give: stefan@jupiter:~> export PATH=/opt/gcc295/bin:$PATH stefan@jupiter:~> g++ -O -Wno-non-template-friend -ftemplate-depth-30 -I/usr/lib/qt3/include -L/usr/lib/qt3/lib -isystem /usr/X11R6/include test.cc -lSM -lICE -lc -lm -L/usr/X11R6/lib -lX11 -lqt /tmp/ccRoZCNx.o(.text+0x13): In function `main': : undefined reference to `QString::QString(char const *)' /tmp/ccRoZCNx.o(.text+0x23): In function `main': : undefined reference to `QString::shared_null' /tmp/ccRoZCNx.o(.text+0x2e): In function `main': : undefined reference to `QStringData::deleteSelf(void)' /tmp/ccRoZCNx.o(.text+0x4c): In function `main': : undefined reference to `QString::shared_null' /tmp/ccRoZCNx.o(.text+0x57): In function `main': : undefined reference to `QStringData::deleteSelf(void)' collect2: ld returned 1 exit status any idea what can we do. Lyx132 can't compile because ./configure fails exactly to this point. Many thanks Stefan
Stefan Parvu <sp@sunguru.com> [Sat, 30 Aug 2003 21:40:58 +0300]:
Lyx-1.3.2 can't compile using gcc-2.95.3 due some problems I think with libstd++ . Have a look:
No, the libstdc++ is fine, as gcc_old has its own. But you can't use any other library on the system that's written in C++, namely Qt and the KDE libraries. gcc 3.X uses a different ABI (application binary interface), meaning you can't link code compiled with gcc 2.95.X with code that has been compiled by gcc 3.X . With the compiler from gcc_old you can only compile Programs that need nothing more then libstdc++. So compiling lyx with Qt interface is out of the question unless you also compile Qt with gcc 2.95.3. Make sure that version of Qt doesn't overwrite the already installed version, otherwise all other programs that need Qt will stop to work. But why the hassle? I posted the steps necessary to compile lyx 1.3.2, together with the necessary patch to the boost configuration a few days ago. That will enable you to compile lyx 1.3.2 with gcc 3.3.1. Philipp
Hi Philipp, Many thanks indeed for answers.
Yes looks like.
Yes I've found out this. So as long as I have a QT library tree compiled with 2.95.3 gcc everyhting is fine.
Well, yes you are right. I compiled without any problems lyx-1.3.2 with gcc-3.3.1 Some user, Ernesto, still reports that lyx-1.3.2 does not build with gcc-3.3.1 under his box/config due some compiler internal error. Looks strange. A solution will be to make everyhting back using the old gcc, 2.95.3 For that QT is needed to be built with 2.95 too. I created a new QT dir under my /usr/lib/qt-2.3.1 where all QT stuff compiled with gcc-2.95.3 went. Then I went back to my original lyx-1.3.2 code and rebuild everything. Worked fine. I was very curious about this. Now this seems working with old and the new compiler.
Philipp
Any idea why I can not build QT 3.2.1 with gcc-2.95. Everything is going fine until I reached a relocation error ! ... ... g++ -Wl,-rpath,/home/stefan/qt/qt-3.2.1-gcc.295/lib -shared -Wl,-soname,libqui.so.1 -Wl,-rpath,/home/stefan/qt-x11-free-3.2.1/lib -o libqui.so.1.0.0 .obj/release-shared-mt/qwidgetfactory.o .obj/release-shared-mt/domtool.o .obj/release-shared-mt/uib.o .obj/release-shared-mt/database.o .obj/release-shared-mt/moc_database2.o -L/home/stefan/qt-x11-free-3.2.1/lib -L/usr/X11R6/lib -L/usr/X11R6/lib -lqt-mt -lGLU -lGL -lXmu -lXrender -lXrandr -lXcursor -lXinerama -lXft -lfreetype -lfontconfig -lXext -lX11 -lm -lSM -lICE -ldl -lpthread ln -s libqui.so.1.0.0 libqui.so ln -s libqui.so.1.0.0 libqui.so.1 ln -s libqui.so.1.0.0 libqui.so.1.0 rm -f ../../../lib/libqui.so.1.0.0 rm -f ../../../lib/libqui.so rm -f ../../../lib/libqui.so.1 rm -f ../../../lib/libqui.so.1.0 mv -f libqui.so.1.0.0 libqui.so libqui.so.1 libqui.so.1.0 ../../../lib/ gmake[4]: Leaving directory `/home/stefan/qt-x11-free-3.2.1/tools/designer/uilib' cd designer && /usr/bin/gmake -f Makefile gmake[4]: Entering directory `/home/stefan/qt-x11-free-3.2.1/tools/designer/designer' /home/stefan/qt-x11-free-3.2.1/bin/uic -L /home/stefan/qt-x11-free-3.2.1/plugins listboxeditor.ui -o listboxeditor.h /home/stefan/qt-x11-free-3.2.1/bin/uic: relocation error: /home/stefan/qt-x11-free-3.2.1/bin/uic: undefined symbol: _7QString.shared_null gmake[4]: *** [listboxeditor.h] Error 127 gmake[4]: Leaving directory `/home/stefan/qt-x11-free-3.2.1/tools/designer/designer' gmake[3]: *** [sub-designer] Error 2 gmake[3]: Leaving directory `/home/stefan/qt-x11-free-3.2.1/tools/designer' gmake[2]: *** [sub-designer] Error 2 gmake[2]: Leaving directory `/home/stefan/qt-x11-free-3.2.1/tools' gmake[1]: *** [sub-tools] Error 2 gmake[1]: Leaving directory `/home/stefan/qt-x11-free-3.2.1' gmake: *** [init] Error 2 stefan@jupiter:~/qt-x11-free-3.2.1> stefan
Looks like even with gcc-3.3.1 QT 3.2.1 does not build fine. I was able to compile without problems: QT 3.1.2 with both compilers ( 3.3.1 and the old one ) When Im building QT 3.2.1 with gcc-3.3.1 I get: g++ -c -pipe -fPIC -Wall -W -O2 -D_REENTRANT -DDESIGNER -DQT_INTERNAL_XML -DQT_INTERNAL_WORKSPACE -DQT_INTERNAL_ICONVIEW -DQT_INTERNAL_TABLE -DQT_NO_DEBUG -DQT_THREAD_SUPPORT -DQT_SHARED -I/home/stefan/GCC31-QT321/qt-x11-free-3.2.1/mkspecs/linux-g++ -I. -I/usr/include/freetype2 -I../shared -I../uilib -I../../../include -I/usr/X11R6/include -I.moc/release-shared-mt/ -o ./dbconnectionsimpl.o dbconnectionsimpl.cpp g++ -c -pipe -fPIC -Wall -W -O2 -D_REENTRANT -DDESIGNER -DQT_INTERNAL_XML -DQT_INTERNAL_WORKSPACE -DQT_INTERNAL_ICONVIEW -DQT_INTERNAL_TABLE -DQT_NO_DEBUG -DQT_THREAD_SUPPORT -DQT_SHARED -I/home/stefan/GCC31-QT321/qt-x11-free-3.2.1/mkspecs/linux-g++ -I. -I/usr/include/freetype2 -I../shared -I../uilib -I../../../include -I/usr/X11R6/include -I.moc/release-shared-mt/ -o ./tableeditorimpl.o tableeditorimpl.cpp /home/stefan/GCC31-QT321/qt-x11-free-3.2.1/bin/uic -L /home/stefan/GCC31-QT321/qt-x11-free-3.2.1/plugins listboxeditor.ui -i listboxeditor.h -o listboxeditor.cpp /home/stefan/GCC31-QT321/qt-x11-free-3.2.1/bin/uic: relocation error: /home/stefan/GCC31-QT321/qt-x11-free-3.2.1/bin/uic: undefined symbol: _ZNK7QString3argExii gmake[4]: *** [listboxeditor.cpp] Error 127 gmake[4]: Leaving directory `/home/stefan/GCC31-QT321/qt-x11-free-3.2.1/tools/designer/designer' gmake[3]: *** [sub-designer] Error 2 gmake[3]: Leaving directory `/home/stefan/GCC31-QT321/qt-x11-free-3.2.1/tools/designer' gmake[2]: *** [sub-designer] Error 2 gmake[2]: Leaving directory `/home/stefan/GCC31-QT321/qt-x11-free-3.2.1/tools' gmake[1]: *** [sub-tools] Error 2 gmake[1]: Leaving directory `/home/stefan/GCC31-QT321/qt-x11-free-3.2.1' gmake: *** [init] Error 2 stefan
Stefan Parvu <sp@sunguru.com> [Sun, 31 Aug 2003 19:42:19 +0300]:
Any idea why I can not build QT 3.2.1 with gcc-2.95. Everything is going fine until I reached a relocation error !
Nope, no idea what could go wrong there and, sorry to say so, but I won't spend any of my free time researching this as for me gcc 2.95.3 is dead. Philipp
Hello, Well as gcc-3.3.1 is out yes indeed we could all move forward to use the new compiler. Anyway I have got problems even with the new compiler. 'Undefined symbols'/'relocation error' when trying to compile QT 3.2.1 with gcc-3.3.1 g++ -c -pipe -fPIC -Wall -W -O2 -D_REENTRANT -DDESIGNER -DQT_INTERNAL_XML -DQT_INTERNAL_WORKSPACE -DQT_INTERNAL_ICONVIEW -DQT_INTERNAL_TABLE -DQT_NO_DEBUG -DQT_THREAD_SUPPORT -DQT_SHARED -I/home/stefan/GCC31-QT321/qt-x11-free-3.2.1/mkspecs/linux-g++ -I. -I/usr/include/freetype2 -I../shared -I../uilib -I../../../include -I/usr/X11R6/include -I.moc/release-shared-mt/ -o ./dbconnectionsimpl.o dbconnectionsimpl.cpp g++ -c -pipe -fPIC -Wall -W -O2 -D_REENTRANT -DDESIGNER -DQT_INTERNAL_XML -DQT_INTERNAL_WORKSPACE -DQT_INTERNAL_ICONVIEW -DQT_INTERNAL_TABLE -DQT_NO_DEBUG -DQT_THREAD_SUPPORT -DQT_SHARED -I/home/stefan/GCC31-QT321/qt-x11-free-3.2.1/mkspecs/linux-g++ -I. -I/usr/include/freetype2 -I../shared -I../uilib -I../../../include -I/usr/X11R6/include -I.moc/release-shared-mt/ -o ./tableeditorimpl.o tableeditorimpl.cpp /home/stefan/GCC31-QT321/qt-x11-free-3.2.1/bin/uic -L /home/stefan/GCC31-QT321/qt-x11-free-3.2.1/plugins listboxeditor.ui -i listboxeditor.h -o listboxeditor.cpp /home/stefan/GCC31-QT321/qt-x11-free-3.2.1/bin/uic: relocation error: /home/stefan/GCC31-QT321/qt-x11-free-3.2.1/bin/uic: undefined symbol: _ZNK7QString3argExii gmake[4]: *** [listboxeditor.cpp] Error 127 gmake[4]: Leaving directory `/home/stefan/GCC31-QT321/qt-x11-free-3.2.1/tools/designer/designer' gmake[3]: *** [sub-designer] Error 2 gmake[3]: Leaving directory `/home/stefan/GCC31-QT321/qt-x11-free-3.2.1/tools/designer' gmake[2]: *** [sub-designer] Error 2 gmake[2]: Leaving directory `/home/stefan/GCC31-QT321/qt-x11-free-3.2.1/tools' gmake[1]: *** [sub-tools] Error 2 gmake[1]: Leaving directory `/home/stefan/GCC31-QT321/qt-x11-free-3.2.1' gmake: *** [init] Error 2 Im looking into this one now, to see whether Im missing LD_LIBRARY_PATH as described in INSTALL file. stefan
Stefan Parvu <sp@sunguru.com> [Mon, 1 Sep 2003 19:48:04 +0300]:
Anyway I have got problems even with the new compiler. 'Undefined symbols'/'relocation error' when trying to compile QT 3.2.1 with gcc-3.3.1
Try adding -fno-unit-at-a-time to the compiler flags. If that helps, it is a known bug which has been fixed in the meantime. Philipp
I was missing the LD_LIBRARY_PATH and QTDIR exported during the building process. Under INSTALL there is mentioned you have to: export QTDIR, LD_LIBRARY_PATH to the builiding directory, where the qtdir is compiled. Everything worked fine. Thanks anyway for tip. stefan
Stefan Parvu <sp@sunguru.com> [Sat, 30 Aug 2003 21:40:58 +0300]:
Lyx-1.3.2 can't compile using gcc-2.95.3 due some problems I think with libstd++ . Have a look:
No, the libstdc++ is fine, as gcc_old has its own. But you can't use any other library on the system that's written in C++, namely Qt and the KDE libraries. gcc 3.X uses a different ABI (application binary interface), meaning you can't link code compiled with gcc 2.95.X with code that has been compiled by gcc 3.X . With the compiler from gcc_old you can only compile Programs that need nothing more then libstdc++. So compiling lyx with Qt interface is out of the question unless you also compile Qt with gcc 2.95.3. Make sure that version of Qt doesn't overwrite the already installed version, otherwise all other programs that need Qt will stop to work. But why the hassle? I posted the steps necessary to compile lyx 1.3.2, together with the necessary patch to the boost configuration a few days ago. That will enable you to compile lyx 1.3.2 with gcc 3.3.1. Philipp
Hi Philipp, Many thanks indeed for answers.
Yes looks like.
Yes I've found out this. So as long as I have a QT library tree compiled with 2.95.3 gcc everyhting is fine.
Well, yes you are right. I compiled without any problems lyx-1.3.2 with gcc-3.3.1 Some user, Ernesto, still reports that lyx-1.3.2 does not build with gcc-3.3.1 under his box/config due some compiler internal error. Looks strange. A solution will be to make everyhting back using the old gcc, 2.95.3 For that QT is needed to be built with 2.95 too. I created a new QT dir under my /usr/lib/qt-2.3.1 where all QT stuff compiled with gcc-2.95.3 went. Then I went back to my original lyx-1.3.2 code and rebuild everything. Worked fine. I was very curious about this. Now this seems working with old and the new compiler.
Philipp
Any idea why I can not build QT 3.2.1 with gcc-2.95. Everything is going fine until I reached a relocation error ! ... ... g++ -Wl,-rpath,/home/stefan/qt/qt-3.2.1-gcc.295/lib -shared -Wl,-soname,libqui.so.1 -Wl,-rpath,/home/stefan/qt-x11-free-3.2.1/lib -o libqui.so.1.0.0 .obj/release-shared-mt/qwidgetfactory.o .obj/release-shared-mt/domtool.o .obj/release-shared-mt/uib.o .obj/release-shared-mt/database.o .obj/release-shared-mt/moc_database2.o -L/home/stefan/qt-x11-free-3.2.1/lib -L/usr/X11R6/lib -L/usr/X11R6/lib -lqt-mt -lGLU -lGL -lXmu -lXrender -lXrandr -lXcursor -lXinerama -lXft -lfreetype -lfontconfig -lXext -lX11 -lm -lSM -lICE -ldl -lpthread ln -s libqui.so.1.0.0 libqui.so ln -s libqui.so.1.0.0 libqui.so.1 ln -s libqui.so.1.0.0 libqui.so.1.0 rm -f ../../../lib/libqui.so.1.0.0 rm -f ../../../lib/libqui.so rm -f ../../../lib/libqui.so.1 rm -f ../../../lib/libqui.so.1.0 mv -f libqui.so.1.0.0 libqui.so libqui.so.1 libqui.so.1.0 ../../../lib/ gmake[4]: Leaving directory `/home/stefan/qt-x11-free-3.2.1/tools/designer/uilib' cd designer && /usr/bin/gmake -f Makefile gmake[4]: Entering directory `/home/stefan/qt-x11-free-3.2.1/tools/designer/designer' /home/stefan/qt-x11-free-3.2.1/bin/uic -L /home/stefan/qt-x11-free-3.2.1/plugins listboxeditor.ui -o listboxeditor.h /home/stefan/qt-x11-free-3.2.1/bin/uic: relocation error: /home/stefan/qt-x11-free-3.2.1/bin/uic: undefined symbol: _7QString.shared_null gmake[4]: *** [listboxeditor.h] Error 127 gmake[4]: Leaving directory `/home/stefan/qt-x11-free-3.2.1/tools/designer/designer' gmake[3]: *** [sub-designer] Error 2 gmake[3]: Leaving directory `/home/stefan/qt-x11-free-3.2.1/tools/designer' gmake[2]: *** [sub-designer] Error 2 gmake[2]: Leaving directory `/home/stefan/qt-x11-free-3.2.1/tools' gmake[1]: *** [sub-tools] Error 2 gmake[1]: Leaving directory `/home/stefan/qt-x11-free-3.2.1' gmake: *** [init] Error 2 stefan@jupiter:~/qt-x11-free-3.2.1> stefan
Looks like even with gcc-3.3.1 QT 3.2.1 does not build fine. I was able to compile without problems: QT 3.1.2 with both compilers ( 3.3.1 and the old one ) When Im building QT 3.2.1 with gcc-3.3.1 I get: g++ -c -pipe -fPIC -Wall -W -O2 -D_REENTRANT -DDESIGNER -DQT_INTERNAL_XML -DQT_INTERNAL_WORKSPACE -DQT_INTERNAL_ICONVIEW -DQT_INTERNAL_TABLE -DQT_NO_DEBUG -DQT_THREAD_SUPPORT -DQT_SHARED -I/home/stefan/GCC31-QT321/qt-x11-free-3.2.1/mkspecs/linux-g++ -I. -I/usr/include/freetype2 -I../shared -I../uilib -I../../../include -I/usr/X11R6/include -I.moc/release-shared-mt/ -o ./dbconnectionsimpl.o dbconnectionsimpl.cpp g++ -c -pipe -fPIC -Wall -W -O2 -D_REENTRANT -DDESIGNER -DQT_INTERNAL_XML -DQT_INTERNAL_WORKSPACE -DQT_INTERNAL_ICONVIEW -DQT_INTERNAL_TABLE -DQT_NO_DEBUG -DQT_THREAD_SUPPORT -DQT_SHARED -I/home/stefan/GCC31-QT321/qt-x11-free-3.2.1/mkspecs/linux-g++ -I. -I/usr/include/freetype2 -I../shared -I../uilib -I../../../include -I/usr/X11R6/include -I.moc/release-shared-mt/ -o ./tableeditorimpl.o tableeditorimpl.cpp /home/stefan/GCC31-QT321/qt-x11-free-3.2.1/bin/uic -L /home/stefan/GCC31-QT321/qt-x11-free-3.2.1/plugins listboxeditor.ui -i listboxeditor.h -o listboxeditor.cpp /home/stefan/GCC31-QT321/qt-x11-free-3.2.1/bin/uic: relocation error: /home/stefan/GCC31-QT321/qt-x11-free-3.2.1/bin/uic: undefined symbol: _ZNK7QString3argExii gmake[4]: *** [listboxeditor.cpp] Error 127 gmake[4]: Leaving directory `/home/stefan/GCC31-QT321/qt-x11-free-3.2.1/tools/designer/designer' gmake[3]: *** [sub-designer] Error 2 gmake[3]: Leaving directory `/home/stefan/GCC31-QT321/qt-x11-free-3.2.1/tools/designer' gmake[2]: *** [sub-designer] Error 2 gmake[2]: Leaving directory `/home/stefan/GCC31-QT321/qt-x11-free-3.2.1/tools' gmake[1]: *** [sub-tools] Error 2 gmake[1]: Leaving directory `/home/stefan/GCC31-QT321/qt-x11-free-3.2.1' gmake: *** [init] Error 2 stefan
participants (2)
-
Philipp Thomas
-
Stefan Parvu