[vlc-devel] a pitfall when cross-compiling win32 build on 64bit machine

Naohiro KORIYAMA nkoriyama at gmail.com
Wed Dec 14 08:49:13 CET 2011


2011/12/14 Rafaël Carré <funman at videolan.org>:
> Le Wed, 14 Dec 2011 15:48:54 +0900,
> Naohiro KORIYAMA <nkoriyama at gmail.com> a écrit :
>
>> I compile win32 build on OS X Lion.
>>
>> First, it seemed fine, but lua scripts didn't run at all.
>> I installed lua in /usr/local/bin, and it was built as 64bit application.
>> And, I found the following in the LUAC man page:
>> The binary files created by luac are portable only among architectures
>> with the same word size and byte order.
>>
>> Oops, that's it.
>> After I made luac 32bit version, and use it by "LUAC=luac32
>> ..../win32/configure.sh ...", lua scripts worked on win32 build.
>> I don't know about Linux 64bit environment, on
>> http://wiki.videolan.org/Win32Compile, there is no description about
>> it.
>
> It's strange, I think the windows builds are made on a linux 64 bits
> machine but they run fine on win32.

Header infomation in luac is different  32bit and 64bit, and liblua checks it.
liblua refuses when loading wrong luac like:

lua debug: Trying Lua playlist script D:\utils\vlc\lua\playlist\youtube.luac
lua warning: Error loading script
D:\utils\vlc\lua\playlist\youtube.luac:
D:\utils\vlc\lua\playlist\youtube.luac: bad header in precompiled
chunk


FYI, Compiled lua scripts in win32 NB are the same as one generated by
32bit luac, and in win64 NB, same as one generated by 64bit luac.
Maybe switching luac somehow...

Header Hex generated by luac 64bit that works on Mac OS X 64bit:
0000000: 1b4c 7561 5100 0104 0804 0800 5b00 0000  .LuaQ.......[...
0000010: 0000 0000 402f 5573 6572 732f 6e6b 6f72  ....@/Users/nkor

Header Hex generated by luac 32bit that works on Win32:
0000000: 1b4c 7561 5100 0104 0404 0800 5a00 0000  .LuaQ.......Z...
0000010: 402f 5573 6572 732f 6e6b 6f72 6979 616d  @/Users/nkoriyam

Header Hex in NB win 32bit:
0000000: 1b4c 7561 5100 0104 0404 0800 1a00 0000  .LuaQ...........
0000010: 406c 7561 2f70 6c61 796c 6973 742f 796f  @lua/playlist/yo

Header Hex in NB win 64bit:
0000000: 1b4c 7561 5100 0104 0804 0800 1a00 0000  .LuaQ...........
0000010: 0000 0000 406c 7561 2f70 6c61 796c 6973  .... at lua/playlis

> The .lua files (not compiled) should work fine, I think we used luac
> only to reduce binary size of VLC package.
>
> If that's the case, zip/7z compress the files already so there should
> not be a big difference between .lua and .luac (except when unpacked on
> the disk), and we could packge .lua files only.

If it's only my particular problem, please ignore it.

-- 
KORIYAMA, Naohiro
nkoriyama at gmail.com



More information about the vlc-devel mailing list