Won't build under Ubuntu 11.10 #1

Closed
skorokithakis opened this Issue Apr 25, 2012 · 11 comments

Projects

None yet

2 participants

@skorokithakis
Contributor

Trying to build this under Ubuntu 11.10 with Python 2.7 and Lua 5.1, I get:

building 'lua-python' extension gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.7 -c src/pythoninlua.c -o build/temp.linux-x86_64-2.7/src/pythoninlua.o -rdynamic -I/usr/include/lua5.1 src/pythoninlua.c: In function ‘py_convert’: src/pythoninlua.c:74:3: warning: passing argument 3 of ‘PyString_AsStringAndSize’ from incompatible pointer type [enabled by default] /usr/include/python2.7/stringobject.h:172:17: note: expected ‘Py_ssize_t *’ but argument is of type ‘int *’ src/pythoninlua.c: In function ‘py_object_tostring’: src/pythoninlua.c:335:4: warning: passing argument 3 of ‘PyString_AsStringAndSize’ from incompatible pointer type [enabled by default] /usr/include/python2.7/stringobject.h:172:17: note: expected ‘Py_ssize_t *’ but argument is of type ‘int *’ gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.7 -c src/luainpython.c -o build/temp.linux-x86_64-2.7/src/luainpython.o -rdynamic -I/usr/include/lua5.1 src/luainpython.c:345:2: warning: initialization from incompatible pointer type [enabled by default] src/luainpython.c:345:2: warning: (near initialization for ‘LuaObject_as_mapping.mp_length’) [enabled by default] src/luainpython.c: In function ‘initlua’: src/luainpython.c:496:3: warning: implicit declaration of function ‘luaopen_loadlib’ [-Wimplicit-function-declaration] src/luainpython.c:486:12: warning: variable ‘m’ set but not used [-Wunused-but-set-variable] creating build/lib.linux-x86_64-2.7 gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions build/temp.linux-x86_64-2.7/src/pythoninlua.o build/temp.linux-x86_64-2.7/src/luainpython.o -L/usr/lib/python2.7/config -lpython2.7 -lpthread -lutil -o build/lib.linux-x86_64-2.7/lua-python.so -rdynamic -I/usr/include/lua5.1 building 'lua' extension gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.7 -c src/pythoninlua.c -o build/temp.linux-x86_64-2.7/src/pythoninlua.o -rdynamic -I/usr/include/lua5.1 src/pythoninlua.c: In function ‘py_convert’: src/pythoninlua.c:74:3: warning: passing argument 3 of ‘PyString_AsStringAndSize’ from incompatible pointer type [enabled by default] /usr/include/python2.7/stringobject.h:172:17: note: expected ‘Py_ssize_t *’ but argument is of type ‘int *’ src/pythoninlua.c: In function ‘py_object_tostring’: src/pythoninlua.c:335:4: warning: passing argument 3 of ‘PyString_AsStringAndSize’ from incompatible pointer type [enabled by default] /usr/include/python2.7/stringobject.h:172:17: note: expected ‘Py_ssize_t *’ but argument is of type ‘int *’ gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.7 -c src/luainpython.c -o build/temp.linux-x86_64-2.7/src/luainpython.o -rdynamic -I/usr/include/lua5.1 src/luainpython.c:345:2: warning: initialization from incompatible pointer type [enabled by default] src/luainpython.c:345:2: warning: (near initialization for ‘LuaObject_as_mapping.mp_length’) [enabled by default] src/luainpython.c: In function ‘initlua’: src/luainpython.c:496:3: warning: implicit declaration of function ‘luaopen_loadlib’ [-Wimplicit-function-declaration] src/luainpython.c:486:12: warning: variable ‘m’ set but not used [-Wunused-but-set-variable] gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions build/temp.linux-x86_64-2.7/src/pythoninlua.o build/temp.linux-x86_64-2.7/src/luainpython.o -llua -llualib -o build/lib.linux-x86_64-2.7/lua.so -rdynamic -I/usr/include/lua5.1 /usr/bin/ld: cannot find -llua /usr/bin/ld: cannot find -llualib collect2: ld returned 1 exit status error: command 'gcc' failed with exit status 1

@bastibe
Owner
bastibe commented Apr 25, 2012

It seems that the linker can't find your lua libraries. Do you have lua libraries installed?

@skorokithakis
Contributor

