Skip to content

windows mingw64, can not link to lua51.dll #58

@CanYellow

Description

@CanYellow

platform

windows10, mingw64 with cmake

problem

  • building
    when using 'luarocks --tree luamodules install rapidjson', the ld.exe will throw a link error:
D:/ProgramFiles/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find D:ProgramFileslua51bin/lua51.dll: No such file or directory
  • config
    use default lua libdir setting. the config file is as follow:
variables = {
    MSVCRT = 'm',   -- make MinGW use MSVCRT.DLL as runtime
    LUALIB = 'lua51.dll',
    CC = [[D:\ProgramFiles\msys64\mingw64\bin\gcc.exe]],
    MAKE = [[D:\ProgramFiles\msys64\mingw64\bin\gnatmake.exe]],
    RC = [[D:\ProgramFiles\msys64\mingw64\bin\windres.exe]],
    LD = [[D:\ProgramFiles\msys64\mingw64\bin\gcc.exe]],
    AR = [[D:\ProgramFiles\msys64\mingw64\bin\ar.exe]],
    RANLIB = [[D:\ProgramFiles\msys64\mingw64\bin\ranlib.exe]],
}

solution

manual set the LUA_LIBDIR value. the config file is as follow:

variables = {
    MSVCRT = 'm',   -- make MinGW use MSVCRT.DLL as runtime
    LUALIB = 'lua51.dll',
    -- for cmake the default libdir string is 'D:/ProgramFiles/lua51/bin' which when attaching to ld.exe, it will parse as D:ProgramFileslua51bin. so manual config libdir as 'D:/ProgramFiles/lua51/bin'
    LUA_LIBDIR = 'D:/ProgramFiles/lua51/bin',
    CC = [[D:\ProgramFiles\msys64\mingw64\bin\gcc.exe]],
    MAKE = [[D:\ProgramFiles\msys64\mingw64\bin\gnatmake.exe]],
    RC = [[D:\ProgramFiles\msys64\mingw64\bin\windres.exe]],
    LD = [[D:\ProgramFiles\msys64\mingw64\bin\gcc.exe]],
    AR = [[D:\ProgramFiles\msys64\mingw64\bin\ar.exe]],
    RANLIB = [[D:\ProgramFiles\msys64\mingw64\bin\ranlib.exe]],
}

question

is there any improvement about the above problem in the furture rapidjson rocks update version?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions