LUA > Csomagkezelés > LuaRocks II

1. A feltelepített modulok elérése LUA szkriptből [SOLVED]

Rossz hír fogad:

The Lua libraries path

To use modules installed with LuaRocks, all you need to do is make sure they are found by Lua's module loading mechanism. The exact location depends on your installation flags, and how to set up the Lua modules path depends on your Lua interpreter and your application: you can use the LUA_PATH and LUA_CPATH environment variables, or update the value of the package.path and package.cpath variables from Lua code.

If you installed the Lua interpreter bundled with LuaRocks on Windows, or if you built both Lua and LuaRocks on Unix with the default paths, the default library path settings will be already appropriate.

Tehát, ha jól veszem ki akkor nekem kell barkácsolni a LUA_PATH, LUA_CPATH környezeti változókat, hogy tudjam használni a LuaRocks-szal felrakott modulokat. Óriási. :(

[ update=01 ]
Ha minden igaz ezzel kell bővíteni a ~/.bashrc-t


export PATH=~/.luarocks/bin:"${PATH}"
export LUA_INIT="require 'luarocks.require'"

Innen: http://www.deheus.net/petrik/blog/2009/03/07/running-lunit-with-luarock…
[ /update ]

2. Kepler-xavante nem akar felcsúszni

$ luarocks install kepler-xavante

Error: Failed installing dependency: http://luarocks.org/repositories/rocks/kepler-1.1.1-1.src.rock - File /home/foofighter/.luarocks/bin/op.cgi is not tracked by LuaRocks. Cannot install new version.

Ez meg rejtély.

3. Luasvn szintén nem akar felcsúszni


$ luarocks install luasvn
Error: Could not find expected file apr-1/apr.h for APR 
-- you may have to install APR in your system and/or set the APR_DIR variable

Ami ugye azért furcsa, mert az "apt-get install svn-dev" megtörtént és létezik /usr/include/apr-1.0 könyvtár.

The problem is that the maintainers of your distro did not respect the
paths defined by the APR developers. Normal installs of APR use
include/apr-1, but your distro seems to use the non-standard path
include/apr-1.0.

Innen: http://lists.luaforge.net/pipermail/luarocks-developers/2008-February/0…

Csúnya, csúnya ubuntucska. Ma nem kapsz rétest estére.
Járt utat, járatlanért mért hagysz el?

Hirtelen két megoldás jut eszembe:

(1) Kap egy simlinket az apr1.0 könyvtár


$ cd /usr/include
$ sudo ln -s apr-1.0 apr-1

(2) Készül egy ubuntu-specifikus rock fájl

A simlinkes orvosság beadása után:


luasvn.c: In function ‘init_pool’:
luasvn.c:55: warning: ‘svn_dso_initialize’ is deprecated (declared at /usr/include/subversion-1/svn_dso.h:77)
luasvn.c: In function ‘init_function’:
luasvn.c:102: warning: ‘svn_cmdline_setup_auth_baton’ is deprecated (declared at /usr/include/subversion-1/svn_cmdline.h:356)
luasvn.c: In function ‘make_log_msg_baton’:
luasvn.c:159: error: ‘APR_LOCALE_CHARSET’ undeclared (first use in this function)
luasvn.c:159: error: (Each undeclared identifier is reported only once
luasvn.c:159: error: for each function it appears in.)
luasvn.c: In function ‘log_msg_func2’:
luasvn.c:182: warning: implicit declaration of function ‘svn_utf_cstring_to_utf8’
luasvn.c:182: warning: initialization makes pointer from integer without a cast
luasvn.c: In function ‘l_add’:
luasvn.c:235: warning: ‘svn_client_add3’ is deprecated (declared at /usr/include/subversion-1/svn_client.h:1358)
luasvn.c: In function ‘l_checkout’:
luasvn.c:337: warning: ‘svn_client_checkout2’ is deprecated (declared at /usr/include/subversion-1/svn_client.h:1072)
luasvn.c: In function ‘l_commit’:
luasvn.c:407: warning: ‘svn_client_commit3’ is deprecated (declared at /usr/include/subversion-1/svn_client.h:1739)
luasvn.c: In function ‘l_copy’:
luasvn.c:454: warning: ‘svn_client_copy3’ is deprecated (declared at /usr/include/subversion-1/svn_client.h:3195)
luasvn.c: In function ‘l_delete’:
luasvn.c:504: warning: ‘svn_client_delete2’ is deprecated (declared at /usr/include/subversion-1/svn_client.h:1533)
luasvn.c: In function ‘l_diff’:
luasvn.c:617: warning: ‘svn_client_diff3’ is deprecated (declared at /usr/include/subversion-1/svn_client.h:2286)
luasvn.c:619: error: ‘APR_LOCALE_CHARSET’ undeclared (first use in this function)
luasvn.c: In function ‘l_import’:
luasvn.c:663: warning: ‘svn_client_import2’ is deprecated (declared at /usr/include/subversion-1/svn_client.h:1632)
luasvn.c: In function ‘l_list’:
luasvn.c:763: warning: ‘svn_client_list’ is deprecated (declared at /usr/include/subversion-1/svn_client.h:4011)
luasvn.c: In function ‘l_log’:
luasvn.c:860: warning: ‘svn_client_log3’ is deprecated (declared at /usr/include/subversion-1/svn_client.h:2006)
luasvn.c: In function ‘l_merge’:
luasvn.c:940: warning: ‘svn_client_merge2’ is deprecated (declared at /usr/include/subversion-1/svn_client.h:2656)
luasvn.c: In function ‘l_mkdir’:
luasvn.c:974: warning: ‘svn_client_mkdir2’ is deprecated (declared at /usr/include/subversion-1/svn_client.h:1448)
luasvn.c: In function ‘l_move’:
luasvn.c:1019: warning: ‘svn_client_move4’ is deprecated (declared at /usr/include/subversion-1/svn_client.h:3344)
luasvn.c: In function ‘l_propget’:
luasvn.c:1072: warning: assignment makes pointer from integer without a cast
luasvn.c:1075: warning: ‘svn_client_propget2’ is deprecated (declared at /usr/include/subversion-1/svn_client.h:3648)
luasvn.c: In function ‘l_proplist’:
luasvn.c:1132: warning: ‘svn_client_proplist2’ is deprecated (declared at /usr/include/subversion-1/svn_client.h:3754)
luasvn.c: In function ‘l_propset’:
luasvn.c:1211: warning: assignment makes pointer from integer without a cast
luasvn.c:1217: warning: ‘svn_client_propset2’ is deprecated (declared at /usr/include/subversion-1/svn_client.h:3497)
luasvn.c:1219: warning: ‘svn_client_propset2’ is deprecated (declared at /usr/include/subversion-1/svn_client.h:3497)
luasvn.c: In function ‘l_revprop_get’:
luasvn.c:1296: warning: assignment makes pointer from integer without a cast
luasvn.c:1303: warning: implicit declaration of function ‘svn_prop_needs_translation’
luasvn.c: In function ‘l_revprop_list’:
luasvn.c:1356: error: ‘APR_LOCALE_CHARSET’ undeclared (first use in this function)
luasvn.c: In function ‘l_revprop_set’:
luasvn.c:1407: warning: assignment makes pointer from integer without a cast
luasvn.c:1414: error: ‘APR_LOCALE_CHARSET’ undeclared (first use in this function)
luasvn.c:1418: warning: ‘svn_client_revprop_set’ is deprecated (declared at /usr/include/subversion-1/svn_client.h:3577)
luasvn.c:1420: warning: ‘svn_client_revprop_set’ is deprecated (declared at /usr/include/subversion-1/svn_client.h:3577)
luasvn.c: In function ‘l_status’:
luasvn.c:1675: warning: ‘svn_client_status2’ is deprecated (declared at /usr/include/subversion-1/svn_client.h:1867)
luasvn.c: In function ‘l_update’:
luasvn.c:1726: warning: ‘svn_client_update2’ is deprecated (declared at /usr/include/subversion-1/svn_client.h:1183)
luasvn.c: At top level:
luasvn.c:1771: warning: return type defaults to ‘int’
make: *** [luasvn.o] Error 1

luasvn.c-be illesztve:
#define APR_LOCALE_CHARSET (const char *)1
#define APR_LOCALE_CHARSET "UTF-8"

Lefordul, de maradnak a warninghegyek:


gcc -Wall -O2 -fpic -D_REENTRANT -D_GNU_SOURCE -D_LARGEFILE64_SOURCE -ggdb -fomit-frame-pointer -pipe -pthread -I/usr/include/subversion-1 -I/home/foofighter/lua-5.1.4/src -I/usr/include/apr-1 -I/usr/include/apr-1   -c -o luasvn.o luasvn.c

Ebből saját rock fájl lesz...

Hozzászólások

'ln -s' is your friend
--


()=() Ki oda vagyik,
('Y') hol szall a galamb
C . C elszalasztja a
()_() kincset itt alant.

#define APR_LOCALE_CHARSET (const char *)1

Hu, na ez egy aranykopes, ezt biztos el fogom tenni valami helyre. Nahat, vazzze, tenyleg nem gondoltam volna, hogy ennyire lelemenyes vagy, komolyan nem neztem volna ki beloled.

Legalabb megprobaltad ertelmezni, amit irsz, vagy writeonly? Egy numerikus egyest konvertalsz at char * pointerre - ez olyan tuti segfault, hogy csak na. Meg lehetne probalkozni peldaul szoveget, vagyis, stringet beadni neki, ilytenfelekepp:

#define APR_LOCALE_CHARSET "UTF-8"

ennek mar peldajanak okaert van is ertelme, es eselyes, hogy nem fog segfaultot dobni.

Ne haragudj, de a multkor itt toltad ki a lua-s C forrasokat, tenyleg nem neztem volna ki beloled, hogy ezt le birod irni rohoges nelkul.
--


()=() Ki oda vagyik,
('Y') hol szall a galamb
C . C elszalasztja a
()_() kincset itt alant.