Neopallium / lua-zmq

Lua zeromq2 binding
http://github.com/Neopallium/lua-zmq
MIT License
153 stars 36 forks source link

luarocks install fails #23

Closed dustingooding closed 12 years ago

dustingooding commented 12 years ago
$ sudo luarocks install lua-zmq
Installing http://luarocks.org/repositories/rocks/lua-zmq-1.1-1.src.rock...
Archive:  /tmp/luarocks_luarocks-rock-lua-zmq-1.1-1-3981/lua-zmq-1.1-1.src.rock
  inflating: lua-zmq-1.1-1.rockspec  
   creating: lua-zmq/
  inflating: lua-zmq/CMakeLists.txt  
  inflating: lua-zmq/README.windows.md  
   creating: lua-zmq/cmake/
  inflating: lua-zmq/cmake/LuaNativeObjects.cmake  
   creating: lua-zmq/perf/
  inflating: lua-zmq/perf/remote_thr.lua  
  inflating: lua-zmq/perf/remote_lat.lua  
  inflating: lua-zmq/perf/local_lat.lua  
   creating: lua-zmq/perf/no_msg/
  inflating: lua-zmq/perf/no_msg/remote_thr.lua  
  inflating: lua-zmq/perf/no_msg/remote_lat.lua  
  inflating: lua-zmq/perf/no_msg/local_lat.lua  
  inflating: lua-zmq/perf/no_msg/local_thr.lua  
  inflating: lua-zmq/perf/thread_push_pull.lua  
  inflating: lua-zmq/perf/local_pull.lua  
  inflating: lua-zmq/perf/thread_lat.lua  
  inflating: lua-zmq/perf/remote_multipart.lua  
  inflating: lua-zmq/perf/local_thr.lua  
  inflating: lua-zmq/perf/local_multipart.lua  
  inflating: lua-zmq/perf/thread_thr.lua  
  inflating: lua-zmq/perf/remote_push.lua  
  inflating: lua-zmq/zmq.nobj.lua    
  inflating: lua-zmq/API.md          
   creating: lua-zmq/examples/
  inflating: lua-zmq/examples/server_multipart.lua  
  inflating: lua-zmq/examples/publiser.lua  
  inflating: lua-zmq/examples/server.lua  
  inflating: lua-zmq/examples/client.lua  
  inflating: lua-zmq/examples/client_multipart.lua  
  inflating: lua-zmq/examples/ev_subscriber.lua  
  inflating: lua-zmq/examples/subscriber.lua  
   creating: lua-zmq/rockspecs/
  inflating: lua-zmq/rockspecs/lua-zmq-threads-1.1-1.rockspec  
  inflating: lua-zmq/rockspecs/lua-zmq-scm-1.rockspec  
  inflating: lua-zmq/rockspecs/lua-zmq-threads-1.0-1.rockspec  
  inflating: lua-zmq/rockspecs/lua-zmq-1.1-1.rockspec  
  inflating: lua-zmq/rockspecs/lua-zmq-threads-scm-0.rockspec  
  inflating: lua-zmq/rockspecs/lua-zmq-1.0-1.rockspec  
  inflating: lua-zmq/README.md       
   creating: lua-zmq/src/
  inflating: lua-zmq/src/ctx.nobj.lua  
  inflating: lua-zmq/src/socket.nobj.lua  
  inflating: lua-zmq/src/msg.nobj.lua  
  inflating: lua-zmq/src/error.nobj.lua  
  inflating: lua-zmq/src/pre_generated-zmq.nobj.c  
  inflating: lua-zmq/src/threads.lua  
  inflating: lua-zmq/src/poller.lua  
  inflating: lua-zmq/src/poller.nobj.lua  
  inflating: lua-zmq/src/stopwatch.nobj.lua  
gcc -O2 -I/usr/include/lua5.1 -c src/pre_generated-zmq.nobj.c -o src/pre_generated-zmq.nobj.o -I/usr/include
gcc -shared -o zmq.so -L/usr/local/lib src/pre_generated-zmq.nobj.o -L/usr/lib -lzmq
/usr/bin/ld: src/pre_generated-zmq.nobj.o: relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
src/pre_generated-zmq.nobj.o: could not read symbols: Bad value
collect2: ld returned 1 exit status
cp: cannot stat `zmq.so': No such file or directory

Error: Build error: Failed installing zmq.so in /usr/local/lib/luarocks/rocks/lua-zmq/1.1-1/lib
System info:
$ uname -a
Linux wall-e 3.0.0-12-server #20-Ubuntu SMP Fri Oct 7 16:36:30 UTC 2011 x86_64 x86_64 x86_64 GNU/Linux
$ apt-show-versions | grep lua
liblua5.1-0/oneiric uptodate 5.1.4-10
liblua5.1-0-dev/oneiric uptodate 5.1.4-10
liblua50/oneiric uptodate 5.0.3-6
liblualib50/oneiric uptodate 5.0.3-6
lua5.1/oneiric uptodate 5.1.4-10
luarocks/oneiric uptodate 2.0.2-1
luatex/oneiric uptodate 0.70.1-1
texlive-luatex/oneiric uptodate 2009-13
$ apt-show-versions | grep zmq
libzmq-dev/oneiric uptodate 2.1.9-1
libzmq1/oneiric uptodate 2.1.9-1
python-zmq/oneiric uptodate 2.1.9-1
Neopallium commented 12 years ago

You need to create a config file for luarocks (/etc/luarocks/config.lua): variables = { CFLAGS = " -fPIC -march=native -O3 -g -pipe ", -- I also recommend these variables: CMAKE_BUILD_TYPE = "Release", CMAKE = "cmake", }

That is what I have in my config file. The important flag is the "-fPIC" one, I don't know why luarocks doesn't add that flag itself.