Ugh, I hope I didn't screw this one up. I have liblua5.1-0-dev installed, and I've included it to the path with:

extra_link_args=["-rdynamic", "-I/usr/include/lua5.1"]),

because it couldn't even find lua.h before. Is there something else I need to install?

@bastibe
Owner
bastibe commented Apr 25, 2012

If I remember gcc correctly, you would need to -L/path/to/liblua.so/ as well.

@skorokithakis
Contributor

Hmm, changing it to:

extra_link_args=["-rdynamic", "-I/usr/include/lua5.1", "-L/usr/lib/x86_64-linux-gnu/liblua5.1.so"]),

fixes a few, but it still fails to build:

building 'lua' extension gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.7 -c src/pythoninlua.c -o build/temp.linux-x86_64-2.7/src/pythoninlua.o -rdynamic -I/usr/include/lua5.1 src/pythoninlua.c: In function ‘py_convert’: src/pythoninlua.c:74:3: warning: passing argument 3 of ‘PyString_AsStringAndSize’ from incompatible pointer type [enabled by default] /usr/include/python2.7/stringobject.h:172:17: note: expected ‘Py_ssize_t *’ but argument is of type ‘int *’ src/pythoninlua.c: In function ‘py_object_tostring’: src/pythoninlua.c:335:4: warning: passing argument 3 of ‘PyString_AsStringAndSize’ from incompatible pointer type [enabled by default] /usr/include/python2.7/stringobject.h:172:17: note: expected ‘Py_ssize_t *’ but argument is of type ‘int *’ gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.7 -c src/luainpython.c -o build/temp.linux-x86_64-2.7/src/luainpython.o -rdynamic -I/usr/include/lua5.1 src/luainpython.c:345:2: warning: initialization from incompatible pointer type [enabled by default] src/luainpython.c:345:2: warning: (near initialization for ‘LuaObject_as_mapping.mp_length’) [enabled by default] src/luainpython.c: In function ‘initlua’: src/luainpython.c:496:3: warning: implicit declaration of function ‘luaopen_loadlib’ [-Wimplicit-function-declaration] src/luainpython.c:486:12: warning: variable ‘m’ set but not used [-Wunused-but-set-variable] gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions build/temp.linux-x86_64-2.7/src/pythoninlua.o build/temp.linux-x86_64-2.7/src/luainpython.o -llua -llualib -o build/lib.linux-x86_64-2.7/lua.so -rdynamic -I/usr/include/lua5.1 -L/usr/lib/x86_64-linux-gnu/liblua5.1.so /usr/bin/ld: cannot find -llua /usr/bin/ld: cannot find -llualib collect2: ld returned 1 exit status error: command 'gcc' failed with exit status 1

@bastibe
Owner
bastibe commented Apr 25, 2012

Oh, sorry, don't include the file name in the -L directive. Only the path is needed. (Hence, -L/usr/lib/x86_64-linux-gnu/)

@skorokithakis
Contributor

Nope, still the same :/

@bastibe
Owner
bastibe commented Apr 25, 2012

Hmm, I don't know why gcc is not picking up your libs. I will try to install it on Ubuntu tomorrow (it's late at night where I live). At any rate, this does not seem to be a problem with lunatic-python really, but rather some issue with your build system.

@skorokithakis
Contributor

That's encouraging, at least. I'll install a few other lua libs and see if I can get this to work and comment here, thank you.

@bastibe
Owner
bastibe commented Apr 26, 2012

Alright, I set up my own Ubuntu 12.04 today and tried to compile lunatic-python.

I installed build-essential and liblua5.1-0-dev and python-dev as dependencies

First, it would not find the lua.h headers, since they are installed to /usr/include/lua5.1
Hence, I extended the two extra_compile_args with -I/usr/include/lua5.1.

Then, I got to the error you described, where it would not find the library. The thing is, it is looking for a library called lua, where the actual library is called lua5.1. Just change LUALIBS accordingly, and it should compile.

One of these days, I should update the code to be Lua5.2 compatible...

@skorokithakis
Contributor

Thank you very much, that worked. Would you like me to submit a pull request with the extra compile args (I don't think they'll hurt building on other distros/OSes if they're there?), or maybe a README section?

@bastibe
Owner
bastibe commented Apr 26, 2012

If you want to, that would be completely awesome!

@bastibe bastibe closed this Apr 29, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment