Error when linking Wesnoth

Get help with compiling or installing the game, and discuss announcements of new official releases.

Moderator: Forum Moderators

Post Reply
Pablos
Posts: 3
Joined: April 13th, 2016, 6:32 pm

Error when linking Wesnoth

Post by Pablos »

Hello to everyone,

In order to start editing Wesnoth source code, I have tried to compile it. I had no problem if I compile Wesnoth without the Test option in CMake, but when I perform the same action with Test option enabled I get the following error:

Code: Select all

[ 98%] Linking CXX executable ../test
libwesnoth-gui_widget.a(combobox.cpp.o): In function `gui2::tdrop_down_list::tdrop_down_list(SDL_Rect, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, int, bool)':
/home/pablos/Desarrollo/kdevelop/wesnoth/src/gui/dialogs/drop_down_list.hpp:30: undefined reference to `vtable for gui2::tdrop_down_list'
libwesnoth-gui_widget.a(combobox.cpp.o): In function `gui2::tdrop_down_list::~tdrop_down_list()':
/home/pablos/Desarrollo/kdevelop/wesnoth/src/gui/dialogs/drop_down_list.hpp:23: undefined reference to `vtable for gui2::tdrop_down_list'
collect2: error: ld returned 1 exit status
src/CMakeFiles/test.dir/build.make:1029: recipe for target 'test' failed
make[2]: *** [test] Error 1
CMakeFiles/Makefile2:852: recipe for target 'src/CMakeFiles/test.dir/all' failed
make[1]: *** [src/CMakeFiles/test.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
libwesnoth-gui_widget.a(combobox.cpp.o): In function `gui2::tdrop_down_list::tdrop_down_list(SDL_Rect, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, int, bool)':
/home/pablos/Desarrollo/kdevelop/wesnoth/src/gui/dialogs/drop_down_list.hpp:30: undefined reference to `vtable for gui2::tdrop_down_list'
libwesnoth-gui_widget.a(combobox.cpp.o): In function `gui2::tdrop_down_list::~tdrop_down_list()':
/home/pablos/Desarrollo/kdevelop/wesnoth/src/gui/dialogs/drop_down_list.hpp:23: undefined reference to `vtable for gui2::tdrop_down_list'
collect2: error: ld returned 1 exit status
src/CMakeFiles/wesnoth.dir/build.make:144: recipe for target 'wesnoth' failed
make[2]: *** [wesnoth] Error 1
CMakeFiles/Makefile2:345: recipe for target 'src/CMakeFiles/wesnoth.dir/all' failed
make[1]: *** [src/CMakeFiles/wesnoth.dir/all] Error 2
Makefile:149: recipe for target 'all' failed
make: *** [all] Error 2
*** Fallo: Código de salida 2 ***
Does anyone know what could be happening? I am compiling the master branch in Linux.

Thank you in advance
User avatar
Dugi
Posts: 4961
Joined: July 22nd, 2010, 10:29 am
Location: Carpathian Mountains
Contact:

Re: Error when linking Wesnoth

Post by Dugi »

Somebody has made a bad update that broke some inheritance code for dropdown list in the GUI. I failed to find a recent commit that could do it.

What was broken in your case was the target test, which isn't what you need. Try to compile only the target wesnoth and see if the error appears there too.
Pablos
Posts: 3
Joined: April 13th, 2016, 6:32 pm

Re: Error when linking Wesnoth

Post by Pablos »

Dugi wrote:What was broken in your case was the target test, which isn't what you need. Try to compile only the target wesnoth and see if the error appears there too.
Thak you for your answer! Of course, if I disable the tests there is no problem compiling Wesnoth. However I think I need the tests if I want to be able to collaborate in the project. Am I right? That is my intention.
User avatar
Celtic_Minstrel
Developer
Posts: 2166
Joined: August 3rd, 2012, 11:26 pm
Location: Canada
Contact:

Re: Error when linking Wesnoth

Post by Celtic_Minstrel »

You can contribute without building the tests. It's better if you can build them, and this problem should certainly still be fixed, but as long as you can build the game itself, that's sufficent. (For the record, I still can't run the tests either.)

Looking at the error, I think this most likely means that the source file defining tdrop_down_list (which I think is src/gui/dialogs/drop_down_list.cpp) is missing from the CMake test build, so perhaps you could even fix it yourself. :)
Author of The Black Cross of Aleron campaign and Default++ era.
Former maintainer of Steelhive.
User avatar
Iris
Site Administrator
Posts: 6797
Joined: November 14th, 2006, 5:54 pm
Location: Chile
Contact:

Re: Error when linking Wesnoth

Post by Iris »

I took a quick look and committed a fix which hopefully fixes these issues.
Author of the unofficial UtBS sequels Invasion from the Unknown and After the Storm.
Pablos
Posts: 3
Joined: April 13th, 2016, 6:32 pm

Re: Error when linking Wesnoth

Post by Pablos »

Thank you for your responses. And thank you shadowm, your commit has fixed the problem and test are compiled now.

By the way, anyone knows how to execute the tests? According to tests help:

Code: Select all

test [Boost.Test argument]... -- [custom test module argument]...
but I do not know where these custom test modules are, and in case I run test executable without that parameter it says:

Code: Select all

20160419 22:59:08 error filesystem: Trying to open file with empty name.
20160419 22:59:08 error preprocessor: Could not open file 
20160419 22:59:08 error filesystem: Trying to open file with empty name.
20160419 22:59:08 error preprocessor: Could not open file 
Since the main problem was solved, sould I mark this thread as solved?
User avatar
Iris
Site Administrator
Posts: 6797
Joined: November 14th, 2006, 5:54 pm
Location: Chile
Contact:

Re: Error when linking Wesnoth

Post by Iris »

Those errors (and any other messages output with Wesnoth’s own logging facility in the form <timestamp> <log level> <logdomain>: <message>) are actually normal and expected and don’t necessarily mean that any tests have failed. If a test has failed, the test target will exit with a non-zero status and I believe you will see the source of the error clearly mentioned at the end of the output.

Also, in case you are interested in running individual tests, there is some documentation for the unit tests library we use here; test suites and tests are defined as code in src/tests/.
Author of the unofficial UtBS sequels Invasion from the Unknown and After the Storm.
Post Reply