GNOME Bugzilla – Bug 791476
Under Ubuntu, CMake without Ninja failed to generate
Last modified: 2017-12-11 16:11:41 UTC
Created attachment 365359 [details] [review] Patch to move ensure_ninja_binary() calls before the test of self.use_ninja My platform: 4.13.0-17-generic #20-Ubuntu SMP Mon Nov 6 10:04:08 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux Ninja package not installed JHBuild package installed : srcdir = "/build/jhbuild-480Apv/jhbuild-3.15.92+20171014~ed1297d" Error when building: cmake -DCMAKE_INSTALL_PREFIX=/home/bruno/blacknut/third-parts/windows.static.player.x86_64-w64-mingw32/root -DCMAKE_INSTALL_LIBDIR=lib -G Ninja -DCMAKE_CXX_FLAGS='-std=c++11 -s' -DCMAKE_TOOLCHAIN_FILE=../../../cmake/toolchain.windows.x86_64-w64-mingw32.cmake -DCMAKE_COMMON_COMPILER_FLAGS= -DWIN32=true -DBUILD_SHARED_LIBS=false /home/bruno/blacknut/third-parts/windows.static.player.x86_64-w64-mingw32/src/live666-releases-1.14.0 CMake Error: CMake was unable to find a build program corresponding to "Ninja". CMAKE_MAKE_PROGRAM is not set. You probably need to select a different build tool. CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage -- Configuring incomplete, errors occurred! In fact, the ensure_ninja_binary() is called after the test and not before. I add in the following patch a test in do_configure and move the one to before the test.
Created attachment 365366 [details] [review] Autodetect ninja location and use it if succeeded I change the behavior of self.ensure_ninja_binary() to check ninja is installed on the system. If not, self.ensure_ninja_binary() do not raise an error and just change the status of use_ninja Move the calls to self.ensure_ninja_binary() before testing self.use_ninja to switch automatically between Make or Ninja build system according to the self_use_ninja value
Review of attachment 365366 [details] [review]: Thanks for this bug report. I think we should always try to use ninja unless it is explicitly turned off in jhbuildrc. It's not really possible to use jhbuild without ninja anymore, because it's required by meson. The right thing to do here is to add a virtual sysdep for ninja, to make sure it gets installed by 'jhbuild sysdeps --install'. We were never able to do this in the past because Fedora renamed it to /usr/bin/ninja-build and /usr/bin/ninja was something else, but nowadays that is no longer the case. I believe it is safe to add a virtual sysdep now. This is really easy, so I'll push a quick patch.
The following fix has been pushed: 1044d28 Make ninja a virtual sysdep
Created attachment 365377 [details] [review] Make ninja a virtual sysdep This ensures it will be installed by 'jhbuild sysdeps --install' so that users get a sane error message if it's not installed, before trying to build modules. We were never able to do this in the past because /usr/bin/ninja was some IRC client on Fedora, but that's not the case anymore.