Opened 11 years ago

Closed 11 years ago

Last modified 13 months ago

#3974 closed defect (fixed)

ALL: Linker errors when building ScummVM

Reported by: eriktorbjorn Owned by: fingolfin
Priority: normal Component: Port: Linux
Keywords: Cc:
Game:

Description

Latest SVN snapshot

I'm currently not able to compile ScummVM because of linking errors. See linker output below.

It's as if the linking process never sees the base/game.o file. I tried passing the --verbose option to the linker, and part of the output read:

attempt to open base/libbase.a succeeded
(base/libbase.a)main.o
(base/libbase.a)commandLine.o
(base/libbase.a)plugins.o
(base/libbase.a)version.o

Note how base/game.o is missing. The manual makes vague references to the linker throwing away unnecessary object files, but I don't know what constitutes an unnecessary object file.

http://www.lysium.de/blog/index.php?/archives/222-Lost-static-objects-in-static-libraries-with-GNU-linker-ld.html has some things to say about the problem, but I don't really understand it yet.

I do know that if I add base/game.o manually to the build command, or surround base/libbase.a with -Wl,--whole-archive ... -Wl,--no-whole-archive it works.

I did notice that the code in base/game.cpp is not in any namespace, but I don't know if that makes any difference.

Linker output:

engines/scumm/libscumm.a(detection.o): In function `ScummMetaEngine::querySaveMetaInfos(char const*, int) const':
/home/d91tan/src/CVS/scummvm/engines/scumm/detection.cpp:1004: undefined reference to `SaveStateDescriptor::setDeletableFlag(bool)'
/home/d91tan/src/CVS/scummvm/engines/scumm/detection.cpp:1005: undefined reference to `SaveStateDescriptor::setThumbnail(Graphics::Surface*)'
/home/d91tan/src/CVS/scummvm/engines/scumm/detection.cpp:1014: undefined reference to `SaveStateDescriptor::setSaveDate(int, int, int)'
/home/d91tan/src/CVS/scummvm/engines/scumm/detection.cpp:1019: undefined reference to `SaveStateDescriptor::setSaveTime(int, int)'
/home/d91tan/src/CVS/scummvm/engines/scumm/detection.cpp:1025: undefined reference to `SaveStateDescriptor::setPlayTime(int, int)'
engines/scumm/libscumm.a(detection.o): In function `ScummMetaEngine::detectGames(Common::FSList const&) const':
/home/d91tan/src/CVS/scummvm/engines/scumm/detection.cpp:720: undefined reference to `findPlainGameDescriptor(char const*, PlainGameDescriptor const*)'
/home/d91tan/src/CVS/scummvm/engines/scumm/detection.cpp:723: undefined reference to `GameDescriptor::updateDesc(char const*)'
engines/kyra/libkyra.a(detection.o): In function `KyraMetaEngine::querySaveMetaInfos(char const*, int) const':
/home/d91tan/src/CVS/scummvm/engines/kyra/detection.cpp:1209: undefined reference to `SaveStateDescriptor::setDeletableFlag(bool)'
/home/d91tan/src/CVS/scummvm/engines/kyra/detection.cpp:1210: undefined reference to `SaveStateDescriptor::setThumbnail(Graphics::Surface*)'
engines/queen/libqueen.a(queen.o): In function `QueenMetaEngine::detectGames(Common::FSList const&) const':
/home/d91tan/src/CVS/scummvm/engines/queen/queen.cpp:119: undefined reference to `GameDescriptor::updateDesc(char const*)'
/home/d91tan/src/CVS/scummvm/engines/queen/queen.cpp:121: undefined reference to `GameDescriptor::updateDesc(char const*)'
/home/d91tan/src/CVS/scummvm/engines/queen/queen.cpp:123: undefined reference to `GameDescriptor::updateDesc(char const*)'
/home/d91tan/src/CVS/scummvm/engines/queen/queen.cpp:125: undefined reference to `GameDescriptor::updateDesc(char const*)'
engines/sky/libsky.a(sky.o): In function `SkyMetaEngine::detectGames(Common::FSList const&) const':
/home/d91tan/src/CVS/scummvm/engines/sky/sky.cpp:191: undefined reference to `GameDescriptor::updateDesc(char const*)'
gui/libgui.a(launcher.o): In function `GUI::SaveLoadChooser::updateSelection(bool)':
/home/d91tan/src/CVS/scummvm/gui/launcher.cpp:678: undefined reference to `SaveStateDescriptor::getBool(Common::String const&) const'
common/libcommon.a(advancedDetector.o): In function `Common::toGameDescriptor(Common::ADGameDescription const&, PlainGameDescriptor const*)':
/home/d91tan/src/CVS/scummvm/common/advancedDetector.cpp:153: undefined reference to `GameDescriptor::updateDesc(char const*)'
common/libcommon.a(advancedDetector.o): In function `Common::AdvancedDetector::findGameID(char const*, PlainGameDescriptor const*, Common::ADObsoleteGameID const*)':
/home/d91tan/src/CVS/scummvm/common/advancedDetector.cpp:117: undefined reference to `findPlainGameDescriptor(char const*, PlainGameDescriptor const*)'
/home/d91tan/src/CVS/scummvm/common/advancedDetector.cpp:127: undefined reference to `findPlainGameDescriptor(char const*, PlainGameDescriptor const*)'
collect2: ld returned 1 exit status
make: *** [scummvm] Error 1

Ticket imported from: #2114739. Ticket imported from: bugs/3974.

Change History (5)

comment:1 by SF/mthreepwood, 11 years ago

I'm also getting some other ones:

backends/libbackends.a(compressed-saves.o): In function `Z14wrapInSaveFilePN6Common18SeekableReadStreamE':c:/Documents and Settings/Hoops/My Documents/Mohawk/backends/saves/compressed/compressed-saves.cpp:31: undefined reference to `Common::wrapCompressedReadStream(Common::SeekableReadStream*)'
backends/libbackends.a(compressed-saves.o): In function `Z15wrapOutSaveFilePN6Common11WriteStreamEb':c:/Documents and Settings/Hoops/My Documents/Mohawk/backends/saves/compressed/compressed-saves.cpp:35: undefined reference to `Common::wrapCompressedWriteStream(Common::WriteStream*)'

comment:2 by eriktorbjorn, 11 years ago

I think the wrapCompressed...Stream() errors were the ones I got this morning. I believe things were fixed (and then thoughtfully re-broken again :-) at some point during the day.

comment:3 by eriktorbjorn, 11 years ago

Though when building a very stripped-down version of ScummVM, that only contained one work-in-progress engine (that someone else is working on, not me), I too got the wrapCompressed...Stream() errors. So apparently they can still happen, under certain circumstances. I haven't tried to reproduce it with the "real" ScummVM however.

comment:4 by fingolfin, 11 years ago

Resolution: fixed
Status: newclosed

comment:5 by digitall, 13 months ago

Component: --Unset--Port: Linux
Note: See TracTickets for help on using tickets.