protocolbuffers / protobuf

Protocol Buffers - Google's data interchange format
http://protobuf.dev
Other
65.85k stars 15.52k forks source link

%1 is not a valid Win32 application #3923

Closed fferri closed 6 years ago

fferri commented 7 years ago

I'm trying to get the Lua generator working on Windows (MSYS2/mingw64). I installed 'protobuf' with luarocks. It installed also the file /mingw64/lib/luarocks/rocks/protobuf/1.1.1-0/protoc-plugin/protoc-gen-lua, which I can run in a terminal without errors due to missing packages and such. But if I run the protobuf compiler with this file as a plugin, I get:

$ protoc --plugin=protoc-gen-lua=/mingw64/lib/luarocks/rocks/protobuf/1.1.1-0/protoc-plugin/protoc-gen-lua --lua_out=. pubsub.proto
--lua_out: protoc-gen-lua: %1 is not a valid Win32 application.

Useful info:

$ pip3 show protobuf
Name: protobuf
Version: 3.4.0
Summary: Protocol Buffers
Home-page: https://developers.google.com/protocol-buffers/
Author: protobuf@googlegroups.com
Author-email: protobuf@googlegroups.com
License: 3-Clause BSD License
Location: /usr/lib/python3.6/site-packages
Requires: six, setuptools
fferri commented 7 years ago

is this article related? https://support.microsoft.com/en-us/help/812486/event-id-7000-and-1-is-not-a-valid-win32-application-error-message-whe

xfxyjwf commented 6 years ago

@fferri Could you attach the protoc-gen-lua binary you are using?

fferri commented 6 years ago

@xfxyjwf you can find protoc-gen-lua here https://github.com/urbanairship/protobuf-lua inside the protoc-plugin directory. it is a python script (it's the same thing you get by installing the luarocks package I mentioned)

xfxyjwf commented 6 years ago

@fferri Hmm, a python script? If I remember correctly, the plugin must be either a .exe or a .bat. Could you try to create a .bat wrapper about the python script and try again?

xfxyjwf commented 6 years ago

I have verified a .bat file will work. Just create a protoc-gen-lua.bat file with the following content:

@<path_to_python.exe> <path_to_protoc-gen-lua>

and invoke protoc with:

protoc --plugin=protoc-gen-lua=protoc-gen-lua.bat --lua_out=. <proto>