Public bug reported:

...and because luarocks hardcodes an x86_64 workaround for lua.org
upstream's non-pic brain damage ("it works on i386!"), the luarocks
workaround is undone by luarocks.deb lying to it about the architecture.

The exact bug is present in Debian, except inverted: the architecture is
hardcoded to x86_64. I forget, is that "grave"? Should I file there too?

$ luarocks build lpack
[...]
gcc -O2 -I/usr/include/lua5.1 -c lpack.c -o lpack.o
gcc -shared -o pack.so -L/usr/local/lib lpack.o
/usr/bin/ld: lpack.o: relocation R_X86_64_32S against `.rodata' can not be used 
when making a shared object; recompile with -fPIC
lpack.o: could not read symbols: Bad value

$ grep fPIC /usr/share/lua/5.1/luarocks/cfg.lua
if proc == "x86_64" and not defaults.variables.CFLAGS:match("-fPIC") then
   defaults.variables.CFLAGS = defaults.variables.CFLAGS.." -fPIC

$ grep UNAME_M /usr/share/lua/5.1/luarocks/config.lua
LUAROCKS_UNAME_M=[[i686]]
$ uname -m
x86_64

$ grep -A 10 proper /usr/share/lua/5.1/luarocks/cfg.lua
-- A proper installation of LuaRocks will hardcode the system
-- and proc values with config.LUAROCKS_UNAME_S and config.LUAROCKS_UNAME_M,
-- so that this detection does not run every time. When it is
-- performed, we use the Unix way to identify the system,
-- even on Windows (assuming UnxUtils or Cygwin).
system = config.LUAROCKS_UNAME_S or io.popen("uname -s"):read("*l")
proc = config.LUAROCKS_UNAME_M or io.popen("uname -m"):read("*l")
if proc:match("i[%d]86") then
   proc = "x86"
elseif proc:match("amd64") or proc:match("x86_64") then
   proc = "x86_64"

$ # So if we simply remove the i686 line from config.lua, luarocks will
get the architecture right. Feel free to set it in /etc in postinst
instead....

$ # apply attached patch directly to /usr/share/lib/lua5.1 because I'm
grumpy

$ luarocks build lpack
Archive:  
/tmp/luarocks_luarocks-rock-lpack-20070629-1-760/lpack-20070629-1.src.rock
  inflating: lpack-20070629-1.rockspec  
 extracting: lpack.tar.gz            
Do not use 'module' as a build type. Use 'builtin' instead.
gcc -O2 -fPIC -I/usr/include/lua5.1 -c lpack.c -o lpack.o
gcc -shared -o pack.so -L/usr/local/lib lpack.o
$ # Installation works as well.

ProblemType: Bug
DistroRelease: Ubuntu 11.10
Package: luarocks 2.0.2-1
ProcVersionSignature: Ubuntu 3.0.0-15.26-generic 3.0.13
Uname: Linux 3.0.0-15-generic x86_64
NonfreeKernelModules: fglrx
ApportVersion: 1.23-0ubuntu4
Architecture: amd64
Date: Sat Jan 28 16:00:09 2012
InstallationMedia: Ubuntu 11.10 "Oneiric Ocelot" - Release amd64 (20111012)
PackageArchitecture: all
ProcEnviron:
 PATH=(custom, user)
 LANG=en_US.UTF-8
 SHELL=/bin/bash
SourcePackage: luarocks
UpgradeStatus: No upgrade log present (probably fresh install)

** Affects: luarocks (Ubuntu)
     Importance: Undecided
         Status: New


** Tags: amd64 apport-bug oneiric

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/923161

Title:
  Hardcoded i686 architecture breaks x86_64 builds

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/luarocks/+bug/923161/+subscriptions

-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to