aMule Forum
English => Compilation problems => Topic started by: Stu Redman on April 28, 2011, 07:44:25 PM
-
aMule SVN with wx trunk, Ubuntu 11.4 with gcc 4.5 (default in 11.4) fails with
Building libmuleappcore.a
Linking amule
amule-ChatSelector.o:(.rodata._ZTV12CChatSession[vtable for CChatSession]+0x7b0): undefined reference to `non-virtual thunk to wxTextCtrlBase::overflow(int)'
amule-ChatSelector.o:(.rodata._ZTV12CChatSession[vtable for CChatSession]+0x7d8): undefined reference to `non-virtual thunk to wxTextCtrl::GetLineLength(long) const'
amule-ChatSelector.o:(.rodata._ZTV12CChatSession[vtable for CChatSession]+0x7e0): undefined reference to `non-virtual thunk to wxTextCtrl::GetLineText(long) const'
... a lot more of these...
./libmuleappgui.a(libmuleappgui_a-MuleTextCtrl.o):(.rodata._ZTV13CMuleTextCtrl[vtable for CMuleTextCtrl]+0x7b0): undefined reference to `non-virtual thunk to wxTextCtrlBase::overflow(int)'
./libmuleappgui.a(libmuleappgui_a-MuleTextCtrl.o):(.rodata._ZTV13CMuleTextCtrl[vtable for CMuleTextCtrl]+0x7d8): undefined reference to `non-virtual thunk to wxTextCtrl::GetLineLength(long) const'
./libmuleappgui.a(libmuleappgui_a-MuleTextCtrl.o):(.rodata._ZTV13CMuleTextCtrl[vtable for CMuleTextCtrl]+0x7e0): undefined reference to `non-virtual thunk to wxTextCtrl::GetLineText(long) const'
... a lot more of these...
WTF? Anybody have an idea? Compilation works with MSVC.
-
What's the purpose of CMuleTextCtrl in the first place?
/**
* This class is a slightly improved wxTextCtrl that supports the traditional
* popup-menu usually provided by text-ctrls. It provides the following options:
* - Cut
* - Copy
* - Paste
* - Clear
* - Select All
*
* Other than that, it acts exactly like an ordinary wxTextCtrl.
*/
Windows: it creates a custom popup with less options than the wxTextCtrl
Linux: both popups of wxTextCtrl and CMuleTextCtrl are identical.
(That's with wx 2.8 in both cases.)
Can we ditch this?
wxTextCtrl doesn't like to be derived from in 2.9 apparently. A quick slash-CMuleTextCtrl-out leaves just the errors for the CChatSession which also derives from it. Could be changed from inheritance to composition, maybe that would work around the problem.
-
How about 2.8? Does it also have the same popups?
Also, we have to keep Mac in mind, and by "we" I mean "I".
-
(That's with wx 2.8 in both cases.)
I couldn't check popups in 2.9 because it didn't compile...
This is fucked up utterly.
I got it compiled now (changing the chatsession), and now it segfaults in
bool CamuleAppCommon::InitCommon(int argc, wxChar ** argv)
{
theApp->SetAppName(wxT("aMule"));
And gdb says:
Program received signal SIGSEGV, Segmentation fault.
0x000000000044b05a in __gnu_cxx::__exchange_and_add (__mem=0xfffffffffffffff8,
__val=-1) at /usr/include/c++/4.5/ext/atomicity.h:46
46 { return __sync_fetch_and_add(__mem, __val); }
(gdb) bt full
#0 0x000000000044b05a in __gnu_cxx::__exchange_and_add (
__mem=0xfffffffffffffff8, __val=-1)
at /usr/include/c++/4.5/ext/atomicity.h:46
No locals.
#1 0x000000000044b0ef in __gnu_cxx::__exchange_and_add_dispatch (
__mem=0xfffffffffffffff8, __val=-1)
at /usr/include/c++/4.5/ext/atomicity.h:79
No locals.
#2 0x000000000044f2c4 in std::basic_string<char, std::char_traits<char>, std::allocator<char> >::_Rep::_M_dispose (this=0xffffffffffffffe8, __a=...)
at /usr/include/c++/4.5/bits/basic_string.h:235
No locals.
#3 0x000000000044f56e in std::basic_string<char, std::char_traits<char>, std::allocator<char> >::assign (this=0xe4a780, __str=...)
at /usr/include/c++/4.5/bits/basic_string.tcc:250
__a = {<__gnu_cxx::new_allocator<char>> = {<No data fields>}, <No data fields>}
__tmp = 0xe69468 "aMule"
#4 0x000000000044ed73 in std::basic_string<char, std::char_traits<char>, std::allocator<char> >::operator= (this=0xe4a780, __str=...)
at /usr/include/c++/4.5/bits/basic_string.h:533
---Type <return> to continue, or q <return> to quit---
No locals.
#5 0x000000000044c633 in wxString::operator= (this=0xe4a780, stringSrc=...)
at /home/martin/amule/wx291/inst/include/wx-2.9/wx/string.h:1923
No locals.
#6 0x00000000006f2ece in wxAppConsoleBase::SetAppName (this=0xe4a680,
name=...) at /home/martin/amule/wx291/inst/include/wx-2.9/wx/app.h:145
No locals.
#7 0x00000000006ef73b in CamuleAppCommon::InitCommon (this=0xe4a960, argc=1,
argv=0xec96f0) at ../../trunk/src/amuleAppCommon.cpp:212
linksPassed = 140737488343840
logfileName = {m_printable = {static npos = 18446744073709551615,
static ms_cache = warning: static field's value depends on the current frame - bad debug info?
/build/buildd/gdb-7.2/gdb/findvar.c:427: internal-error: read_var_value: Assertion `frame' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.
Quit this debugging session? (y or n)
I'd say, wx guys should take awhile before trying to release a 2.9.2 .
And it also STILL doesn't compile static, so I head to mess around with ldconfig, LD_LIBRARY_PATH, whatever. >:(
-
You don't have to do that if you use --with-wxdir=
Anyway, make sure you didn't change a header and didn't make clean, just in case.
(also that error looks familiar...)
-
A month ago I found aMule unusable with wx 2.9. Also wx is not compilable against GTK head (3.0)
IMHO we should wait a least until wx is compilable against gtk-3.0 before trying to debug it.
-
http://www.google-melange.com/gsoc/project/google/gsoc2011/john_chain/12001
-
http://www.google-melange.com/gsoc/project/google/gsoc2011/john_chain/12001
Good. In fact not a lot of things had to be done, I almost managed to compile wx against gtk-3.0 in a few hours, mainly deprecated stuff, etc...
-
Anyway, make sure you didn't change a header and didn't make clean, just in case.
Checked out wx fresh, built it and aMule fresh (with TextCtrl patches). Same. Removed that line, next crash on a wxString == . With gdb crash again. Looks like all wxString ops are fucked.
Duuhh.
-
You know, this is strange. I don't think we're approaching it right. What does that error (non-virtual thunk) mean anyway? So far I have only been able to see reports of it being a COMPILER bug.
-
My guess is that you are linking c++ libraries built with gcc 4.4 and 4.5.
Note that the C++ ABI may change between releases. Stu, try to recompile everything with the same compiler version and try again.
-
By everything of course I mean just C++ libraries. C-only stuff should be OK.
-
Stu, try to recompile everything with the same compiler version and try again.
If by "everything" you mean "wx and aMule" - I did just that. For cryptopp and zlib I just installed libdev packages though.
I didn't supply a compiler to any configure either, it's just the plain gcc shipping with Nutty (which is 4.5).
I used the same technique for building with wx 2.8.12 which works fine.
Wait a moment. 2.8.12 I built static, so no dll hell (or .so hell). With 2.9 this didn't work. I got some really strange error message. Probably the same thunk junk. Since static didn't work before either I shrugged it off and rebuilt dynamic.
Might I be mixing in something that ships with Ubuntu?
I think I'll check if my Morose Mungo still works and rebuild the whole crap there.
What does that error (non-virtual thunk) mean anyway?
I think I read in the wx doku that some control classes can't be overloaded because some functions are not declared virtual. So that's why I tried not overloading it which at least makes it compile. No idea if the strange compiler error and the string crash are even related.
-
Yeah but; do wx samples break too?
-
I get the same error here. 2.8.12 works fine, 2.9.2 (svn) fails. All I could find about this error in the short time I have now, is that compilation might succeed with gcc3 even though it fails with gcc4. I'll test it sometime soon.
<edit>...and that it might be related to virtual functions of a class being split over multiple source files. None of these informations can be depended on, though</edit>
-
Ok, I can't upgrade to 11.04 yet, I'll try to reproduce it when I can update.
As I understand, this has nothing to do with compiling static, the same error happens with dynamic libs, right?
Does compiling with gcc 4.4 solves it? You may use galternatives aliases or CC= env to do that.
Stu, Debian/Ubuntu debs plan to deprecate static linking, you may not agree but it is their choice :(
-
Error also happens on MacOSX 10.6.5, with... i686-apple-darwin10-gcc-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5664)
-
The thunk error or the crash?
Mind, I worked around the thunk error in 10546, if anybody wants to reproduce it use an older version.
The crash is bothering me way more.
-
Tried it with Ubuntu 10.10 (gcc 4.4). Identical behavior.
-
You don't have to do that if you use --with-wxdir=
Does not help. ldconfig is still required.
-
No it isn't. It was never required for me.
-
Just for the logs:
I compiled aMule-svn-10545 (just before "dropping" MuleTextCtrl) and wxWidgets-svn-67634 with:
1) gcc-4.4.2: "undefined reference" errors as the topic of this thread says
2) gcc-3.4.6: compiled cleanly, runs, connects with HighID to both servers and kad. The only failure was HTTP download, it always returned "Void response on stream creation", but that might be caused by my setup.
So, it seems that the problem is really a compiler bug. Unfortunately we just cannot tell everyone to revert to gcc3 :/
-
You don't have to do that if you use --with-wxdir=
Does not help. ldconfig is still required.
Read ldconfig's man page. ldconfig is only needed in relationship with /etc/ld.so.conf, so it is weird you need to run it.
-
So, it seems that the problem is really a compiler bug. Unfortunately we just cannot tell everyone to revert to gcc3 :/
The question is if the bug is in gcc3 or in gcc4.
-
No it isn't. It was never required for me.
My bad. I passed the install dir instead of the build dir . Now it works (well - segfaults...) Neat.
Maybe configure should check if there are dynamic libs in the place it later tells the linker to search them?
Wx samples seem to work however. ???
Unfortunately we just cannot tell everyone to revert to gcc3 :/
Well, gcc4 has been out for 6 years. Did you build gcc3 yourself or is your distro that old?
But I can believe wx devs still use it (seeing from the changelog how lovingly they try to keep it running with VC6, but don't offer projects for VC10 otoh).
Next attempt: build wx without optimize.
Edit: segfaults too.
-
Tried wx 2.9.1:
- compiles without thunky-error
- new and interesting crash:
Assertion failed: ../wxWidgets-2.9.1/include/wx/strvararg.h:wxArgNormalizer:449: Assertion '(argtype & (wxFormatStringSpecifier<T>::value)) == argtype' failed. format specifier doesn't match argument type
Backtrace follows:
Program received signal SIGSEGV, Segmentation fault.
0x00007ffff50eb100 in wcslen () from /lib/x86_64-linux-gnu/libc.so.6
(gdb) bt
#0 0x00007ffff50eb100 in wcslen () from /lib/x86_64-linux-gnu/libc.so.6
#1 0x00007ffff5ed1a59 in operator+ (pwz=0x0, str=...)
at ../wxWidgets-2.9.1/src/common/string.cpp:700
#2 0x000000000079f617 in operator+ (buf=..., string=...)
at /home/martin/amule/wx291/wxWidgets-2.9.1/include/wx/string.h:4022
#3 0x000000000079ec20 in get_backtrace (n=3)
at ../../../../trunk/src/libs/common/MuleDebug.cpp:405
#4 0x000000000079f4c4 in print_backtrace (n=3)
at ../../../../trunk/src/libs/common/MuleDebug.cpp:476
#5 0x0000000000460a84 in CamuleApp::OnAssertFailure (this=0xe19400,
file=0xe97b80 L"../wxWidgets-2.9.1/include/wx/strvararg.h", line=449,
func=0xe98460 L"wxArgNormalizer",
cond=0xe98b80 L"(argtype & (wxFormatStringSpecifier<T>::value)) == argtype", msg=0xe98630 L"format specifier doesn't match argument type")
at ../../trunk/src/amule.cpp:1091
#6 0x00007ffff5e3cb1b in wxDefaultAssertHandler (file=..., line=449,
func=..., cond=..., msg=...)
at ../wxWidgets-2.9.1/src/common/appbase.cpp:1053
#7 0x00007ffff5e3d277 in wxOnAssert (
file=0x7ffff624d318 "../wxWidgets-2.9.1/include/wx/strvararg.h", line=449,
func=0x7ffff624d430 "wxArgNormalizer",
---Type <return> to continue, or q <return> to quit---
cond=0x7ffff624d2d8 "(argtype & (wxFormatStringSpecifier<T>::value)) == argtype", msg=0x7ffff624d2a8 "format specifier doesn't match argument type")
at ../wxWidgets-2.9.1/src/common/appbase.cpp:1129
#8 0x00007ffff623f3a0 in wxArgNormalizer<unsigned int>::wxArgNormalizer (
this=0x7fffffffd1e0, value=1, fmt=0x7fffffffd270, index=4)
at ../wxWidgets-2.9.1/include/wx/strvararg.h:449
#9 0x00007ffff623f2e6 in wxArgNormalizerUtf8<unsigned int>::wxArgNormalizerUtf8 (this=0x7fffffffd1e0, value=1, fmt=0x7fffffffd270, index=4)
at ../wxWidgets-2.9.1/include/wx/strvararg.h:481
#10 0x00007ffff623f0da in wxString::Format<unsigned int, unsigned int, unsigned int, unsigned int> (f1=..., a1=127, a2=0, a3=1, a4=1)
at ../wxWidgets-2.9.1/include/wx/string.h:2325
#11 0x00007ffff623e457 in wxIPV4address::IPAddress (this=0x7fffffffd300)
at ../wxWidgets-2.9.1/src/common/sckaddr.cpp:882
#12 0x00000000007799a8 in StringHosttoUint32 (Host=...)
at ../../trunk/src/NetworkFunctions.cpp:83
#13 0x000000000045b732 in CamuleApp::OnInit (this=0xe19400)
at ../../trunk/src/amule.cpp:380
#14 0x0000000000656250 in CamuleGuiApp::OnInit (this=0xe19400)
at ../../trunk/src/amule-gui.cpp:275
#15 0x0000000000467039 in wxAppConsoleBase::CallOnInit (this=0xe19400)
---Type <return> to continue, or q <return> to quit---
at /home/martin/amule/wx291/wxWidgets-2.9.1/include/wx/app.h:92
#16 0x00007ffff5ea7541 in wxEntry (argc=@0x7ffff6214150, argv=0xddc880)
at ../wxWidgets-2.9.1/src/common/init.cpp:456
#17 0x00007ffff5ea7632 in wxEntry (argc=@0x7fffffffe20c, argv=0x7fffffffe2f8)
at ../wxWidgets-2.9.1/src/common/init.cpp:484
#18 0x0000000000655553 in main (argc=1, argv=0x7fffffffe2f8)
at ../../trunk/src/amule-gui.cpp:93
(gdb) bt full
#0 0x00007ffff50eb100 in wcslen () from /lib/x86_64-linux-gnu/libc.so.6
No symbol table info available.
#1 0x00007ffff5ed1a59 in operator+ (pwz=0x0, str=...)
at ../wxWidgets-2.9.1/src/common/string.cpp:700
s = {static npos = 18446744073709551615, static ms_cache = warning: static field's value depends on the current frame - bad debug info?
/build/buildd/gdb-7.2/gdb/findvar.c:427: internal-error: read_var_value: Assertion `frame' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.
Quit this debugging session? (y or n) n
/build/buildd/gdb-7.2/gdb/findvar.c:427: internal-error: read_var_value: Assertion `frame' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.
Create a core file of GDB? (y or n) n
<error reading variable>
__FUNCTION__ = "operator+"
s = {static npos = 18446744073709551615, static ms_cache = warning: static field's value depends on the current frame - bad debug info?
I had wx 2.9.1 running before. Maybe it was a 32 bit Linux? Can't tell.
-
The thunk error or the crash?
Mind, I worked around the thunk error in 10546, if anybody wants to reproduce it use an older version.
You workarounded it for yourself - but on the mac system mentioned above, it still exist for other classes (like wxListBox)
-
Oh, my...
I realized, that in the above test I built aMule and wx with gcc4 with debug enabled and optimization disabled, but with gcc3 with debug disabled and optimization enabled. So, for the clarity of the test I repeated the gcc4 compilation with --enable-optimize and --disable-debug.
Guess what? Yes, you're right. Compiled successfully, working O.K. (Still the version before Stu patched MuleTextCtrl).
Any idea?
-
Make a reproducible test case, inform wxWidgets devs and possibly CC: to gcc devs.
Now, as for lazy ideas... I got nothing.
-
--disable-debug ? LOL. Didn't try that one yet. Let's see...
-
F-ass-cinating...
wx noDebug optimize, aMule debug noOptimize -> same crash
Both noDebug optimize ->works . "Fixes" both the compile error and the crashes.
And networking appears to be fine (unlike in Windows - it used to be the other way round some time ago).
Now there are 16 possibilities for setting debug and optimize in wx and aMule. Let's try some more.
(I'm tending towards "debug".)
-
Tended in the right direction. All with wx: +opt -debug
amule:
+opt +debug fail
-opt +debug fail
+opt -debug ok
-opt -debug ok
thunk error and crashes with worked-around thunk error are always related.
Now what? Is "build aMule 2.3.1 rc1 with and without debug and see what happens" a valid test case for wx devs?
-
I'm going to bet on "no"
-
I was afraid of that...
I rebuilt wx with -opt +debug , and the results are all the same:
amule:
-opt +debug fail
-opt -debug ok
So it's just aMule's debug option that triggers the problems.
-
This (http://forum.amule.org/index.php?topic=7330.0) doesn't work either. :(
I did a bunch of googling about this error. Basically it's a missing symbol, just one used in a vtab of a virtual class. It can have lots of causes.
- broken compiler (would have come up)
- libs for other compiler versions (would have come up)
- mixed compiler builds (nope)
- general missing library problems (then it's accompanied by ordinary missing symbol erros usually)
So what now? ???
-
Can someone please verify we're using EXACTLY the same flags when compiling all parts of aMule?
-
g++ -DHAVE_CONFIG_H -I. -I../../trunk/src -I.. -D__DEBUG__ -D_GLIBCXX_DEBUG -D_GLIBCXX_DEBUG_PEDANTIC -DUSE_WX_EXTENSIONS
-I/home/martin/amule/wx291/build/lib/wx/include/gtk2-unicode-2.9 -I/home/martin/amule/wx291/wxsvn/include -D_FILE_OFFSET_BITS=64 -DwxDEBUG_LEVEL=0
-DWXUSINGDLL -D__WXGTK__ -I../../trunk/src/libs -I../../trunk/src/include -DENABLE_IP2COUNTRY=1 -g -W -Wall -Wshadow -Wundef -ggdb -fno-inline -fmessage-length=0
-MT libmuleappgui_a-MuleTextCtrl.o -MD -MP -MF .deps/libmuleappgui_a-MuleTextCtrl.Tpo -c -o libmuleappgui_a-MuleTextCtrl.o `test -f 'MuleTextCtrl.cpp' || echo '../../trunk/src/'`MuleTextCtrl.cpp
I'm having suspicions about -D_GLIBCXX_DEBUG -D_GLIBCXX_DEBUG_PEDANTIC and also about -DwxDEBUG_LEVEL=0 . I've read that when using the GLIBCXX_DEBUG options in a lib they have to be present in the code as well. Maybe it's the other way round too? How can I turn them off?
-
Sure thing, I was suspicious of them and indeed, that fixes it. And at least on Mac, it's KNOWN that std debugging on gcc (4.x) is bugged.
-
Totally did it in Linux too. :D
-
And also WORKS on Mac:
2011-05-08 05:42:35: amuleAppCommon.cpp(331): Initialising aMule SVN compiled with wxOSX Cocoa v2.9.2 (Debugging) (Snapshot: rev. 10562)