lua-users home
lua-l archive

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


On 20 June 2016 at 06:34, Christophe Jorssen <jorssen.leraincy@free.fr> wrote:
> Hello all and sorry for bumping this really old post of mine.
>
> 2015-05-06 11:25 GMT+02:00 Christophe Jorssen <jorssen.leraincy@free.fr>:
>> Hello all,
>>
>> I'm trying to install the lua wrapper provided with coolprop
>> (http://www.coolprop.org/) under debian sid i386 with lua 5.2 (long term
>> goal: call coolprop from luatex).
>>
>> I followed the instruction found here
>> (https://github.com/CoolProp/CoolProp/tree/master/wrappers/Lua) that is:
>>
>> *Manual Lua (PUC) Installation*
>>
>> 1. First you need to build shared library version of a CoolLib library and
>> install it somewhere in your operating system's library search path
>> (instructions are here :
>> http://www.coolprop.org/coolprop/wrappers/SharedLibrary/index.html).
>> 2. Next you need to compile coolprop/cpapi.c wrapper. Easiest way to do it
>> is to run make on Lua wrapper's root folder.
>> 3. Then place the resulting coolprop/cpapi.so in your Lua's package.cpath,
>> and there under coolprop directory.
>> 4. Done.
>>
>> But running lua example.lua from the CoolProp/wrappers/Lua directory
>> complains:
>>
>> lua: /usr/share/lua/5.2/coolprop.lua:13: Unable to load Lua CoolProp C API
>> Wrapper.
>> stack traceback:
>> [C]: in function 'assert'
>> /usr/share/lua/5.2/coolprop.lua:13: in main chunk
>> [C]: in function 'require'
>> example.lua:1: in main chunk
>> [C]: in ?
>>
>> Lines 12 and 13 of coolprop.lua are:
>>
>> local ok, capi = pcall(require, "coolprop.capi")
>> assert(ok, "Unable to load Lua CoolProp C API Wrapper.")
>>
>> Indeed, there is no coolprop.capi there. Any idea of something I may have
>> done wrong?
>>
>
> I tried again with a fresh install of a debian jessie.
>
> Here is what I did.
>
> 1) Install lua5.2
>
> 2) Make my own luarocks (as debian does not support lua5.2 for luarocks AFAIU)
> This is my ./configure command line
>
> ./configure --prefix=$HOME/luarocks --lua-version=5.2
>
> 3) luarocks works ok and then I set paths as said in the doc that is :
> eval $(luarocks path --bin)
>
> FYI :
>
> export LUA_PATH='/home/christophe/.luarocks/share/lua/5.2/?.lua;/home/christophe/.luarocks/share/lua/5.2/?/init.lua;/home/christophe/luarocks/share/lua/5.2/?.lua;/home/christophe/luarocks/share/lua/5.2/?/init.lua;/usr/local/share/lua/5.2/?.lua;/usr/local/share/lua/5.2/?/init.lua;/usr/local/lib/lua/5.2/?.lua;/usr/local/lib/lua/5.2/?/init.lua;/usr/share/lua/5.2/?.lua;/usr/share/lua/5.2/?/init.lua;./?.lua'
> export LUA_CPATH='/home/christophe/.luarocks/lib/lua/5.2/?.so;/home/christophe/luarocks/lib/lua/5.2/?.so;/usr/local/lib/lua/5.2/?.so;/usr/lib/x86_64-linux-gnu/lua/5.2/?.so;/usr/lib/lua/5.2/?.so;/usr/local/lib/lua/5.2/loadall.so;./?.so'
> export PATH='/home/christophe/.luarocks/bin:/home/christophe/luarocks/bin:/home/christophe/bin:/opt/texbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games'
>
> 4) As Hisham recommanded :
> git clone git@github.com:ipese/LuaCoolProp.git
>
> then followed instructions there for linux after editing the Makefile
> to make it work for lua5.2
>
> luarocks --local build luacoolprop-scm-1.rockspec
> luarocks --local pack luacoolprop
> luarocks install luacoolprop-scm-1.linux-x86_64.rock

As a clarification: this command downloads a fresh copy of the source
code in a temporary dir. It will not act on your local clone with your
edited Makefile. To use the copy of the sources in your current dir
you'd use `luarocks make`. But that shouldn't be necessary. There's no
need to edit the Makefile; the rockspec sets the correct flags.

> christophe@uranium:~$ lua
> Lua 5.2.3  Copyright (C) 1994-2013 Lua.org, PUC-Rio
>> require'coolprop'
> /home/christophe/luarocks/share/lua/5.2/coolprop.lua:13: Unable to
> load Lua CoolProp C API Wrapper.
> stack traceback:
> [C]: in function 'assert'
> /home/christophe/luarocks/share/lua/5.2/coolprop.lua:13: in main chunk
> [C]: in function 'require'
> stdin:1: in main chunk
> [C]: in ?
>>
>
> Same error as last year...
>
> Do you have an idea why it still does not work?

I have no idea, but try this: require("coolprop.capi"). This might
give you better diagnostics.

If all else fails, LuaCoolProp also includes a FFI-based module for
LuaJIT. You may try that instead (open luajit and require("coolprop")
).

-- Hisham