• Daniel Hahler's avatar
    cmake/LuaHelpers.cmake: check_lua_module: display errors · 88519034
    Daniel Hahler authored
    This helps to figure out what the problem is, e.g. in my case I have
    lua51-mpack installed to be used with luajit, but it is broken (missing
    libmpack).
    
    With this patch you get:
    
        -- Checking Lua interpreter /usr/bin/luajit
        /usr/bin/luajit: error loading module 'mpack' from file '/usr/lib/lua/5.1/mpack.so':
                libmpack.so.0: cannot open shared object file: No such file or directory
        stack traceback:
                [C]: at 0x55fcf0166fb0
                [C]: in function 'require'
                (command line):1: in main chunk
                [C]: at 0x55fcf01188a0
        -- [/usr/bin/luajit] The 'mpack' lua package is required for building Neovim
        -- Checking Lua interpreter /usr/bin/lua5.1
        /usr/bin/lua5.1: error loading module 'mpack' from file '/usr/lib/lua/5.1/mpack.so':
                libmpack.so.0: cannot open shared object file: No such file or directory
        stack traceback:
                [C]: ?
                [C]: in function 'require'
                (command line):1: in main chunk
                [C]: ?
        -- [/usr/bin/lua5.1] The 'mpack' lua package is required for building Neovim
        -- Checking Lua interpreter /usr/bin/lua5.2
        /usr/bin/lua5.2: (command line):1: module 'mpack' not found:
                no field package.preload['mpack']
                no file '/usr/share/lua/5.2/mpack.lua'
                no file '/usr/share/lua/5.2/mpack/init.lua'
                no file '/usr/lib/lua/5.2/mpack.lua'
                no file '/usr/lib/lua/5.2/mpack/init.lua'
                no file './mpack.lua'
                no file '/usr/lib/lua/5.2/mpack.so'
                no file '/usr/lib/lua/5.2/loadall.so'
                no file './mpack.so'
        stack traceback:
                [C]: in function 'require'
                (command line):1: in main chunk
                [C]: in ?
        -- [/usr/bin/lua5.2] The 'mpack' lua package is required for building Neovim
        -- Checking Lua interpreter /usr/bin/lua
        /usr/bin/lua: (command line):1: module 'mpack' not found:
                no field package.preload['mpack']
                no file '/usr/share/lua/5.3/mpack.lua'
                no file '/usr/share/lua/5.3/mpack/init.lua'
                no file '/usr/lib/lua/5.3/mpack.lua'
                no file '/usr/lib/lua/5.3/mpack/init.lua'
                no file './mpack.lua'
                no file './mpack/init.lua'
                no file '/usr/lib/lua/5.3/mpack.so'
                no file '/usr/lib/lua/5.3/loadall.so'
                no file './mpack.so'
        stack traceback:
                [C]: in function 'require'
                (command line):1: in main chunk
                [C]: in ?
        -- [/usr/bin/lua] The 'mpack' lua package is required for building Neovim
        CMake Error at CMakeLists.txt:459 (message):
          A suitable Lua interpreter was not found.
    
    While this makes it more verbose for the expected error case ("module
    'mpack' not found"), the behavior before this patch hides too much.
    This is the old output:
    
        -- Checking Lua interpreter /usr/bin/luajit
        -- [/usr/bin/luajit] The 'mpack' lua package is required for building Neovim
        -- Checking Lua interpreter /usr/bin/lua5.1
        -- [/usr/bin/lua5.1] The 'mpack' lua package is required for building Neovim
        -- Checking Lua interpreter /usr/bin/lua5.2
        -- [/usr/bin/lua5.2] The 'mpack' lua package is required for building Neovim
        -- Checking Lua interpreter /usr/bin/lua
        -- [/usr/bin/lua] The 'mpack' lua package is required for building Neovim
        CMake Error at CMakeLists.txt:459 (message):
          A suitable Lua interpreter was not found.
    
    This is for when the whole configuration runs (i.e. after `make
    distclean`), afterwards only one Lua interpreter gets checked only.
    88519034
Name
Last commit
Last update
..
ConvertPo.cmake Loading commit data...
Download.cmake Loading commit data...
FindIconv.cmake Loading commit data...
FindJeMalloc.cmake Loading commit data...
FindLibIntl.cmake Loading commit data...
FindLibTermkey.cmake Loading commit data...
FindLibUV.cmake Loading commit data...
FindLibVterm.cmake Loading commit data...
FindLua.cmake Loading commit data...
FindLuaJit.cmake Loading commit data...
FindMsgpack.cmake Loading commit data...
FindUnibilium.cmake Loading commit data...
FindWinpty.cmake Loading commit data...
GenerateHelptags.cmake.in Loading commit data...
GetCompileFlags.cmake Loading commit data...
GetGitRevisionDescription.cmake Loading commit data...
GetGitRevisionDescription.cmake.in Loading commit data...
InstallClintErrors.cmake Loading commit data...
InstallHelpers.cmake Loading commit data...
LibFindMacros.cmake Loading commit data...
LuaHelpers.cmake Loading commit data...
PreventInTreeBuilds.cmake Loading commit data...
RunLuacheck.cmake Loading commit data...
RunMsgfmt.cmake Loading commit data...
RunMsgmerge.cmake Loading commit data...
RunTests.cmake Loading commit data...
RunXgettext.cmake Loading commit data...
WindowsDllCopy.cmake Loading commit data...
i386-linux-gnu.toolchain.cmake Loading commit data...
mingw32-w64-cross-travis.toolchain.cmake Loading commit data...