Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lua-compiler for standalone executables do not work #12

Closed
GoogleCodeExporter opened this issue Jul 24, 2015 · 4 comments
Closed

lua-compiler for standalone executables do not work #12

GoogleCodeExporter opened this issue Jul 24, 2015 · 4 comments

Comments

@GoogleCodeExporter
Copy link

helloworld.lua:
print("Hello World")

I'm trying to compile this script as a standalone application using 
lua-compiler and I get this error:

christophe@christophe-laptop:~/lua_tests$ lua-compiler helloworld.lua 
/usr/local/bin/llvm-luac -O3 -s -bc -o helloworld.bc helloworld.lua
Failed to parse embedded 'liblua_main_bc' file: Invalid bitcode signature
llvm-luac: failed to compile Lua code into LLVM bitcode.

Any idea of what might be happening?

My system info is:
christophe@christophe-laptop:~/lua_tests$ uname -a
Linux christophe-laptop 2.6.35-23-generic #41-Ubuntu SMP Wed Nov 24 10:18:49 
UTC 2010 i686 GNU/Linux

Original issue reported on code.google.com by christop...@gmail.com on 16 Dec 2010 at 4:38

@GoogleCodeExporter
Copy link
Author

I can confirm this, I get exactly the same error...

The bugtracker seems pretty dead though

Original comment by 237...@gmail.com on 1 Jan 2011 at 12:35

@GoogleCodeExporter
Copy link
Author

It seems that the embed LLVM bitcode containing the main loop for standalone 
applications is generated at compile time with the bin2c util (included in 
llvm-lua) into liblua_main_bc.h. The magic number of LLVM IR bitcode is 'BC' 
(0xC0DE) and liblua_main_bc.h does not contain a valid bitcode signature 
(lua_vm_ops_bc.h has a valid signature and contains 0xC0DE). 

Looking in the build dir I found liblua_main.bc and liblua_main.bc.bc. The 
first one contains a shell script and the other is the correct file with LLVM 
IR bitcode. liblua_main_bc.h is the dump from the shell script and that's the 
reason why we get the 'Invalid bitcode signature' error.

This seems to be an error in the CMake file configuration that generates 
incorrect files for LLVM bitcode.

Kind regards,

Christophe

Original comment by christop...@gmail.com on 9 Jan 2011 at 3:00

@GoogleCodeExporter
Copy link
Author

Thanks for debugging this.  The problem is with llvm-ld which was the default 
command tool used by llvm-lua's CMake files to link multiple LLVM bitcodes into 
one bitcode.

You can change the LLVM_LD variable with this command:
cmake . -D LLVM_LD=llvm-link

I have changed the default value for that variable and commited the change.

Original comment by rjakabo...@gmail.com on 9 Jan 2011 at 3:30

  • Changed state: Fixed

@GoogleCodeExporter
Copy link
Author

sorry that command should be:
cmake -DLLVM_LD=llvm-link .

Original comment by rjakabo...@gmail.com on 9 Jan 2011 at 3:33

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant