minoki / luaexif

Lua binding for libexif
Other
11 stars 2 forks source link

not available in package manager luarocks #2

Open nicolasfranck opened 6 years ago

nicolasfranck commented 6 years ago

Apparently this rock is not available using luarocks. Or is there a way to add this?

minoki commented 6 years ago

I finally uploaded this to LuaRocks: https://luarocks.org/modules/minoki/luaexif

Please try luarocks install luaexif. You may need to set LIBEXIF_DIR variable.

nicolasfranck commented 6 years ago

Thanks!

I successfully installed the rock:

nicolasfranck:~ njfranck$ luarocks install luaexif
Installing https://luarocks.org/luaexif-1.0-1.src.rock
env MACOSX_DEPLOYMENT_TARGET=10.8 gcc -O2 -fPIC -I/usr/local/opt/openresty/luajit/include/luajit-2.1 -c lexif.c -o lexif.o -I/usr/local/include
lexif.c:29:3: warning: implicit declaration of function 'luaI_openlib' is invalid in C99 [-Wimplicit-function-declaration]
  luaI_openlib(L, NULL, l, nup);
  ^
1 warning generated.
env MACOSX_DEPLOYMENT_TARGET=10.8 gcc -bundle -undefined dynamic_lookup -all_load -o exif.so -L/usr/local/opt/openresty/luajit/lib lexif.o -L/usr/local/lib -Wl,-rpath,/usr/local/lib: -lexif
luaexif 1.0-1 is now installed in /usr/local/opt/openresty/luajit (license: MIT)

Although loading is problem:

require "luarocks.loader"
local exif = require("exif")

returns:

nicolasfranck:lua njfranck$ luajit exif.lua 
luajit: ./exif.lua:2: loop or previous error loading module 'exif'
stack traceback:
    [C]: in function 'require'
    ./exif.lua:2: in main chunk
    [C]: in function 'require'
    exif.lua:2: in main chunk
    [C]: at 0x010f475a2c

Not sure what is wrong. The file exif.so seems to point to libexif.so:

nicolasfranck:5.1 njfranck$ otool -L /usr/local/opt/openresty/luajit/lib/lua/5.1/exif.so 
/usr/local/opt/openresty/luajit/lib/lua/5.1/exif.so:
    /usr/local/opt/libexif/lib/libexif.12.dylib (compatibility version 16.0.0, current version 16.3.0)
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1252.0.0)
minoki commented 6 years ago

Your filename exif.lua seems to confilct with the module name. Try a different name.

nicolasfranck commented 6 years ago

Right ;-)

But now I got this error:

ca20c526:lua njfranck$ luajit exif_test.lua 
luajit: ...nresty/1.11.2.2/luajit/share/lua/5.1/luarocks/loader.lua:147: error loading module 'exif' from file '/usr/local/Cellar/openresty/1.11.2.2/luajit/lib/lua/5.1/exif.so':
    dlopen(/usr/local/Cellar/openresty/1.11.2.2/luajit/lib/lua/5.1/exif.so, 6): Symbol not found: _luaI_openlib
  Referenced from: /usr/local/Cellar/openresty/1.11.2.2/luajit/lib/lua/5.1/exif.so
  Expected in: flat namespace
 in /usr/local/Cellar/openresty/1.11.2.2/luajit/lib/lua/5.1/exif.so
stack traceback:
    [C]: in function 'a_loader'
    ...nresty/1.11.2.2/luajit/share/lua/5.1/luarocks/loader.lua:147: in function <...nresty/1.11.2.2/luajit/share/lua/5.1/luarocks/loader.lua:144>
    [C]: in function 'require'
    exif_test.lua:2: in main chunk
    [C]: at 0x0108958a2c

According to documentation found around the web, this should be caused by conflicting lua versions, but the luarocks and luajit seem to be the same version?

romanb089 commented 3 years ago

Right ;-)

But now I got this error:

ca20c526:lua njfranck$ luajit exif_test.lua 
luajit: ...nresty/1.11.2.2/luajit/share/lua/5.1/luarocks/loader.lua:147: error loading module 'exif' from file '/usr/local/Cellar/openresty/1.11.2.2/luajit/lib/lua/5.1/exif.so':
  dlopen(/usr/local/Cellar/openresty/1.11.2.2/luajit/lib/lua/5.1/exif.so, 6): Symbol not found: _luaI_openlib
  Referenced from: /usr/local/Cellar/openresty/1.11.2.2/luajit/lib/lua/5.1/exif.so
  Expected in: flat namespace
 in /usr/local/Cellar/openresty/1.11.2.2/luajit/lib/lua/5.1/exif.so
stack traceback:
  [C]: in function 'a_loader'
  ...nresty/1.11.2.2/luajit/share/lua/5.1/luarocks/loader.lua:147: in function <...nresty/1.11.2.2/luajit/share/lua/5.1/luarocks/loader.lua:144>
  [C]: in function 'require'
  exif_test.lua:2: in main chunk
  [C]: at 0x0108958a2c

According to documentation found around the web, this should be caused by conflicting lua versions, but the luarocks and luajit seem to be the same version?

I am getting a similar error too.

luajit dumpexif.lua 
luajit: error loading module 'exif' from file '/usr/local/openresty/lualib/exif.so':
    /usr/local/openresty/lualib/exif.so: undefined symbol: lua_newuserdatauv
stack traceback:
    [C]: at 0x004539f0
    [C]: in function 'require'
    dumpexif.lua:1: in main chunk
    [C]: at 0x00404f40

Can you tell me how to fix this?

minoki commented 3 years ago

@nicolasfranck I've uploaded a new version (1.1) to improve compatibility with LuaJIT. Please try it out.

@romanb089 It appears that you built luaexif with Lua 5.4 headers but using with LuaJIT (which is compatible with Lua 5.1, not Lua 5.4). Please try re-building with LuaJIT header.

romanb089 commented 3 years ago

@nicolasfranck I've uploaded a new version (1.1) to improve compatibility with LuaJIT. Please try it out.

@romanb089 It appears that you built luaexif with Lua 5.4 headers but using with LuaJIT (which is compatible with Lua 5.1, not Lua 5.4). Please try re-building with LuaJIT header.

Thank you very much! New version 1.1 solved my problem