Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 524460 - dev-lua/lpeg with dev-lang/lua-5.2.3-r1 - lua.pc directs libraries to /usr/lib64/lua instead of /usr/lib64/lua/5.2
Summary: dev-lua/lpeg with dev-lang/lua-5.2.3-r1 - lua.pc directs libraries to /usr/li...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Development (show other bugs)
Hardware: All Linux
: Normal normal with 1 vote (vote)
Assignee: Vim Maintainers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: lua-5.2
  Show dependency tree
 
Reported: 2014-10-04 16:23 UTC by Tim Jones
Modified: 2020-09-01 17:09 UTC (History)
2 users (show)

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


Attachments
patch for lua-5.2.3-r1.ebuild (lua-5.2.3-r1.ebuild.patch,677 bytes, patch)
2015-02-22 13:28 UTC, Dennis Schridde
Details | Diff
patch for lua-5.2.3-r1.ebuild (lua-5.2.3-r1.ebuild.patch,734 bytes, patch)
2015-02-22 13:50 UTC, Dennis Schridde
Details | Diff
patch for lua-5.2.3-r1.ebuild (lua-5.2.3-r1.ebuild.patch,1012 bytes, patch)
2015-02-22 13:54 UTC, Dennis Schridde
Details | Diff
patch for lua.pc (lua-r1.pc.patch,664 bytes, patch)
2015-02-22 13:54 UTC, Dennis Schridde
Details | Diff
patch for lua-5.2.3-r1.ebuild (lua-5.2.3-r1.ebuild.patch,1011 bytes, patch)
2015-02-22 14:04 UTC, Dennis Schridde
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Tim Jones 2014-10-04 16:23:07 UTC
Lua libraries built against lua-5.2 are installed into an incorrect directory. For me, they end up in /usr/lib64/lua, whereas lua5.2 looks for them in /usr/lib64/lua/5.2. (Libraries built against lua-5.1 end up in /usr/lib64/lua/5.1 and are found by lua5.1.)

I believe the problem arises from line 111 in lua-5.2.3-r1.ebuild, where a portage-provided lua.pc has the contents of variable V replaced with ${PATCH_PV}, which was only defined locally in src_prepare(). So lua5.2.pc ends up with an empty V, and so "$(pkg-config --variable INSTALL_CMOD lua)" (used by other ebuilds, e.g. lpeg and luaexpat) returns the incorrect /usr/lib64/lua when lua5.2.pc is in use thanks to eselect lua.

I did not test a modified ebuild, but libraries manually placed in /usr/lib64/lua/5.2 are successfully found by lua5.2.

Reproducible: Always

Steps to Reproduce:
1. eselect lua set 5.2
2. emerge -1av lpeg
3. lua -e "require('lpeg')"
Actual Results:  
lua: (command line):1: module 'lpeg' not found:
	no field package.preload['lpeg']
	no file '/usr/share/lua/5.2/lpeg.lua'
	no file '/usr/share/lua/5.2/lpeg/init.lua'
	no file '/usr/lib64/lua/5.2/lpeg.lua'
	no file '/usr/lib64/lua/5.2/lpeg/init.lua'
	no file './lpeg.lua'
	no file '/usr/lib64/lua/5.2/lpeg.so'
	no file '/usr/lib64/lua/5.2/loadall.so'
	no file './lpeg.so'
stack traceback:
	[C]: in function 'require'
	(command line):1: in main chunk
	[C]: in ?


Expected Results:  
lua -e "require('lpeg')"
should print nothing, load lpeg successfully
Comment 1 Tim Jones 2014-10-04 21:09:28 UTC
Just to be clear, this does not effect only lpeg. It should effect all of these, because they determine their install directory in the same way:
grep -r --include='*.ebuild' /usr/portage/ -e 'INSTALL_CMOD lua'
Comment 2 Dennis Schridde 2015-02-22 13:11:50 UTC
Confirming the issue. V= in the pkgconfig is empty, which is wrong. According to Tim's investigation the fix should be simple.
Comment 3 Dennis Schridde 2015-02-22 13:28:44 UTC
Created attachment 397210 [details, diff]
patch for lua-5.2.3-r1.ebuild

This fixes it.

Keywords=+PATCH
Comment 4 Dennis Schridde 2015-02-22 13:50:00 UTC
Created attachment 397212 [details, diff]
patch for lua-5.2.3-r1.ebuild

Patch using SLOT instead of PATCH_PV.
Comment 5 Dennis Schridde 2015-02-22 13:54:32 UTC
Created attachment 397214 [details, diff]
patch for lua-5.2.3-r1.ebuild

This patch also fixes INSTALL_INC by using a new revision of lua.pc
Comment 6 Dennis Schridde 2015-02-22 13:54:56 UTC
Created attachment 397216 [details, diff]
patch for lua.pc
Comment 7 Dennis Schridde 2015-02-22 14:04:57 UTC
Created attachment 397224 [details, diff]
patch for lua-5.2.3-r1.ebuild
Comment 8 Dennis Schridde 2015-02-22 15:06:17 UTC
See bug #534150 for a proposal how to build against multiple versions of Lua.
Comment 9 Marek Szuba archtester gentoo-dev 2020-09-01 17:09:43 UTC
dev-lang/lpeg-1.0.2 correctly installs its files into /usr/share/lua/x.y/ and /usr/lib64/lua/x.y/ , for both 5.2 and 5.3