Lua 5.4 32bits support

169 views
Skip to first unread message

Ni Va

unread,
May 23, 2018, 4:56:04 AM5/23/18
to vim_dev
Hi,

On Windows 10,

1. After download and build lua 5.4 current work I got a the lua.5.4.0.dll 32 bits and rename it to lua54.dll

guidelines : https://blog.spreendigital.de/2015/01/16/how-to-compile-lua-5-3-0-for-windows/


2. From gvim 32 bits 8.1.020
lua print('hell') says E448: Could not load library function lua_newuserdata
Lua library cannot be loaded.


in _vimrc I have put these lines :
let dllPath = fnamemodify($vimruntime.'/extDlls',':p:h:gs?/?\\?')
" Lua
let $path.=';'.dllPath.'/lua'
if has('win32')
set luadll=lua54.dll
endif

Here is detailed on vim build


VIM - Vi IMproved 8.1 (2018 May 17, compiled May 23 2018 09:59:48)
MS-Windows 32-bit GUI version with OLE support
Included patches: 1-20
Compiled by niva
Huge version with GUI. Features included (+) or not (-):
+acl +byte_offset +comments +digraphs +farsi +iconv/dyn +linebreak +mouse +packages +python3/dyn +startuptime -termguicolors +user_commands +wildignore
+arabic +channel +conceal +directx +file_in_path +insert_expand +lispindent +mouseshape +path_extra +quickfix +statusline +terminal +vertsplit +wildmenu
+autocmd +cindent +cryptv -dnd +find_in_path +job +listcmds +multi_byte -perl +reltime -sun_workshop -tgetent +virtualedit +windows
+autoservername +clientserver -cscope -ebcdic +float +jumplist +localmap +multi_lang +persistent_undo +rightleft +syntax -termresponse +visual +writebackup
+balloon_eval +clipboard +cursorbind +emacs_tags +folding +keymap +lua/dyn -mzscheme -postscript +ruby/dyn +tag_binary +textobjects +visualextra -xfontset
-balloon_eval_term +cmdline_compl +cursorshape +eval -footer +lambda +menu -netbeans_intg +printer +scrollbind +tag_old_static +timers +viminfo -xim
+browse +cmdline_hist +dialog_con_gui +ex_extra +gettext/dyn +langmap +mksession +num64 +profile +signs -tag_any_white +title +vreplace -xpm_w32
++builtin_terms +cmdline_info +diff +extra_search -hangul_input +libcall +modify_fname +ole +python/dyn +smartindent -tcl +toolbar -vtp -xterm_save
system vimrc file: "$VIM\vimrc"
user vimrc file: "$HOME\_vimrc"
2nd user vimrc file: "$HOME\vimfiles\vimrc"
3rd user vimrc file: "$VIM\_vimrc"
user exrc file: "$HOME\_exrc"
2nd user exrc file: "$VIM\_exrc"
system gvimrc file: "$VIM\gvimrc"
user gvimrc file: "$HOME\_gvimrc"
2nd user gvimrc file: "$HOME\vimfiles\gvimrc"
3rd user gvimrc file: "$VIM\_gvimrc"
defaults file: "$VIMRUNTIME\defaults.vim"
system menu file: "$VIMRUNTIME\menu.vim"
Compilation: cl -c /W3 /nologo -I. -Iproto -DHAVE_PATHDEF -DWIN32 -DFEAT_TERMINAL -DFEAT_JOB_CHANNEL -DWINVER=0x0501 -D_WIN32_WINNT=0x0501 /MP -DHAVE_STDINT_H /O2 /GL -DNDEBUG /arch:IA32 /Zl /MT -DFEAT_OLE -DFEAT_MBYTE -DFEAT_GUI_W32 -DFEAT_DIRECTX -DDYNAMIC_DIRECTX -DFEAT_DIRECTX_COLOR_EMOJI -DDYNAMIC_ICONV -DDYNAMIC_GETTEXT -DFEAT_LUA -DDYNAMIC_LUA -DDYNAMIC_LUA_DLL=\"lua54.dll\" -DFEAT_PYTHON -DDYNAMIC_PYTHON -DDYNAMIC_PYTHON_DLL=\"python27.dll\" -DFEAT_PYTHON3 -DDYNAMIC_PYTHON3 -DDYNAMIC_PYTHON3_DLL=\"python36.dll\" -DFEAT_RUBY -DDYNAMIC_RUBY -DDYNAMIC_RUBY_VER=25 -DDYNAMIC_RUBY_DLL=\"msvcrt-ruby250.dll\" -DFEAT_HUGE /Fd.\ObjGXOUYHRi386/ /Zi
Linking: link /RELEASE /nologo /subsystem:windows /opt:ref /LTCG:STATUS oldnames.lib kernel32.lib advapi32.lib shell32.lib gdi32.lib comdlg32.lib ole32.lib uuid.lib /machine:i386 gdi32.lib version.lib winspool.lib comctl32.lib advapi32.lib shell32.lib /machine:i386 libcmt.lib oleaut32.lib user32.lib /nodefaultlib:lua54.lib /nodefaultlib:python27.lib /nodefaultlib:python36.lib WSock32.lib /PDB:gvim.pdb -debug

