cardpeek fails to build for F22 / rawhide: OBJCLD cardpeek lua_bytes.o: In function `subr_bytes_set': /home/kalev/fedora-git/cardpeek/cardpeek-0.8.4/lua_bytes.c:296: undefined reference to `luaL_checkint' /home/kalev/fedora-git/cardpeek/cardpeek-0.8.4/lua_bytes.c:302: undefined reference to `luaL_checkint' lua_bytes.o: In function `subr_bytes_get': /home/kalev/fedora-git/cardpeek/cardpeek-0.8.4/lua_bytes.c:262: undefined reference to `luaL_checkint' /home/kalev/fedora-git/cardpeek/cardpeek-0.8.4/lua_bytes.c:270: undefined reference to `luaL_checkint' lua_bytes.o: In function `subr_bytes_convert': /home/kalev/fedora-git/cardpeek/cardpeek-0.8.4/lua_bytes.c:440: undefined reference to `luaL_checkint' lua_bytes.o:/home/kalev/fedora-git/cardpeek/cardpeek-0.8.4/lua_bytes.c:434: more undefined references to `luaL_checkint' follow collect2: error: ld returned 1 exit status luaL_checkint() is guarded by the LUA_COMPAT_5_2 macro which the lua build currently does not define.
Created attachment 1004480 [details] [PATCH] Define LUA_COMPAT_5_2 in addition to LUA_COMPAT_5_1
13:58 < kalev> spot: hey, ok to commit the lua patch in https://bugzilla.redhat.com/show_bug.cgi?id=1204129 ? 13:59 < spot> kalev: definitely.
cardpeek-0.8.4-1.fc22,lua-5.3.0-2.fc22 has been submitted as an update for Fedora 22. https://admin.fedoraproject.org/updates/cardpeek-0.8.4-1.fc22,lua-5.3.0-2.fc22
Package cardpeek-0.8.4-1.fc22, lua-5.3.0-2.fc22: * should fix your issue, * was pushed to the Fedora 22 testing repository, * should be available at your local mirror within two days. Update it with: # su -c 'yum update --enablerepo=updates-testing cardpeek-0.8.4-1.fc22 lua-5.3.0-2.fc22' as soon as you are able to. Please go to the following url: https://admin.fedoraproject.org/updates/FEDORA-2015-4397/cardpeek-0.8.4-1.fc22,lua-5.3.0-2.fc22 then log in and leave karma (feedback).
cardpeek-0.8.4-1.fc22, lua-5.3.0-2.fc22 has been pushed to the Fedora 22 stable repository. If problems still persist, please make note of it in this bug report.
Now, while compatibility is good, this change creates a problem with code like this: #if LUA_VERSION_NUM >= 503 #define luaL_checkunsigned(L,n) ((lua_Unsigned)luaL_checkinteger(L,n)) #endif throwing a "luaL_checkunsigned" redefined" error. What is the proper way to handle this? Variant 1: #if LUA_VERSION_NUM >= 503 #ifndef LUA_COMPAT_APIINTCASTS #define luaL_checkunsigned(L,n) ((lua_Unsigned)luaL_checkinteger(L,n)) #endif #endif Variant 2: #include <lua.h> #if LUA_VERSION_NUM >= 503 #define LUA_COMPAT_APIINTCASTS #endif #include <lauxlib.h> I am a bit confused.
I'll try to answer. lua 5.3 says (in lauxlib.h) /* ** {============================================================ ** Compatibility with deprecated conversions ** ============================================================= */ #if defined(LUA_COMPAT_APIINTCASTS) #define luaL_checkunsigned(L,a) ((lua_Unsigned)luaL_checkinteger(L,a)) ... This means that if Lua is compiled with LUA_COMPAT_APIINTCASTS, you can safely use the deprecated luaL_checkunsigned(L,a) function instead of using the new luaL_checkinteger. Of your two proposed versions, Variant 1 is a correct way to handle this case. Variant 2 is incorrect, because LUA_COMPAT_APIINTCASTS is defined in luaconf.h, so you're asking for trouble. (It also changes lua in ways deeper than the headers.)