psemiletov / tea-qt

TEA text editor
https://tea.ourproject.org
GNU General Public License v3.0
88 stars 11 forks source link

build error, linking fails (Q_OS_LINUX definition missing after qmake) #26

Closed yurytch closed 6 years ago

yurytch commented 6 years ago

On my linux system the build of tea-qt-46.0.0.tar.gz (qmake+make) fails with:

g++ -Wl,-O1 -Wl,-rpath,/usr/lib64/qt/lib -o bin/tea rvln.o main.o todo.o textproc.o libretta_calc.o wavinfo.o calendar.o gui_utils.o document.o utils.o spellchecker.o fman.o shortcuts.o logmemo.o img_viewer.o fontbox.o tio.o tzipper.o single_application.o single_application_shared.o exif.o myjoystick.o qioapi.o quaadler32.o quacrc32.o quagzipfile.o quaziodevice.o quazip.o quazipdir.o quazipfile.o quazipfileinfo.o quazipnewinfo.o unzip.o zip.o moc_rvln.o moc_todo.o moc_document.o moc_calendar.o moc_fman.o moc_shortcuts.o moc_logmemo.o moc_img_viewer.o moc_tio.o moc_fontbox.o moc_tzipper.o moc_single_application.o moc_single_application_shared.o moc_myjoystick.o moc_quagzipfile.o moc_quaziodevice.o moc_quazipfile.o qrc_rvln.o -L/usr/lib64/qt/lib -lQtCore -laspell -lz -lhunspell-1.6 -lQtGui -L/usr/lib64/qt/lib -L/usr/X11R6/lib -lQtNetwork -lQtCore -lpthread /usr/lib64/gcc/x86_64-slackware-linux/5.3.0/../../../../x86_64-slackware-linux/bin/ld: skipping incompatible /usr/X11R6/lib/libz.so when searching for -lz /usr/lib64/gcc/x86_64-slackware-linux/5.3.0/../../../../x86_64-slackware-linux/bin/ld: skipping incompatible /usr/X11R6/lib/libz.a when searching for -lz /usr/lib64/gcc/x86_64-slackware-linux/5.3.0/../../../../x86_64-slackware-linux/bin/ld: skipping incompatible /usr/X11R6/lib/libpthread.so when searching for -lpthread /usr/lib64/gcc/x86_64-slackware-linux/5.3.0/../../../../x86_64-slackware-linux/bin/ld: skipping incompatible /usr/X11R6/lib/libpthread.a when searching for -lpthread /usr/lib64/gcc/x86_64-slackware-linux/5.3.0/../../../../x86_64-slackware-linux/bin/ld: skipping incompatible /usr/X11R6/lib/libm.so when searching for -lm /usr/lib64/gcc/x86_64-slackware-linux/5.3.0/../../../../x86_64-slackware-linux/bin/ld: skipping incompatible /usr/X11R6/lib/libm.a when searching for -lm /usr/lib64/gcc/x86_64-slackware-linux/5.3.0/../../../../x86_64-slackware-linux/bin/ld: skipping incompatible /usr/X11R6/lib/libc.so when searching for -lc /usr/lib64/gcc/x86_64-slackware-linux/5.3.0/../../../../x86_64-slackware-linux/bin/ld: skipping incompatible /usr/X11R6/lib/libc.a when searching for -lc myjoystick.o: In function CJoystick::~CJoystick()': myjoystick.cpp:(.text+0xc): undefined reference tovtable for CJoystick' myjoystick.o: In function CJoystick::CJoystick(unsigned int, QObject*)': myjoystick.cpp:(.text+0x3dd): undefined reference tovtable for CJoystick' collect2: error: ld returned 1 exit status Makefile:267: recipe for target 'bin/tea' failed

The problem is myjoystick.h contains a check for Q_OS_LINUX, which somehow doesn't work, at least on my linux system (Slackware 14.2 with standard qt at version 4.8.7) -- after qmake run there was no mention of Q_OS_LINUX in Makefile, and in the compile phase moc_myjoystick.cpp was generated empty.

What I did wasn't a real fix, but it allowed linking to complete successfully:

--- myjoystick.h.prev ^2018-09-15 21:13:48.000000000 +0300 +++ myjoystick.h ^2018-09-16 08:04:15.426654737 +0300 @@ -6,7 +6,7 @@

include

include

. -#if defined(Q_OS_LINUX) +//#if defined(Q_OS_LINUX) .

include

include

@@ -70,5 +70,5 @@ void read_joystick(); }; . -#endif +//#endif

endif

psemiletov commented 6 years ago

I've tried to fix this by adding the Q_WS_X11 check. Can you compile current github master?

psemiletov commented 6 years ago

...it seems I've fixed this issue. Tested with recent Slackware on Vbox.

yurytch commented 6 years ago

Tested with master, works okay. Thank you!

psemiletov commented 6 years ago

Thank you for the report about the error!