lua-users home
lua-l archive

Re: Can't install cjson on windows with luarocks?

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


> On 20/12/2016, at 3:51 PM, Thibault Charbonnier <thibaultcha@fastmail.com> wrote:
> 
> On 12/19/16 5:41 PM, Geoff Leyland wrote:
>> Hi,
>> 
>> I'm trying to install lua-cjson on Windows with Luarocks (2.4.2, freshly installed).
>> 
>> Am I making any obvious mistakes?
> 
> Have you tried installing the master branch? I wouldn't know for sure but it seems like it received a few fixes for Windows installs since 2.1.0:
> https://github.com/mpx/lua-cjson/compare/2.1.0...master
> 
> Additionally, you might want to check out the openresty/lua-cjson maintained fork which contains a few bugfixes and additional features:
> https://github.com/openresty/lua-cjson/#description
> https://github.com/mpx/lua-cjson/compare/master...openresty:master
> 
> Both of those options are not published on Luarocks but you can clone either repository and try to install their master branch with:
> $ git clone <mpx/lua-cjson or openresty/lua-cjson>
> $ cd lua-cjson
> $ luarocks make
Thanks!
Turns out this problem is that MSVC doesn't understand "static inline", and there are a few more. The fixes are in master in CMakeLists.txt.
The equivalent addition to the rockspec is:
diff --git a/lua-cjson-2.1devel-1.rockspec b/lua-cjson-2.1devel-1.rockspec
index 154e333..752cc8d 100644
--- a/lua-cjson-2.1devel-1.rockspec
+++ b/lua-cjson-2.1devel-1.rockspec
@@ -47,7 +47,11 @@ build = {
 -- Override default build options (per platform)
 platforms = {
 win32 = { modules = { cjson = { defines = {
- "DISABLE_INVALID_NUMBERS"
+ "DISABLE_INVALID_NUMBERS",
+ "inline=__inline",
+ "snprintf=_snprintf",
+ "isnan=_isnan",
+ "USE_INTERNAL_ISINF"
 } } } }
 },
 copy_directories = { "tests" }

AltStyle によって変換されたページ (->オリジナル) /