undefined symbols (was: Re: Architecture mixup)

Ian Wadham iandw.au at gmail.com
Fri May 18 21:32:57 PDT 2012


Sorry for the double post on my previous email, Ryan.  Anyway, I am now getting to
the bottom of the problem, see below.

On 18/05/2012, at 6:11 AM, Ryan Schmidt wrote:

> On May 17, 2012, at 01:25, Ian Wadham wrote:
> 
>> Linking CXX executable ktuberling.app/Contents/MacOS/ktuberling
>> Undefined symbols for architecture x86_64:
>> "KStandardGameAction::gameNew(QObject const*, char const*, QObject*)", referenced from:
>>     TopLevel::setupKAction()      in toplevel.o
>> "KStandardGameAction::load(QObject const*, char const*, QObject*)", referenced from:
>>     TopLevel::setupKAction()      in toplevel.o
>> "KStandardGameAction::save(QObject const*, char const*, QObject*)", referenced from:
>>     TopLevel::setupKAction()      in toplevel.o
>> "KStandardGameAction::print(QObject const*, char const*, QObject*)", referenced from:
>>     TopLevel::setupKAction()      in toplevel.o
>> "KStandardGameAction::quit(QObject const*, char const*, QObject*)", referenced from:
>>     TopLevel::setupKAction()      in toplevel.o
>> ld: symbol(s) not found for architecture x86_64
>> collect2: ld returned 1 exit status
>> make[2]: *** [ktuberling/ktuberling.app/Contents/MacOS/ktuberling] Error 1
>> make[1]: *** [ktuberling/CMakeFiles/ktuberling.dir/all] Error 2
>> make[1]: *** Waiting for unfinished jobs….
> 
> The only reason I can think of for symbols being undefined, is those symbols not being there. You'll have to ask the makers of the library if the symbols are really there, and if they are, then ask the makers of the program you're trying to compile why it can't find the symbols.

The symbols were undefined because they were not exported, even though the
library compiled OK.  They were not exported because the KDEGAMES_EXPORT
and KDE_EXPORT macros, used to mark exported symbols in the source-code,
were evaluating to null strings, which compile OK but do nothing.

I have worked around this by defining __KDE_HAVE_GCC_VISIBILITY, the macro on
which the other macros depend, in my CMakeLists.txt.  Crude but effective …

So I am now compiling with kdelibs4 @4.8.2_0 and /usr/bin/c++@ -> llvm-g++-4.2
and building OK, I am happy to say.

Maybe the KDE 4 port developers know where this __KDE_HAVE_GCC_VISIBILITY
macro comes from?  I am also following up on KDE lists.

Thank you for your time, everybody.

All the best, Ian W.



More information about the macports-users mailing list