Kazunobu Kuriyama

unread,
May 24, 2018, 9:21:34 AM5/24/18
to vim...@googlegroups.com
On Wed, May 23, 2018 at 5:56 PM Ni Va <niva...@gmail.com> wrote:
Hi,

On Windows 10,

1. After download and build lua 5.4 current work I got a the lua.5.4.0.dll 32 bits and rename it to lua54.dll

guidelines : https://blog.spreendigital.de/2015/01/16/how-to-compile-lua-5-3-0-for-windows/

Is that article, which was apparently written for 5.3, really applicable to 5.4.0-work1?  (N.B. There's no official 5.4 yet; They say, "Work on Lua 5.4 has begun but there is no release date yet nor a roadmap. ... Note that all details may change in the final version."---excerpt from https://www.lua.org/versions.html#5.4 )

According to Numbering scheme, https://www.lua.org/versions.html : "The releases of Lua are numbered x.y.z, where x.y is the version and z is the release. ... Different versions are really different. The API is likely to be a little different (but with compatibility switches), and there is no ABI compatibility: applications that embed Lua and C libraries for Lua must be recompiled. "

Note that, as they think it standard that Lua client programs are statically linked against Lua library, they don't explicitly mention the case where the linkage is carried out dynamically.  However, because of the very same reason, it is obvious that recompilation is needed for the latter case as well. 

2. From gvim 32 bits 8.1.020
  lua print('hell') says E448: Could not load library function lua_newuserdata
Lua library cannot be loaded.

You could read https://www.lua.org/work/doc/manual.html#8.3 first to avoid the trouble.  As stated explicitly there, 5.4.0-work1 has already dropped the function lua_newuserdata() and replaces it with lua_newuserdatauv().  Also, they say, "For compatibility, the old names still work as macros assuming one single user value."

In fact, lua-5.4.0-work1/src/lua.h:396 gives

#define lua_newuserdata(L,s) lua_newuserdatauv(L,s,1)

So, with one thing or another, it seems like your gvim hasn't been recompiled against 5.4.0-work1 yet for some reason.

Regards,
Kazunobu

--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Message has been deleted
Message has been deleted
Message has been deleted
Message has been deleted
Message has been deleted
Message has been deleted
Message has been deleted

Ni Va

unread,
May 24, 2018, 3:13:35 PM5/24/18
to vim_dev
Thank you very much for this answer.


This is my daily vim build cmd batch.

@echo off




set mainversion=81
set version=8.1.22
set /P version=Enter git vim version (%version%):
set /P build64=Would you like to compile 64bits vim version (1 or 0):

:: Windows SDK Include directory. No quotation marks.
::
set SDK_INCLUDE_DIR=C:\Program Files (x86)\Windows Kits\8.1\Include

:: Visual Studio 2017
::
set VC_VARS=%ProgramFiles(x86)%\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build
set VS_TOOLS=%ProgramFiles(x86)%\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.12.25827\bin

:: Target architecture, AMD64 (64-bit) or I386 (32-bit)
::

if "%build64%"=="1" (
set CPU=%PROCESSOR_ARCHITECTURE%
set PLATFORM=x64
) else (
set CPU=i386
set PLATFORM=x86
)

:: TINY, SMALL, NORMAL, BIG or HUGE. NORMAL or above recommended
set FEATURES=HUGE


:: GUI, OLE enable
::
set OLE=yes
set GUI=yes
set XPM=no

:: DirectX
::
set DIRECTX=yes

set OPTIMIZE=SPEED

:: IDE integrations we don't need
::
set NETBEANS=no
set CSCOPE=no

:: UTF-8 encoding
::
set MBYTE=yes

:: Enable Lua
::
set DYNAMIC_LUA=yes
set LUA=.\lua-5.4\src
set LUA_VER=54

:: Enable Python scripting
::
set DYNAMIC_PYTHON=yes
set PYTHON=C:\ThirdParty\Python27
set PYTHON_VER=27

set DYNAMIC_PYTHON3=yes
set PYTHON3=C:\ThirdParty\Python37
set PYTHON3_VER=37

:: Enable Ruby scripting
::
set DYNAMIC_RUBY=yes
set RUBY_VER=25
set RUBY_API_VER_LONG=2.5.0
set RUBY_MSVCRT_NAME=msvcrt
if "%build64%"=="1" (
set RUBY=C:\ThirdParty\Ruby%RUBY_VER%-x64
set RUBY_PLATFORM=x64-mswin64_140
) else (
set RUBY=C:\ThirdParty\Ruby%RUBY_VER%-x86
set RUBY_PLATFORM=i386-mswin32_140
)

:: Enable Python scripting
::
set EVENT_LOOP=yes

set outf="%tmp%\vimBuildOut.log"
call :LogInit

:: Configure Visual Studio for %CPU%
::
set "VSCMD_START_DIR=%CD%"
call "%VC_VARS%\vcvarsall.bat" %PLATFORM%

:: Cleaning Building
::
call :MakeMvc clean
call :MakeMvc

:: Deploying
::
set dest=d:\logiciels\vim
if exist "gvim.exe" (
call tskill "gvim" 2>NUL
call :Robocopy %cd% %dest%\vim%mainversion% *.exe
call :Robocopy %cd%\..\runtime\doc %dest%\vim%mainversion%\doc *.txt
call :Robocopy %cd%\..\runtime\plugin %dest%\vim%mainversion%\plugin *.vim
call :Robocopy %cd%\..\runtime\syntax %dest%\vim%mainversion%\syntax *.vim
:: archive distro
call :7z %userprofile%\desktop\Vim.7z %dest%
:: archive source
call :7z %userprofile%\desktop\vim.%version%.7z %cd%\..
)

exit /b
Message has been deleted

Kazunobu Kuriyama

unread,
May 26, 2018, 5:49:37 AM5/26/18
to vim...@googlegroups.com
On Sat, May 26, 2018 at 5:10 AM Ni Va <niva...@gmail.com> wrote:
Here is the buildlog.txt, it appears gvim 8.1.22 is built with lua54.lib on x86 arch.

I'm afraid you cannot conclude anything from that because that's the nature of --enable-luainterp=dynamic, where Vim isn't effectively linked against the Lua library at build time.  You won't come across any error until you actually run Vim and issue one of the :lua command family members.

For the --enable-luainterp=dynamic build against Lua 5.4.0-work1, I wrote a patch.  Please find it attached to this email.  I think it sufficient for UNIX-like systems but am not sure if it works well for Windows.
if_lua_for_lua5.4.0-work1.diff
Message has been deleted

Ni Va

unread,
May 26, 2018, 8:59:21 AM5/26/18
to vim_dev
Patched confirmed on Windows 10 x86 built vim 8.1.22
https://drive.google.com/file/d/1DvH7pBhz4UoQ8JAH8DhdosdDuMBmK0Do/view?usp=sharing

Maybe Bram can you add the above attached patch of Kazunobu.

Thank you for all your help Kazunobu Kuriyama!
NiVa
Lua54_Integration.gif
Reply all
Reply to author
Forward
0 new messages