#1 2013-10-11 23:07:17

Damos
Member
Registered: 2013-10-11
Posts: 5

QT 5.1.1 MinGW 4.8.0, cannot compile (linker errors)

Hi, I'm having problems with such toolchain as described above.
QT GUI app on Windows 7 64bit, compiler and target for 32bits.

Additional flags set at the project file are:

INCLUDEPATH += "C:/mingw/eprofiler-windows32-mingw-intel-1.1.1/EProfiler/include"
LIBS += -L"C:/mingw/eprofiler-windows32-mingw-intel-1.1.1/EProfiler/windows32-mingw-intel/lib"
LIBS += -lEProfiler.dll
QMAKE_CXXFLAGS += -std=c++0x -Wno-unused-parameter -finstrument-functions
QMAKE_LFLAGS += -Wl -Map=Timeline_ctrl.map

I'm getting following errors:

./release\mainwindow.o:mainwindow.cpp:(.text+0x2b1): undefined reference to `int QGenericAtomicOps<QBasicAtomicOps<4> >::load<int>(int const&)'
./release\mainwindow.o:mainwindow.cpp:(.text+0x2c8): undefined reference to `int QGenericAtomicOps<QBasicAtomicOps<4> >::load<int>(int const&)'
./release\mainwindow.o:mainwindow.cpp:(.text+0x3ac): undefined reference to `int QGenericAtomicOps<QBasicAtomicOps<4> >::load<int>(int const&)'
./release\mainwindow.o:mainwindow.cpp:(.text+0x3c2): undefined reference to `int QGenericAtomicOps<QBasicAtomicOps<4> >::load<int>(int const&)'
./release\mainwindow.o:mainwindow.cpp:(.text+0x7d6): undefined reference to `int QGenericAtomicOps<QBasicAtomicOps<4> >::load<int>(int const&)'
./release\mainwindow.o:mainwindow.cpp:(.text+0x7ec): more undefined references to `int QGenericAtomicOps<QBasicAtomicOps<4> >::load<int>(int const&)' follow
c:/mingw/x32-4.8.0-release-posix-dwarf-rev2/mingw32/bin/../lib/gcc/i686-w64-mingw32/4.8.0/../../../../i686-w64-mingw32/bin/ld.exe: ./release\mainwindow.o: bad reloc address 0xd in section `.text$_ZN6QFlagsIN2Qt10WindowTypeEEC1EMNS2_7PrivateEi[__ZN6QFlagsIN2Qt10WindowTypeEEC1EMNS2_7PrivateEi]'
collect2.exe: error: ld returned 1 exit status
mingw32-make[1]: *** [release\Timeline_ctrl.exe] Error 1
mingw32-make: *** [release] Error 2

Any idea? Should I exclude some stuff using -finstrument-functions-exclude-function-list= ?
Whole QT compiled with compiler used at the compilation of the project. tested with prebuilded QT with same results.

Best Regards
Damos

Offline

#2 2013-10-14 07:33:31

Miki
Moderator
Registered: 2012-11-22
Posts: 42

Re: QT 5.1.1 MinGW 4.8.0, cannot compile (linker errors)

Hello Damos!

thanks for the post and welcome to Embedded Profiler forum!

Regarding your question, it is quite difficult to say without reproduction. But we can recommend some more investigation steps for you which will certainly help:

Do not link EProfiler.dll but define somewhere two empty global functions:

void __cyg_profile_func_enter(void* p_this_fn, void* p_call_site)
{
}

void __cyg_profile_func_exit(void* p_this_fn, void* p_call_site)
{
}

Try compilation.

1. If you still get compilation errors, the problem is somewhere in QT. In this case, we recommend to move source code for profiling to special modules which will not depend on QT. In your case, maybe it will be enough not to profile mainwindow.cpp (not to set instrumentation with '-finstrument-function' flag for this module) .

2. If you don't get compilation errors, the problem is somewhere in Embedded Profiler. In this case, it will be very helpful for us if you are able to send us small project example which reproduces this problem.

Please, let us know if this helps.

Regards,

Miki

Offline

#3 2013-10-14 13:06:58

Damos
Member
Registered: 2013-10-11
Posts: 5

Re: QT 5.1.1 MinGW 4.8.0, cannot compile (linker errors)

Hi Miki.
Thanks for quick reply.

Im happy/sad to inform you when I've made suggested changes I still have same problem with compiling my project. So - looks like it's QT/MinGW error not EmbeddedProfiler.

I guess you didn't get such info with latest QT and don't know any possible solution?
May be you know that MinGW 4.8.0 works fine in all cases and it must be QT-related? Ofcourse I can do some tests by myself, but it will not tell me that source of the troubles is not there.

Best regards and keep working on your product!
Damos.

Last edited by Damos (2013-10-14 13:10:19)

Offline

#4 2013-10-14 13:36:45

Miki
Moderator
Registered: 2012-11-22
Posts: 42

Re: QT 5.1.1 MinGW 4.8.0, cannot compile (linker errors)

Unfortunately, we don't know any possible solution of this problem at the moment.

We just guess that this problem is in QT and it relates to already know problem in QT (see https://bugreports.qt-project.org/browse/QTBUG-32249).

We are sorry but at the moment we can recommend only to move stuff for profiling to modules which do not depend on problematic QT classes and instrument only these ones.

Miki

Offline

#5 2013-10-14 13:51:59

Damos
Member
Registered: 2013-10-11
Posts: 5

Re: QT 5.1.1 MinGW 4.8.0, cannot compile (linker errors)

Hi
Yes, I saw this error and discussion about. It may be related somehow, but I just cannot link project. It's way before "SIGSEGV during the executioon".

Anyway - it's not your fault but QT team or MinGW team.

Best regards!
Damos

Offline

#6 2013-10-14 14:15:09

Miki
Moderator
Registered: 2012-11-22
Posts: 42

Re: QT 5.1.1 MinGW 4.8.0, cannot compile (linker errors)

Hello Damos,

yes, you are right, you are not able even to link project, so it might be something different.

I am just wondering, have you tried to instrument only modules which do not depend on QT? Then, we could distinguish if this is a problem of QT or MinGW.

Regards,

Miki

Offline

#7 2013-10-16 14:50:20

Damos
Member
Registered: 2013-10-11
Posts: 5

Re: QT 5.1.1 MinGW 4.8.0, cannot compile (linker errors)

I'll do such test, but it will not solve all doubts. I have to test it under difefrent compiler (ie. Dragon) and see how it will goes then.

Offline

#8 2013-12-30 14:16:09

me21
Member
Registered: 2013-06-11
Posts: 13

Re: QT 5.1.1 MinGW 4.8.0, cannot compile (linker errors)

I have found a workaround:

If I add

QMAKE_CXXFLAGS += -finstrument-functions-exclude-function-list=load

to my project file, the application is built succesfully.

It has something to do with QString constructors and shared copies counting, because the linker fails after I construct QString in my code. If I do not construct QString, the linker does not complain.
For some reason, something gets broken once profiling calls are inserted in that function.
Of course, if you have any functions named "load", they will not be profiled either, but it's better than nothing...
I have submitted bugreport to Qt team: https://bugreports.qt-project.org/browse/QTBUG-35884

Offline

#9 2013-12-31 08:37:14

Miki
Moderator
Registered: 2012-11-22
Posts: 42

Re: QT 5.1.1 MinGW 4.8.0, cannot compile (linker errors)

@me21: Thanks a lot for the workaround. It seems that some tricky constructions can be broken by functions instrumentation.

Offline

#10 2014-01-09 08:42:27

me21
Member
Registered: 2013-06-11
Posts: 13

Re: QT 5.1.1 MinGW 4.8.0, cannot compile (linker errors)

@Damos: please see the solution proposed on StackOverflow, I've mentioned it in my similar thread on this forum.

Offline

Board footer

Powered by FluxBB