Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 758911 - dev-libs/libprelude: Lua compiled module is linked against liblua
Summary: dev-libs/libprelude: Lua compiled module is linked against liblua
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Thomas ANDREJAK
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-12-07 15:51 UTC by Marek Szuba
Modified: 2021-01-04 19:33 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Marek Szuba archtester gentoo-dev 2020-12-07 15:51:23 UTC
When told to install Lua bindings (USE=lua), at least version 5.2.0 of libprelude produces compiled Lua modules. This happens in both ebuilds depending directly on dev-lang/lua and those migrated to Lua eclasses.

While I haven't got an appropriate link to official documentation at hand, having consulted Gentoo Lua experts during my work on Lua eclasses I am fairly confident compiled modules must not link against liblua. Indeed, that is what allows dev-lang/lua:5.1 and dev-lang/luajit to share module directories without causing massive cross-talk.

With any luck this might be a simple matter of dropping unnecessary linker flags. Regardless of whether this is as simple as that or more radical changes are necessary, please notify upstream.
Comment 1 Joonas Niilola gentoo-dev 2020-12-07 16:10:36 UTC
----------
AC_ARG_WITH(lua, AC_HELP_STRING(--with-lua-config@<:@=PATH@:>@, Enable support for lua binding @<:@default=auto@:>@),
            [lua_required=true; if test x$withval = xyes; then with_lua="lua-config"; fi], with_lua="lua-config")

if test x$with_lua != xno; then

   lua_pkg_found=0
   m4_foreach([lua_ver],[[lua],[lua5.1],[lua5.2]],
       [PKG_CHECK_MODULES(LUA, [lua_ver >= 5.1], [
          AC_DEFINE([HAVE_LUA], [1], [liblua])
          AC_DEFINE([HAVE_LUA_H], [1], [lua.h])
          lua_pkg_found=1
       ],[:])]
   )

   if test x$lua_pkg_found = x0; then
       AC_MSG_WARN([*** lua >= 5.1 not found])
   fi

   if test x$lua_pkg_found = x1; then
      AC_SUBST(LUA_CFLAGS)
      AC_SUBST(LUA_LIBS)

      old_CPPFLAGS="$CPPFLAGS"
      CPPFLAGS="$LUA_CFLAGS"
      AC_CHECK_HEADERS([lua.h lauxlib.h], with_lua=yes, [with_lua=no; break])
      CPPFLAGS="$old_CPPFLAGS"

      LUA_VERSION=$(lua -e "print(string.sub(_VERSION, 5))")
      AC_SUBST(LUA_VERSION)

   else
      dnl try lua 5.0
      AC_PATH_PROG(LUA_CONFIG, `basename $with_lua`, no, `dirname $with_lua`:$PATH)
      if test x$LUA_CONFIG = xno; then
         if test x$lua_required = xtrue; then
            AC_MSG_ERROR([Could not find $with_lua binary])
         fi

         with_lua=no
      else
         LUA_CFLAGS=`$LUA_CONFIG --include --vmonly`
         LUA_LIBS=`$LUA_CONFIG --libs --vmonly`
         AC_SUBST(LUA_CFLAGS)
         AC_SUBST(LUA_LIBS)

         old_CPPFLAGS="$CPPFLAGS"
         CPPFLAGS="$LUA_CFLAGS"
         AC_CHECK_HEADERS([lua.h lauxlib.h], with_lua=yes, [with_lua=no; break])
         CPPFLAGS="$old_CPPFLAGS"

         LUA_VERSION=$(lua -e "print(string.sub(_VERSION, 5))")
         AC_SUBST(LUA_VERSION)

      fi
   fi
fi

...
...
...

bindings/lua/Makefile
----------

I guess this is where we need to look at?
Comment 2 Marek Szuba archtester gentoo-dev 2020-12-07 23:50:28 UTC
Okay, so having had a moment to spare I've just told the migrated ebuild to patch LUA_LIBS out of bindings/lua/Makefile.am. This seems to be sufficient, the compiled lua module still builds fine and can be loaded without errors by the corresponding Lua intepreter. I have not run the test suite though so if there are any Lua-related tests in there, you might want to try that as well. Moreover, I haven't touched the unmigrated ebuilds.
Comment 3 Arfrever Frehtes Taifersar Arahesis 2020-12-08 02:57:11 UTC
https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7cc9f60c84c4cb2ad8ffaf5407245f19e0a4b73b

commit 7cc9f60c84c4cb2ad8ffaf5407245f19e0a4b73b
Author:     Marek Szuba <marecki@gentoo.org>
AuthorDate: 2020-12-07 23:42:31 +0000
Commit:     Marek Szuba <marecki@gentoo.org>
CommitDate: 2020-12-07 23:44:45 +0000

    dev-libs/libprelude-5.2.0-r10: do not link Lua bindings against liblua
    
    This is neither allowed for compiled Lua modules nor, as demonstrated
    by the fact simply dropping this from linker options works just fine,
    actually needed in this case.
    
    Signed-off-by: Marek Szuba <marecki@gentoo.org>
Comment 4 Conrad Kostecki gentoo-dev 2021-01-04 19:33:29 UTC
Seems to be fixed, so closing?