graph-toolkit icon indicating copy to clipboard operation
graph-toolkit copied to clipboard

Add rockspec

Open daurnimator opened this issue 9 years ago • 9 comments

Please publish a rockspec so that the library can be installed via luarocks (and used as a dependancy!)

daurnimator avatar Jan 02 '15 16:01 daurnimator

Done :-)

https://rocks.moonscript.org/modules/francesco/graph-toolkit

I hope I made no errors. I've just made a minor modification to the rockspec prepared by @ladc, I've used the git:// protocol because it seems luarocks doesn't like https and I've added a specific tag.

I've a newbie question about the rockspec: I've the impression that Windows users are out of luck because there are no binaries. How it is supposed to work ? I mean, on linux is almost trivial to compile something but on Windows is much more complicated...

franko avatar Jan 02 '15 18:01 franko

Done :-)

https://rocks.moonscript.org/modules/francesco/graph-toolkit

I hope I made no errors

Doesn't work at the moment.

$ sudo luarocks install https://rocks.moonscript.org/manifests/francesco/graph-toolkit-scm-1.rockspec
Using https://rocks.moonscript.org/manifests/francesco/graph-toolkit-scm-1.rockspec... switching to 'build' mode
Cloning into 'graph-toolkit'...
remote: Counting objects: 121, done.
remote: Compressing objects: 100% (120/120), done.
remote: Total 121 (delta 1), reused 101 (delta 0)
Receiving objects: 100% (121/121), 237.67 KiB | 0 bytes/s, done.
Resolving deltas: 100% (1/1), done.
Checking connectivity... done.
Note: checking out '126a11bdbb98faf785c373516a288b7fa609f824'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:

  git checkout -b new_branch_name

Warning: unmatched variable CXXFLAGS
make: *** No targets specified and no makefile found.  Stop.

Error: Build error: Failed building.

I think you need to remove the source.dir variable from your rockspec.

I've a newbie question about the rockspec: I've the impression that Windows users are out of luck because there are no binaries.

You can upload binary rocks if you want. You can create one with $ luarocks build --pack-binary-rock graph-toolkit-scm-1.rockspec

I mean, on linux is almost trivial to compile something but on Windows is much more complicated...

luarocks works fine on windows (see http://luarocks.org/en/Installation_instructions_for_Windows ) It supports both mingw and msvc.

daurnimator avatar Jan 02 '15 19:01 daurnimator

There was a typo in the directory name (source.dir) and I've fixed that in the rockspec. The problem is that I still get errors and for the moment I quite don't know how to fix this stuff.

I guess I'm going to fix that in the next days. I hope people will not get disappointed if they try the rockspec and it doesn't work.

May be I should remove the rockspec until I managed to fix the remaining problems...

franko avatar Jan 02 '15 21:01 franko

There was a typo in the directory name (source.dir) and I've fixed that in the rockspec. The problem is that I still get errors and for the moment I quite don't know how to fix this stuff.

That has fixed it for me :)


However, it only works in lua 5.1 and luajit. When I try and run under lua 5.2 I get a segfault:

Program received signal SIGSEGV, Segmentation fault.
0x00000000004116cc in ?? ()
(gdb) bt
#0  0x00000000004116cc in ?? ()
#1  0x00000000004062e7 in lua_setfield ()
#2  0x00007ffff6e12759 in window_registry_prepare () from /usr/lib/lua/5.2/graphcore.so
#3  0x00007ffff6e3fd44 in luaopen_graphcore () from /usr/lib/lua/5.2/graphcore.so
#4  0x000000000040869d in ?? ()
#5  0x00000000004089fd in ?? ()
#6  0x0000000000406658 in lua_callk ()
#7  0x0000000000420a57 in ?? ()
#8  0x000000000040869d in ?? ()
#9  0x0000000000412604 in ?? ()
#10 0x0000000000408a09 in ?? ()
#11 0x0000000000406658 in lua_callk ()
#12 0x0000000000420a57 in ?? ()
#13 0x000000000040869d in ?? ()
#14 0x00000000004089fd in ?? ()
#15 0x0000000000407ffc in ?? ()
#16 0x0000000000408c41 in ?? ()
#17 0x000000000040672d in lua_pcallk ()
#18 0x00000000004044f6 in _start ()

This should possiby be discussed in a new issue?

daurnimator avatar Jan 02 '15 22:01 daurnimator

Ok, thank you for testing! I guess we can keep this issue open, that's ok for me.

Well on my system when I try to install the rock it says that libX11 is not installed while in reality the dev packages for the xwindow libraries are there.

Otherwise I'll give a look for the issue with lua 5.2, with some luck it could be something trivial to fix.

franko avatar Jan 03 '15 09:01 franko

@franko, thanks for the merge! It's odd that LuaRocks dislikes https, and that it doesn't properly detect the libs. What is the exact path of your X11 installation (in particular the header file Xlib.h)? BTW, I thought the idea of an 'scm' rockspec is that it points to the latest development version (i.e. git HEAD) and not to a specific version, but maybe I misunderstood?

ladc avatar Jan 03 '15 12:01 ladc

@daurnimator, sorry, the current version of the library won't work in Lua > 5.1; for one, it uses C API functions that were removed in 5.2 (e.g. lua_getfenv/lua_setfenv). So the dependency line should have read "lua == 5.1", for now at least.

ladc avatar Jan 03 '15 13:01 ladc

@ladc In reality luarock was complaining asking to install luasec to use the https protocol. I was a little bit grouchy, I was surprised https was not built-in in luarock.

As for the X libraries they are unsurprisingly in /usr/include. The actual file is in /usr/include/X11/Xlib.h and normally you include the file as <X11/Xlib.h>. The pkg-config is also configured and the libraries are in /usr/lib so I cannot imagine a more standard configuration :-)

As for the "scm" version I was actually wondering what was its meaning! :-) For me is ok to link to the master branch but now I'm just afraid that by changing we are going to break something else in the rockspec! Do you think it is better to point to the master branch ? In this cas what should I choose as "url" ?

franko avatar Jan 03 '15 14:01 franko

@franko It ought to use a helper tool like wget/curl to use the https protocol in the absence of luasec. It works for me:

Using graph-toolkit-scm-1.rockspec... switching to 'build' mode
Warning: falling back to curl - install luasec to get native HTTPS support

What version of LuaRocks are you using? Do you have curl? The version you've uploaded also adds a dependency, albeit on git instead of curl/luasec...

As for the X library: I have the exact same configuration; have you specified any custom paths in your luarocks config files (get the path by running luarocks without arguments)? According to the manual (http://luarocks.org/en/Config_file_format):

external_deps_dirs (array of strings) - Where to look for external dependencies, when a prefix is not set for a specific dependency in the variables table (see below) or through the command-line. Default is { "/usr/local", "/usr" } on Unix; { "c:\external" } on Windows.

"scm" is source control management... or is it source code management? :-) I suppose you could use either the original version, or

source = {
   url = "git://github.com/franko/graph-toolkit"
}

ladc avatar Jan 03 '15 16:01 ladc