On my workplace we've got project consisting of many apps that need to be built both for ARM and x86. ARM version builds fine with Marvell GCC 4.8.5 cross toolchain. Now I'm working on x86 build (GCC version 4.8.5-4ubuntu8) and got several undefined reference errors in one app. Unfortunately I could not neither share sources (maybe only fragments of them) nor make minimal example, which shows error, but I've made a little investigation on this trouble and here is what I've found.
Failing app linking stage shows following errors:
src/<...>.o:(.data.rel.ro.<...>[<...>]+0xc0): undefined reference to `non-virtual thunk to <...>::OnBeforeRun()'
src/<...>.o:(.data.rel.ro.<...>[<...>]+0xc8): undefined reference to `non-virtual thunk to <...>::OnRun()'
src/<...>.o:(.data.rel.ro.<...>[<...>]+0xd0): undefined reference to `non-virtual thunk to <...>::OnAfterRun()'
src/<...>.o: In function `<...>::Application(<...>::Runtime&, <...>::SystemFacilityCollection&, <...>::Logger&, char const*, int, char const**)':
<...>/dhcconf.cxx:11: undefined reference to `<...>::Name() const'
src/<...>.o: In function `main':
<...>/main.cxx:21: undefined reference to `<...>::Syslog(std::string const&)'
collect2: error: ld returned 1 exit status
Don't know what to do with leading "non-virtual thunk" errors (that's another one question, but for now let's ignore them), but about last two errors I've got few tips about what caused them.
I've found library containing functions, references to which could not be resolved (<...>::Name from <...>/dhcconf.cxx:11 and <...>::Syslog from <...>/main.cxx:21) and listed symbols from it (of course this lib is correctly specified with -l flag):
$ nm --demangle --dynamic --defined-only --extern-only <...>.so | grep Name
0000000000245956 T <...>::Name[abi:cxx11]() const
$ nm --demangle --dynamic --defined-only --extern-only <...>.so | grep Syslog
000000000025e392 T <...>::Syslog(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)
There are many other symbols from this lib which also contain [abi:cxx11] specifier and use __cxx11 types, but seems that target app does not use them and I'm pretty sure that exactly these cxx11 related stuff cause errors.
Broken app is built with -std=gnu++0x flag. Tried to built library which contains desired symbols with -D_GLIBCXX_USE_CXX11_ABI=0, it makes target app build fine, but breaks few other apps, so it is not the way. Other ways to fix this errors I could not find.
Coult anybody help me with this issue? Thanks in advance.
Aucun commentaire:
Enregistrer un commentaire