scons: Fix test suite linking step after the hotkey refactoring changes

1b1de2e720 adds a few files in replacement
of src/hotkeys.cpp and this somehow broke the test suite target's
linking step resulting in the following errors:

  game_config_manager.cpp:(.text._ZN10test_utils19game_config_managerC2Ev[_ZN10test_utils19game_config_managerC5Ev]+0x4b): undefined reference to `hotkey::manager::manager()'
  game_config_manager.cpp:(.text._ZN10test_utils19game_config_managerC2Ev[_ZN10test_utils19game_config_managerC5Ev]+0x631): undefined reference to `hotkey::manager::~manager()'
  collect2: error: ld returned 1 exit status

This is apparently a linking order issue, since those symbols actually
exist in the object set linked into the test suite executable.

After some fiddling around I discovered that changing the test suite
linking order as follows appears to fix the issue:

Before: libwesnoth_extras.a lua/liblua.a libwesnoth_core.a libwesnoth_sdl.a libwesnoth.a libwesnoth_extras.a lua/liblua.a libtest_utils.a

Now: libtest_utils.a libwesnoth_extras.a lua/liblua.a libwesnoth_core.a libwesnoth_sdl.a libwesnoth.a

The most obvious change is that libtest_utils.a is now linked first.
Additionally, libwesnoth_extras.a and liblua.a are only linked once at
the start. The duplicated entries were introduced in commit
b08bb2e9b1, but I couldn't really find an
issue with deduplicating them (tested with clang 3.2 and gcc 4.8).

I am not really sure what's going on, but loonycyborg told me to commit
the fix anyway. If Wesnoth spontaneously ignites, you know I am not the
_only_ one to blame.

Nothing of this should affect compilation and linking of the other
targets.
This commit is contained in:
Ignacio R. Morelle 2013-12-04 20:27:10 -03:00
parent 82a190be5f
commit 0fbd864748

View file

@ -652,7 +652,7 @@ test_sources = Split("""
""")
test_sources.extend(test_env.Object("tests/test_config_cache.cpp"))
test = test_env.WesnothProgram("test", test_sources + [libwesnoth_extras, libwesnoth_core, libwesnoth_sdl, libwesnoth, libwesnoth_extras, libtest_utils], have_test_prereqs)
test = test_env.WesnothProgram("test", test_sources + [libtest_utils, libwesnoth_extras, libwesnoth_core, libwesnoth_sdl, libwesnoth], have_test_prereqs)
create_images_sources = Split("""
tests/create_images.cpp