boost_unit_test_framework is required to build widelands

Bug #613590 reported by Timowi
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
widelands
Opinion
Low
Unassigned

Bug Description

the merge of fix-lua-msvc introduced a requirement of boost_unit_test_framework. It is not possible to build widelands with boost headers only anymore. Please change the detection of unit_test_framework so it is possible to compile without unit_test_framework.

This is my cmake output:

CMake Error at /usr/share/cmake-2.8/Modules/FindBoost.cmake:894 (message):
  Unable to find the requested Boost libraries.

  Boost version: 1.38.0

  Boost include path: /opt/mingw/usr

  The following Boost libraries could not be found:

          boost_unit_test_framework

  No Boost libraries were found. You may need to set Boost_LIBRARYDIR to the
  directory containing Boost libraries or BOOST_ROOT to the location of
  Boost.
Call Stack (most recent call first):
  CMakeLists.txt:113 (find_package)

-- Using compiler flags: -g -DDEBUG -DNOPARACHUTE -Wold-style-cast -isystem /opt/mingw/usr -Wno-attributes -Wall
-- Found GGZ_Core: /opt/mingw/usr/lib/libggzmod.a;/opt/mingw/usr/lib/libggzcore.a;/opt/mingw/usr/lib/libggz.dll.a
-- SDLMAIN_LIBRARY is /opt/mingw/usr/lib/libSDLmain.a
Excluded unit tests for scripting because boost unit_test_framework was not found.
-- Configuring incomplete, errors occurred!

Related branches

Revision history for this message
SirVer (sirver) wrote :

The basic idea of unit tests are that they are considered part of the build process. Is it much pain to leave the dependency in? Otherwise we will miss out on some errors, methinks.

Changed in widelands:
status: Confirmed → Opinion
Revision history for this message
Timowi (timo-wingender) wrote :

I am not against using the boost test framework but against making the test framework mandatory. Right now the test are not build if the test framework is not found. But cmake fails if the test framework is not found.

For most user/builders this is no Problem as all system have the boost available completely. But I am building small environments for static linking and cross compiling (mingw). There every dependency is a pain. Up to now I only exported the boost headers for that. Building all the libraries is much more work.

I would remove the REQUIRED from the find_package for boost and afterwards check if boost headers were found.

Revision history for this message
Timowi (timo-wingender) wrote :
Revision history for this message
Timowi (timo-wingender) wrote :

This patch should fix this bug and #613556. Unit test will get compiled if boost_unit_test_framework was found.

Revision history for this message
Jari Hautio (jarih) wrote :

I also think that having unit tests should be optional. At least until they have better coverage. They are already conditionally handled in the test code. I considered having boost finding code more optional, but decided to go with the same code as in spice-up-cmake branch to minimize problems later.

You should be able to build full widelands by just ignoring the error message. I have tested it with windows/VS2008 using only boost headers.

I'm testing with following boost finding code:

find_package(Boost 1.35.0 COMPONENTS unit_test_framework)
if (NOT Boost_FOUND)
  find_package(Boost 1.35.0 REQUIRED)
endif()

This has benefit that it leaves all variables in proper state.

Revision history for this message
Jari Hautio (jarih) wrote :

Ah, Timo got the same idea. I'm a bit nervous about switching to single threaded libs, but for me it's ok as there are problems with binaries. Just be careful when next boost library is used as widelands is running threaded code in certain places. Visual studio build uses automatic linking for boost to get always the right library version, so it's not an issue there.

Revision history for this message
Timowi (timo-wingender) wrote :

There is no Problem with using the single threaded _headers_ (widelands uses no boost libraries). Widelands is a single threaded application. And even if we you have thread you do not necessarily need the multi thread enabled. This is necessary if you share certain function between threads.

Revision history for this message
David Allwicher (aber) wrote :

The mac binaries carry x86 and x86_64 code. I have the boost library installed but only for x86_64. Linking against the x86 version of the boost library will fail.

Revision history for this message
Jari Hautio (jarih) wrote :

If CMake has problems to identify the correct library version for linking, then it's propably best to have an explicit option for including unit tests to build.

I'll include a patch for it. It defaults to disable building unit tests. However, my opinion is that in the long term it pays off to invest in unit testing and try to include them in the default build. Still there's no need to require developers to hunt for missing libraries, until there are enough unit tests to justify the troubles.

Revision history for this message
Jari Hautio (jarih) wrote :

I just committed a fix to make building unit tests optional through BUILD_UNIT_TESTS variable. Default is ON, but it's now easy to remove them from build if problems arise.

Disabling testing also removes test target so that succesful "make test" always means that all tests have run successfully.

Revision history for this message
Jari Hautio (jarih) wrote :

Update here also that tests are now OFF by default.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.