Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 739764 - dev-lang/lua-{5.2,5.3} incorrectly use $EROOT which should be $BROOT (PATCH)
Summary: dev-lang/lua-{5.2,5.3} incorrectly use $EROOT which should be $BROOT (PATCH)
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: William Hubbs
Keywords: PATCH, PullRequest
Depends on:
Reported: 2020-08-31 18:07 UTC by Ed Wildgoose
Modified: 2022-03-03 15:42 UTC (History)
3 users (show)

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


Note You need to log in before you can comment on or make changes to this bug.
Description Ed Wildgoose 2020-08-31 18:07:13 UTC
I think that the lua patch incorrectly tries to use "$EROOT" to locate usr/bin/libtool during compilation. When crosscompiling this fails for me as it tries to locate libtool in the destination/install ROOT location (where it doesn't exist for me)

I believe that the correct incantation is to use $BROOT/usr/bin/libtool so that it uses the libtool in the build root?

So this following patch would work for lua5.2/5.3

Can someone who actually knows what they are doing please sanity check this and apply if appropriate...

diff --git a/dev-lang/lua/files/lua-5.3-make-r1.patch b/dev-lang/lua/files/lua-5.3-make-r1.patch
index b9e9051462c..1ee8acaa3b8 100644
--- a/dev-lang/lua/files/lua-5.3-make-r1.patch
+++ b/dev-lang/lua/files/lua-5.3-make-r1.patch
@@ -18,7 +18,7 @@ diff -uNr lua-5.3.3.orig/Makefile lua-5.3.3/Makefile
 +# Use libtool for binary installs, etc.
 +export V
-+export LIBTOOL = $(EROOT)usr/bin/libtool --quiet --tag=CC
++export LIBTOOL = $(BROOT)usr/bin/libtool --quiet --tag=CC
 +# See libtool manual about how to set this
@@ -63,7 +63,7 @@ diff -uNr lua-5.3.3.orig/src/Makefile lua-5.3.3/src/Makefile

  # (end of Makefile)
-+export LIBTOOL = $(EROOT)usr/bin/libtool --quiet --tag=CC
++export LIBTOOL = $(BROOT)usr/bin/libtool --quiet --tag=CC
 +export LIB_VERSION = 6:1:1
 +# The following rules use libtool for compiling and linking in order to
Comment 1 Marek Szuba archtester gentoo-dev 2020-11-13 23:48:06 UTC
The variable BROOT has only been available since EAPI-7. As of right now, all but one dev-lang/lua ebuilds in the tree use EAPI=5; the remaining one (5.1.5-r5) uses EAPI=6.

In other words, this is something to keep in mind once we have begun migrating dev-lang/lua ebuilds to EAPI-7 - but until then this change would actually break things.
Comment 2 Ed Wildgoose 2020-11-16 13:04:05 UTC
Hi, Can I reopen this please. 

I hear what you say. However, I guess that the initial problem still remains, therefore:

a) Could we start the eapi=7 process with this ebuild? And apply the change noted?

b) I suspect then that although my specific suggestion is wrong, there is probably an eapi=6 solution, perhaps by completely ommitting ${BROOT} or similar?

I guess I'm a bit confused about why we are trying to use EROOT at all? Probably there is some previous problem that this was intended to resolve, but I can't really think what? Seems incorrect at first glance?

My vote would be a), what do you think?

Repeat, that as of today, the ebuild does NOT compile when compiling into an alternate "ROOT=something" location because of this, so I would like to try and find a solution please?

Comment 3 William Hubbs gentoo-dev 2020-12-30 16:59:51 UTC
I'm not sure why the makefiles were using EROOT or BROOT this way, so I
removed those references in the slotted lua ebuilds.
Comment 4 Larry the Git Cow gentoo-dev 2020-12-30 17:03:41 UTC
The bug has been referenced in the following commit(s):

commit 1788cd986db0c35c7300d7727f8471a4f11062a1
Author:     William Hubbs <>
AuthorDate: 2020-12-30 17:01:48 +0000
Commit:     William Hubbs <>
CommitDate: 2020-12-30 17:03:27 +0000

    dev-lang/lua: remove unneeded reference to BROOT in patches
    Signed-off-by: William Hubbs <>

 dev-lang/lua/files/lua-5.4.2-make.patch | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
Comment 5 Guilherme Amadio gentoo-dev 2021-04-20 12:45:28 UTC
The patch above has broken the build on prefix:

>>> Compiling source in /tmp/portage/dev-lang/lua-5.4.2-r1/work/lua-5.4.2 ...
 * abi_x86_64.amd64: running multilib-minimal_abi_src_compile
make -j4 -l4 CC=x86_64-pc-linux-gnu-gcc 'CFLAGS=-DLUA_COMPAT_5_3 -DLUA_USE_READLINE -DLUA_USE_LINUX  -O2 -pipe -O2 -pipe' 'SYSLDFLAGS=-Wl,-O1 -Wl,--as-needed' RPATH=/cvmfs/ LUA_LIBS=-lreadline 'LIB_LIBS=-lm -ldl' V=5.4 gentoo_all 
/usr/bin/libtool --quiet --tag=CC --mode=compile x86_64-pc-linux-gnu-gcc -c  -DLUA_COMPAT_5_3 -DLUA_USE_READLINE -DLUA_USE_LINUX  -O2 -pipe -O2 -pipe -o lapi.lo lapi.c
make: /usr/bin/libtool: No such file or directory
make: *** [Makefile:232: lapi.lo] Error 127
 * ERROR: dev-lang/lua-5.4.2-r1::gentoo failed (compile phase):
 *   emake failed

Please revert or fix by adding EROOT/BROOT/EPREFIX, whichever you think is the correct one to use in this context.
Comment 6 Larry the Git Cow gentoo-dev 2022-02-14 07:34:05 UTC
The bug has been closed via the following commit(s):

commit 3f0c95ca346af106169ceef830e4e0ae5ea3eed2
Author:     Alexandra Parker <>
AuthorDate: 2022-01-31 03:01:47 +0000
Commit:     William Hubbs <>
CommitDate: 2022-02-14 07:33:58 +0000

    dev-lang/lua:5.1.5-r107 5.3.6-r3 bump
    - Cross-compile fix, use libtol on the target system and move libtool to
      DEPEND instead of BDEPEND.
    Package-Manager: Portage-3.0.30, Repoman-3.0.3
    Signed-off-by: Alexandra Parker <>
    Signed-off-by: William Hubbs <>

 dev-lang/lua/lua-5.1.5-r107.ebuild | 157 ++++++++++++++++++++++++++++
 dev-lang/lua/lua-5.3.6-r3.ebuild   | 206 +++++++++++++++++++++++++++++++++++++
 2 files changed, 363 insertions(+)
Comment 7 Larry the Git Cow gentoo-dev 2022-03-03 15:42:03 UTC
The bug has been closed via the following commit(s):

commit e75caee08ab5c8d0bf72f1cf3d7bfc12361ec0ce
Author:     Alexey Sokolov <>
AuthorDate: 2022-02-26 12:42:16 +0000
Commit:     William Hubbs <>
CommitDate: 2022-03-03 15:41:42 +0000

    dev-lang/lua: fix 5.4 build on prefix
    Similar to how it was fixed for lua 5.3
    Package-Manager: Portage-3.0.30, Repoman-3.0.3
    Signed-off-by: Alexey Sokolov <>
    Signed-off-by: William Hubbs <>

 dev-lang/lua/files/lua-5.4.2-r2-make.patch |  99 ++++++++++++++
 dev-lang/lua/lua-5.4.2-r2.ebuild           | 203 +++++++++++++++++++++++++++++
 dev-lang/lua/lua-5.4.4.ebuild              |   2 +-
 3 files changed, 303 insertions(+), 1 deletion(-)