mpx / lua-cjson

Lua CJSON is a fast JSON encoding/parsing module for Lua

Home Page:https://kyne.au/~mark/software/lua-cjson.php

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Improve Windows build support

Akkuma opened this issue · comments

I tried using both x86 and x64 for compilation

Using https://rocks.moonscript.org/lua-cjson-2.1.0-1.src.rock... switching to 'build' mode
cl /MD /O2 -c -Folua_cjson.obj -IC:/lua/5.1/include/ lua_cjson.c -DDISABLE_INVALID_NUMBERS
Microsoft (R) C/C++ Optimizing Compiler Version 18.00.21005.1 for x64
Copyright (C) Microsoft Corporation.  All rights reserved.

lua_cjson.c
c:\users\greg waxman\appdata\local\temp\luarocks_lua-cjson-2.1.0-1-4204\lua-cjson-2.1.0\strbuf.h(78) : error C2054: expected '(' to follow 'inline'
c:\users\greg waxman\appdata\local\temp\luarocks_lua-cjson-2.1.0-1-4204\lua-cjson-2.1.0\strbuf.h(79) : error C2085: 'strbuf_reset' : not in formal parameter list
c:\users\greg waxman\appdata\local\temp\luarocks_lua-cjson-2.1.0-1-4204\lua-cjson-2.1.0\strbuf.h(79) : error C2143: syntax error : missing ';' before '{'
c:\users\greg waxman\appdata\local\temp\luarocks_lua-cjson-2.1.0-1-4204\lua-cjson-2.1.0\strbuf.h(83) : error C2054: expected '(' to follow 'inline'
c:\users\greg waxman\appdata\local\temp\luarocks_lua-cjson-2.1.0-1-4204\lua-cjson-2.1.0\strbuf.h(84) : error C2085: 'strbuf_allocated' : not in formal parameter list
c:\users\greg waxman\appdata\local\temp\luarocks_lua-cjson-2.1.0-1-4204\lua-cjson-2.1.0\strbuf.h(84) : error C2143: syntax error : missing ';' before '{'
c:\users\greg waxman\appdata\local\temp\luarocks_lua-cjson-2.1.0-1-4204\lua-cjson-2.1.0\strbuf.h(90) : error C2054: expected '(' to follow 'inline'
c:\users\greg waxman\appdata\local\temp\luarocks_lua-cjson-2.1.0-1-4204\lua-cjson-2.1.0\strbuf.h(91) : error C2082: redefinition of formal parameter 'strbuf_empty_length'
c:\users\greg waxman\appdata\local\temp\luarocks_lua-cjson-2.1.0-1-4204\lua-cjson-2.1.0\strbuf.h(91) : error C2143: syntax error : missing ';' before '{'
c:\users\greg waxman\appdata\local\temp\luarocks_lua-cjson-2.1.0-1-4204\lua-cjson-2.1.0\strbuf.h(95) : error C2054: expected '(' to follow 'inline'
c:\users\greg waxman\appdata\local\temp\luarocks_lua-cjson-2.1.0-1-4204\lua-cjson-2.1.0\strbuf.h(96) : error C2082: redefinition of formal parameter 'strbuf_ensure_empty_length'
c:\users\greg waxman\appdata\local\temp\luarocks_lua-cjson-2.1.0-1-4204\lua-cjson-2.1.0\strbuf.h(96) : error C2143: syntax error : missing ';' before '{'
c:\users\greg waxman\appdata\local\temp\luarocks_lua-cjson-2.1.0-1-4204\lua-cjson-2.1.0\strbuf.h(101) : error C2054: expected '(' to follow 'inline'
c:\users\greg waxman\appdata\local\temp\luarocks_lua-cjson-2.1.0-1-4204\lua-cjson-2.1.0\strbuf.h(102) : error C2082: redefinition of formal parameter 'strbuf_empty_ptr'
c:\users\greg waxman\appdata\local\temp\luarocks_lua-cjson-2.1.0-1-4204\lua-cjson-2.1.0\strbuf.h(102) : error C2143: syntax error : missing ';' before '{'
c:\users\greg waxman\appdata\local\temp\luarocks_lua-cjson-2.1.0-1-4204\lua-cjson-2.1.0\strbuf.h(106) : error C2054: expected '(' to follow 'inline'
c:\users\greg waxman\appdata\local\temp\luarocks_lua-cjson-2.1.0-1-4204\lua-cjson-2.1.0\strbuf.h(107) : error C2082: redefinition of formal parameter 'strbuf_extend_length'
c:\users\greg waxman\appdata\local\temp\luarocks_lua-cjson-2.1.0-1-4204\lua-cjson-2.1.0\strbuf.h(107) : error C2143: syntax error : missing ';' before '{'
c:\users\greg waxman\appdata\local\temp\luarocks_lua-cjson-2.1.0-1-4204\lua-cjson-2.1.0\strbuf.h(111) : error C2054: expected '(' to follow 'inline'
c:\users\greg waxman\appdata\local\temp\luarocks_lua-cjson-2.1.0-1-4204\lua-cjson-2.1.0\strbuf.h(112) : error C2082: redefinition of formal parameter 'strbuf_length'
c:\users\greg waxman\appdata\local\temp\luarocks_lua-cjson-2.1.0-1-4204\lua-cjson-2.1.0\strbuf.h(112) : error C2143: syntax error : missing ';' before '{'
c:\users\greg waxman\appdata\local\temp\luarocks_lua-cjson-2.1.0-1-4204\lua-cjson-2.1.0\strbuf.h(116) : error C2054: expected '(' to follow 'inline'
c:\users\greg waxman\appdata\local\temp\luarocks_lua-cjson-2.1.0-1-4204\lua-cjson-2.1.0\strbuf.h(117) : error C2082: redefinition of formal parameter 'strbuf_append_char'
c:\users\greg waxman\appdata\local\temp\luarocks_lua-cjson-2.1.0-1-4204\lua-cjson-2.1.0\strbuf.h(117) : error C2143: syntax error : missing ';' before '{'
c:\users\greg waxman\appdata\local\temp\luarocks_lua-cjson-2.1.0-1-4204\lua-cjson-2.1.0\strbuf.h(122) : error C2054: expected '(' to follow 'inline'
c:\users\greg waxman\appdata\local\temp\luarocks_lua-cjson-2.1.0-1-4204\lua-cjson-2.1.0\strbuf.h(123) : error C2085: 'strbuf_append_char_unsafe' : not in formal parameter list
c:\users\greg waxman\appdata\local\temp\luarocks_lua-cjson-2.1.0-1-4204\lua-cjson-2.1.0\strbuf.h(123) : error C2143: syntax error : missing ';' before '{'
c:\users\greg waxman\appdata\local\temp\luarocks_lua-cjson-2.1.0-1-4204\lua-cjson-2.1.0\strbuf.h(127) : error C2054: expected '(' to follow 'inline'
c:\users\greg waxman\appdata\local\temp\luarocks_lua-cjson-2.1.0-1-4204\lua-cjson-2.1.0\strbuf.h(128) : error C2082: redefinition of formal parameter 'strbuf_append_mem'
c:\users\greg waxman\appdata\local\temp\luarocks_lua-cjson-2.1.0-1-4204\lua-cjson-2.1.0\strbuf.h(128) : error C2143: syntax error : missing ';' before '{'
c:\users\greg waxman\appdata\local\temp\luarocks_lua-cjson-2.1.0-1-4204\lua-cjson-2.1.0\strbuf.h(134) : error C2054: expected '(' to follow 'inline'
c:\users\greg waxman\appdata\local\temp\luarocks_lua-cjson-2.1.0-1-4204\lua-cjson-2.1.0\strbuf.h(135) : error C2085: 'strbuf_append_mem_unsafe' : not in formal parameter list
c:\users\greg waxman\appdata\local\temp\luarocks_lua-cjson-2.1.0-1-4204\lua-cjson-2.1.0\strbuf.h(135) : error C2143: syntax error : missing ';' before '{'
c:\users\greg waxman\appdata\local\temp\luarocks_lua-cjson-2.1.0-1-4204\lua-cjson-2.1.0\strbuf.h(140) : error C2054: expected '(' to follow 'inline'
c:\users\greg waxman\appdata\local\temp\luarocks_lua-cjson-2.1.0-1-4204\lua-cjson-2.1.0\strbuf.h(141) : error C2082: redefinition of formal parameter 'strbuf_ensure_null'
c:\users\greg waxman\appdata\local\temp\luarocks_lua-cjson-2.1.0-1-4204\lua-cjson-2.1.0\strbuf.h(141) : error C2143: syntax error : missing ';' before '{'
c:\users\greg waxman\appdata\local\temp\luarocks_lua-cjson-2.1.0-1-4204\lua-cjson-2.1.0\strbuf.h(145) : error C2054: expected '(' to follow 'inline'
c:\users\greg waxman\appdata\local\temp\luarocks_lua-cjson-2.1.0-1-4204\lua-cjson-2.1.0\strbuf.h(146) : error C2082: redefinition of formal parameter 'strbuf_string'
c:\users\greg waxman\appdata\local\temp\luarocks_lua-cjson-2.1.0-1-4204\lua-cjson-2.1.0\strbuf.h(146) : error C2143: syntax error : missing ';' before '{'
c:\users\greg waxman\appdata\local\temp\luarocks_lua-cjson-2.1.0-1-4204\lua-cjson-2.1.0\fpconv.h(15) : error C2054: expected '(' to follow 'inline'
c:\users\greg waxman\appdata\local\temp\luarocks_lua-cjson-2.1.0-1-4204\lua-cjson-2.1.0\fpconv.h(15) : error C2085: 'fpconv_init' : not in formal parameter list
c:\users\greg waxman\appdata\local\temp\luarocks_lua-cjson-2.1.0-1-4204\lua-cjson-2.1.0\fpconv.h(18) : error C2085: 'fpconv_g_fmt' : not in formal parameter list
c:\users\greg waxman\appdata\local\temp\luarocks_lua-cjson-2.1.0-1-4204\lua-cjson-2.1.0\fpconv.h(19) : error C2085: 'fpconv_strtod' : not in formal parameter list
lua_cjson.c(92) : error C2085: 'json_token_type_t' : not in formal parameter list
lua_cjson.c(94) : error C2085: 'json_token_type_name' : not in formal parameter list
lua_cjson.c(94) : error C2143: syntax error : missing ';' before '='
lua_cjson.c(113) : error C2016: C requires that a struct or union has at least one member
lua_cjson.c(113) : error C2061: syntax error : identifier 'json_token_type_t'
lua_cjson.c(130) : error C2059: syntax error : '}'
lua_cjson.c(136) : error C2061: syntax error : identifier 'json_config_t'
lua_cjson.c(138) : error C2059: syntax error : '}'
lua_cjson.c(141) : error C2016: C requires that a struct or union has at least one member
lua_cjson.c(141) : error C2061: syntax error : identifier 'json_token_type_t'
lua_cjson.c(149) : error C2059: syntax error : '}'
lua_cjson.c(192) : error C2143: syntax error : missing '{' before '*'
lua_cjson.c(194) : error C2065: 'json_config_t' : undeclared identifier
lua_cjson.c(194) : error C2065: 'cfg' : undeclared identifier
lua_cjson.c(194) : warning C4552: '*' : operator has no effect; expected operator with side-effect
lua_cjson.c(196) : error C2065: 'cfg' : undeclared identifier
lua_cjson.c(196) : warning C4047: '=' : 'int' differs in levels of indirection from 'void *'
lua_cjson.c(197) : error C2065: 'cfg' : undeclared identifier
lua_cjson.c(200) : error C2065: 'cfg' : undeclared identifier
lua_cjson.c(200) : warning C4047: 'return' : 'int *' differs in levels of indirection from 'int'
lua_cjson.c(206) : error C2143: syntax error : missing '{' before '*'
lua_cjson.c(268) : error C2065: 'json_config_t' : undeclared identifier
lua_cjson.c(268) : error C2065: 'cfg' : undeclared identifier
lua_cjson.c(268) : warning C4047: '=' : 'int' differs in levels of indirection from 'int *'
lua_cjson.c(268) : error C2106: '=' : left operand must be l-value
lua_cjson.c(270) : error C2065: 'cfg' : undeclared identifier
lua_cjson.c(270) : error C2223: left of '->encode_sparse_convert' must point to struct/union
lua_cjson.c(270) : warning C4047: 'function' : 'const char **' differs in levels of indirection from 'int'
lua_cjson.c(270) : warning C4024: 'json_enum_option' : different types for formal and actual parameter 4
lua_cjson.c(270) : error C2198: 'json_enum_option' : too few arguments for call
lua_cjson.c(271) : error C2065: 'cfg' : undeclared identifier
lua_cjson.c(271) : error C2223: left of '->encode_sparse_ratio' must point to struct/union
lua_cjson.c(271) : error C2198: 'json_integer_option' : too few arguments for call
lua_cjson.c(272) : error C2065: 'cfg' : undeclared identifier
lua_cjson.c(272) : error C2223: left of '->encode_sparse_safe' must point to struct/union
lua_cjson.c(272) : error C2198: 'json_integer_option' : too few arguments for call
lua_cjson.c(281) : error C2065: 'json_config_t' : undeclared identifier
lua_cjson.c(281) : error C2065: 'cfg' : undeclared identifier
lua_cjson.c(281) : warning C4047: '=' : 'int' differs in levels of indirection from 'int *'
lua_cjson.c(281) : error C2106: '=' : left operand must be l-value
lua_cjson.c(283) : error C2065: 'cfg' : undeclared identifier
lua_cjson.c(283) : error C2223: left of '->encode_max_depth' must point to struct/union
lua_cjson.c(283) : warning C4047: 'function' : 'int *' differs in levels of indirection from 'int'
lua_cjson.c(283) : warning C4024: 'json_integer_option' : different types for formal and actual parameter 3
lua_cjson.c(283) : error C2198: 'json_integer_option' : too few arguments for call
lua_cjson.c(290) : error C2065: 'json_config_t' : undeclared identifier
lua_cjson.c(290) : error C2065: 'cfg' : undeclared identifier
lua_cjson.c(290) : warning C4047: '=' : 'int' differs in levels of indirection from 'int *'
lua_cjson.c(290) : error C2106: '=' : left operand must be l-value
lua_cjson.c(292) : error C2065: 'cfg' : undeclared identifier
lua_cjson.c(292) : error C2223: left of '->decode_max_depth' must point to struct/union
lua_cjson.c(292) : warning C4047: 'function' : 'int *' differs in levels of indirection from 'int'
lua_cjson.c(292) : warning C4024: 'json_integer_option' : different types for formal and actual parameter 3
lua_cjson.c(292) : error C2198: 'json_integer_option' : too few arguments for call
lua_cjson.c(298) : error C2065: 'json_config_t' : undeclared identifier
lua_cjson.c(298) : error C2065: 'cfg' : undeclared identifier
lua_cjson.c(298) : warning C4047: '=' : 'int' differs in levels of indirection from 'int *'
lua_cjson.c(298) : error C2106: '=' : left operand must be l-value
lua_cjson.c(300) : error C2065: 'cfg' : undeclared identifier
lua_cjson.c(300) : error C2223: left of '->encode_number_precision' must point to struct/union
lua_cjson.c(300) : warning C4047: 'function' : 'int *' differs in levels of indirection from 'int'
lua_cjson.c(300) : warning C4024: 'json_integer_option' : different types for formal and actual parameter 3
lua_cjson.c(300) : error C2198: 'json_integer_option' : too few arguments for call
lua_cjson.c(306) : error C2065: 'json_config_t' : undeclared identifier
lua_cjson.c(306) : error C2065: 'cfg' : undeclared identifier
lua_cjson.c(306) : warning C4047: '=' : 'int' differs in levels of indirection from 'int *'
lua_cjson.c(306) : error C2106: '=' : left operand must be l-value
lua_cjson.c(309) : error C2065: 'cfg' : undeclared identifier
lua_cjson.c(309) : error C2223: left of '->encode_keep_buffer' must point to struct/union
lua_cjson.c(311) : error C2065: 'cfg' : undeclared identifier
lua_cjson.c(311) : error C2223: left of '->encode_keep_buffer' must point to struct/union
lua_cjson.c(311) : warning C4047: 'function' : 'const char **' differs in levels of indirection from 'int'
lua_cjson.c(311) : warning C4024: 'json_enum_option' : different types for formal and actual parameter 4
lua_cjson.c(311) : error C2198: 'json_enum_option' : too few arguments for call
lua_cjson.c(314) : error C2065: 'cfg' : undeclared identifier
lua_cjson.c(314) : error C2223: left of '->encode_keep_buffer' must point to struct/union
lua_cjson.c(314) : fatal error C1003: error count exceeds 100; stopping compilation

