Giter Club home page Giter Club logo

Comments (11)

scoder avatar scoder commented on August 30, 2024

Impossible to say why this fails. Most steps seem to have worked: it built correctly, it imported, it (apparently) loaded the shared LuaJIT library - and then fails trying to initialise the LuaJIT runtime. Lua(JIT) doesn't provide any information at this point why it failed, so there isn't much of a way to make Lupa provide debug information here.

Does LuaJIT itself run on your machine?

from lupa.

bwesterb avatar bwesterb commented on August 30, 2024
$ luajit
LuaJIT 2.0.1 -- Copyright (C) 2005-2013 Mike Pall. http://luajit.org/
JIT: ON CMOV SSE2 SSE3 SSE4.1 fold cse dce fwd dse narrow loop abc sink fuse
> = 1+1
2

from lupa.

bwesterb avatar bwesterb commented on August 30, 2024

That seems to be a newer version than I tried before. However, the problem is still the same.

$ sudo pip-2.7 install lupa
Downloading/unpacking lupa
  Downloading lupa-0.20.tar.gz (119kB): 119kB downloaded
  Running setup.py egg_info for package lupa
    building with Cython 0.19.1
    No local build of LuaJIT2 found in lupa directory, checking for installed library using pkg-config
    pkg-config found LuaJIT version 2.0.1


Installing collected packages: lupa
  Running setup.py install for lupa
    building with Cython 0.19.1
    No local build of LuaJIT2 found in lupa directory, checking for installed library using pkg-config
    pkg-config found LuaJIT version 2.0.1

    skipping 'lupa/_lupa.c' Cython extension (up-to-date)
    building 'lupa._lupa' extension
    /usr/bin/clang -fno-strict-aliasing -fno-common -dynamic -arch x86_64 -arch i386 -pipe -O2 -fwrapv -arch x86_64 -arch i386 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/opt/local/include/luajit-2.0 -I/opt/local/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c lupa/_lupa.c -o build/temp.macosx-10.8-intel-2.7/lupa/_lupa.o
    lupa/_lupa.c:9253:14: warning: explicitly assigning a variable of type 'PyObject *' (aka 'struct _object *') to itself [-Wself-assign]
      __pyx_self = __pyx_self;
      ~~~~~~~~~~ ^ ~~~~~~~~~~
    lupa/_lupa.c:9331:14: warning: explicitly assigning a variable of type 'PyObject *' (aka 'struct _object *') to itself [-Wself-assign]
      __pyx_self = __pyx_self;
      ~~~~~~~~~~ ^ ~~~~~~~~~~
    2 warnings generated.
    lupa/_lupa.c:9253:14: warning: explicitly assigning a variable of type 'PyObject *' (aka 'struct _object *') to itself [-Wself-assign]
      __pyx_self = __pyx_self;
      ~~~~~~~~~~ ^ ~~~~~~~~~~
    lupa/_lupa.c:9331:14: warning: explicitly assigning a variable of type 'PyObject *' (aka 'struct _object *') to itself [-Wself-assign]
      __pyx_self = __pyx_self;
      ~~~~~~~~~~ ^ ~~~~~~~~~~
    2 warnings generated.
    /usr/bin/clang -bundle -undefined dynamic_lookup -arch x86_64 -arch i386 -isysroot / -L/opt/local/lib -L/opt/local/lib/db46 -arch x86_64 -arch i386 build/temp.macosx-10.8-intel-2.7/lupa/_lupa.o -L/opt/local/lib -lluajit-5.1 -o build/lib.macosx-10.8-intel-2.7/lupa/_lupa.so
    ld: warning: ignoring file /opt/local/lib/libluajit-5.1.dylib, file was built for unsupported file format ( 0xcf 0xfa 0xed 0xfe 0x 7 0x 0 0x 0 0x 1 0x 3 0x 0 0x 0 0x 0 0x 6 0x 0 0x 0 0x 0 ) which is not the architecture being linked (i386): /opt/local/lib/libluajit-5.1.dylib

Successfully installed lupa
Cleaning up...
$ python
Python 2.7.5 (default, May 24 2013, 16:30:10) 
[GCC 4.2.1 Compatible Apple Clang 4.0 ((tags/Apple/clang-421.0.57))] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from lupa import LuaRuntime
>>> lua = LuaRuntime()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "_lupa.pyx", line 116, in lupa._lupa.LuaRuntime.__cinit__ (lupa/_lupa.c:2237)
lupa._lupa.LuaError: Failed to initialise Lua runtime
>>>

from lupa.

scoder avatar scoder commented on August 30, 2024

This might give a hint:

ld: warning: ignoring file /opt/local/lib/libluajit-5.1.dylib, file was built for unsupported file format ( 0xcf 0xfa 0xed 0xfe 0x 7 0x 0 0x 0 0x 1 0x 3 0x 0 0x 0 0x 0 0x 6 0x 0 0x 0 0x 0 ) which is not the architecture being linked (i386): /opt/local/lib/libluajit-5.1.dylib

Can you try building only for 64 bits by setting ARCHFLAGS="-arch x86_64" ?

You're using a 64 bit Python, right?

from lupa.

bwesterb avatar bwesterb commented on August 30, 2024
$ ARCHFLAGS="-arch x86_64" pip-2.7 install lupa
Downloading/unpacking lupa
  Downloading lupa-0.20.tar.gz (119kB): 119kB downloaded
  Running setup.py egg_info for package lupa
    building with Cython 0.19.1
    No local build of LuaJIT2 found in lupa directory, checking for installed library using pkg-config
    pkg-config found LuaJIT version 2.0.1


Installing collected packages: lupa
  Running setup.py install for lupa
    building with Cython 0.19.1
    No local build of LuaJIT2 found in lupa directory, checking for installed library using pkg-config
    pkg-config found LuaJIT version 2.0.1

    skipping 'lupa/_lupa.c' Cython extension (up-to-date)
    building 'lupa._lupa' extension
    /usr/bin/clang -fno-strict-aliasing -fno-common -dynamic -pipe -O2 -fwrapv -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -arch x86_64 -I/opt/local/include/luajit-2.0 -I/opt/local/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c lupa/_lupa.c -o build/temp.macosx-10.8-intel-2.7/lupa/_lupa.o
    lupa/_lupa.c:9253:14: warning: explicitly assigning a variable of type 'PyObject *' (aka 'struct _object *') to itself [-Wself-assign]
      __pyx_self = __pyx_self;
      ~~~~~~~~~~ ^ ~~~~~~~~~~
    lupa/_lupa.c:9331:14: warning: explicitly assigning a variable of type 'PyObject *' (aka 'struct _object *') to itself [-Wself-assign]
      __pyx_self = __pyx_self;
      ~~~~~~~~~~ ^ ~~~~~~~~~~
    2 warnings generated.
    /usr/bin/clang -bundle -undefined dynamic_lookup -isysroot / -L/opt/local/lib -L/opt/local/lib/db46 -arch x86_64 build/temp.macosx-10.8-intel-2.7/lupa/_lupa.o -L/opt/local/lib -lluajit-5.1 -o build/lib.macosx-10.8-intel-2.7/lupa/_lupa.so

Successfully installed lupa
Cleaning up...
$ python
Python 2.7.5 (default, May 24 2013, 16:30:10) 
[GCC 4.2.1 Compatible Apple Clang 4.0 ((tags/Apple/clang-421.0.57))] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> 
>>> from lupa import LuaRuntime
>>> lua = LuaRuntime()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "_lupa.pyx", line 116, in lupa._lupa.LuaRuntime.__cinit__ (lupa/_lupa.c:2237)
lupa._lupa.LuaError: Failed to initialise Lua runtime

from lupa.

scoder avatar scoder commented on August 30, 2024

ISTM that in your last build attempt it didn't rebuild LuaJIT, just Lupa itself. Could you try a completely clean build with 64bit archflags?

from lupa.

dubois avatar dubois commented on August 30, 2024

You're running into this issue (documented http://luajit.org/install.html):

"If you're building a 64 bit application on OSX which links directly or indirectly against LuaJIT, you need to link your main executable with these flags:
-pagezero_size 10000 -image_base 100000000
Also, it's recommended to rebase all (self-compiled) shared libraries which are loaded at runtime on OSX/x64 (e.g. C extension modules for Lua). See: man rebase"

Save yourself a lot of headaches and build lupa against lua51 instead.

from lupa.

bwesterb avatar bwesterb commented on August 30, 2024

Rebase does not seem to make a difference.

( command rebase -low_address 10000 -high_address 100010000 _lupa.so )

How do I instruct pip/setuptools to build lupa against lua51?

from lupa.

dubois avatar dubois commented on August 30, 2024

The executable itself (python) must be linked with those flags. That's why
it's a pain in the butt.

from lupa.

dubois avatar dubois commented on August 30, 2024

Oh, and lupa 0.21 now comes with a setup.py flag "--no-luajit" (if I
remember correctly). For 0.20, hacking setup.py also works.

from lupa.

scoder avatar scoder commented on August 30, 2024

Closing as this is an issue with the user local setup. When built properly, it shouldn't occur. I'd accept pull requests that make the build more robust, though.

from lupa.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.