Error: Failed installing dependency: https://rocks.moonscript.org/lua-cjson-2.1.0-1.src.rock - Build error: Failed compiling object lua_cjson.obj

See #1
You'll need to download the sources (luarocks unpack lua-cjson will do) and then apply the changes.

Is there any chance that some of PR will be merged ( #1 or #20 or #26)?

I have merged #20, does this help with your case?

Are there are changes that are required to improve support other targets?

cl /nologo /MD /O2 -c -Folua_cjson.obj -Ic:/Lua/5.1/include/ lua_cjson.c -DDISABLE_INVALID_NUMBERS
lua_cjson.c
f:\e\projects\lua-cjson\strbuf.h(78) : error C2054: expected '(' to follow 'inline'
f:\e\projects\lua-cjson\strbuf.h(79) : error C2085: 'strbuf_reset' : not in formal parameter list
f:\e\projects\lua-cjson\strbuf.h(79) : error C2143: syntax error : missing ';' before '{'
f:\e\projects\lua-cjson\strbuf.h(83) : error C2054: expected '(' to follow 'inline'
f:\e\projects\lua-cjson\strbuf.h(84) : error C2085: 'strbuf_allocated' : not in formal parameter list
f:\e\projects\lua-cjson\strbuf.h(84) : error C2143: syntax error : missing ';' before '{'
f:\e\projects\lua-cjson\strbuf.h(90) : error C2054: expected '(' to follow 'inline'
f:\e\projects\lua-cjson\strbuf.h(91) : error C2082: redefinition of formal parameter 'strbuf_empty_length'
f:\e\projects\lua-cjson\strbuf.h(91) : error C2143: syntax error : missing ';' before '{'
f:\e\projects\lua-cjson\strbuf.h(95) : error C2054: expected '(' to follow 'inline'
f:\e\projects\lua-cjson\strbuf.h(96) : error C2082: redefinition of formal parameter 'strbuf_ensure_empty_length'
f:\e\projects\lua-cjson\strbuf.h(96) : error C2143: syntax error : missing ';' before '{'
f:\e\projects\lua-cjson\strbuf.h(101) : error C2054: expected '(' to follow 'inline'
f:\e\projects\lua-cjson\strbuf.h(102) : error C2082: redefinition of formal parameter 'strbuf_empty_ptr'
f:\e\projects\lua-cjson\strbuf.h(102) : error C2143: syntax error : missing ';' before '{'
f:\e\projects\lua-cjson\strbuf.h(106) : error C2054: expected '(' to follow 'inline'
f:\e\projects\lua-cjson\strbuf.h(107) : error C2082: redefinition of formal parameter 'strbuf_extend_length'
f:\e\projects\lua-cjson\strbuf.h(107) : error C2143: syntax error : missing ';' before '{'
f:\e\projects\lua-cjson\strbuf.h(111) : error C2054: expected '(' to follow 'inline'
f:\e\projects\lua-cjson\strbuf.h(112) : error C2082: redefinition of formal parameter 'strbuf_length'
f:\e\projects\lua-cjson\strbuf.h(112) : error C2143: syntax error : missing ';' before '{'
f:\e\projects\lua-cjson\strbuf.h(116) : error C2054: expected '(' to follow 'inline'
f:\e\projects\lua-cjson\strbuf.h(117) : error C2082: redefinition of formal parameter 'strbuf_append_char'
f:\e\projects\lua-cjson\strbuf.h(117) : error C2143: syntax error : missing ';' before '{'
f:\e\projects\lua-cjson\strbuf.h(122) : error C2054: expected '(' to follow 'inline'
f:\e\projects\lua-cjson\strbuf.h(123) : error C2085: 'strbuf_append_char_unsafe' : not in formal parameter list
f:\e\projects\lua-cjson\strbuf.h(123) : error C2143: syntax error : missing ';' before '{'
f:\e\projects\lua-cjson\strbuf.h(127) : error C2054: expected '(' to follow 'inline'
f:\e\projects\lua-cjson\strbuf.h(128) : error C2082: redefinition of formal parameter 'strbuf_append_mem'
f:\e\projects\lua-cjson\strbuf.h(128) : error C2143: syntax error : missing ';' before '{'
f:\e\projects\lua-cjson\strbuf.h(134) : error C2054: expected '(' to follow 'inline'
f:\e\projects\lua-cjson\strbuf.h(135) : error C2085: 'strbuf_append_mem_unsafe' : not in formal parameter list
f:\e\projects\lua-cjson\strbuf.h(135) : error C2143: syntax error : missing ';' before '{'
f:\e\projects\lua-cjson\strbuf.h(140) : error C2054: expected '(' to follow 'inline'
f:\e\projects\lua-cjson\strbuf.h(141) : error C2082: redefinition of formal parameter 'strbuf_ensure_null'
f:\e\projects\lua-cjson\strbuf.h(141) : error C2143: syntax error : missing ';' before '{'
f:\e\projects\lua-cjson\strbuf.h(145) : error C2054: expected '(' to follow 'inline'
f:\e\projects\lua-cjson\strbuf.h(146) : error C2082: redefinition of formal parameter 'strbuf_string'
f:\e\projects\lua-cjson\strbuf.h(146) : error C2143: syntax error : missing ';' before '{'
lua_cjson.c(1128) : error C2054: expected '(' to follow 'inline'
lua_cjson.c(1129) : error C2085: 'json_decode_ascend' : not in formal parameter list
lua_cjson.c(1129) : error C2143: syntax error : missing ';' before '{'

Error: Build error: Failed compiling object lua_cjson.obj
commented

#20 is not a portable way.

  • Not a users build with CMake.
  • You have to change rockspec for luarocks users.
  • Users include source code in their project still won't compile.

We don't have to duplicate definiations in CMakeLists.txt and rockspec.

I think #1 is a better choice.