Giter Site home page Giter Site logo

Can't install at Macosx lion about pyjnius HOT 12 CLOSED

kivy avatar kivy commented on July 28, 2024
Can't install at Macosx lion

from pyjnius.

Comments (12)

MLnick avatar MLnick commented on July 28, 2024

Similar issues here. You can get past the above by setting:
library_dirs = ['/System/Library/Frameworks/JavaVM.framework/Libraries']
include_dirs = ['/System/Library/Frameworks/JavaVM.framework/Headers']

and commenting out the relevant assignments further down.
#include_dirs = [
# join(jdk_home, 'include'),
# join(jdk_home, 'include', 'linux')]
#library_dirs = [join(jre_home, 'lib', cpu, )] #'server')]

However, I still get this:

python setup.py build_ext --inplace -f
/usr/local/Cellar/python/2.7.2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'install_requires'
warnings.warn(msg)
running build_ext
cythoning jnius/jnius.pyx to jnius/jnius.c
building 'jnius' extension
/usr/bin/clang -fno-strict-aliasing -fno-common -dynamic -arch i386 -arch x86_64 -Os -w -pipe -march=native -Qunused-arguments -fwrapv -DNDEBUG -g -O3 -Wall -Wstrict-prototypes -I/System/Library/Frameworks/JavaVM.framework/Headers -I/usr/local/Cellar/python/2.7.2/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c jnius/jnius.c -o build/temp.macosx-10.5-intel-2.7/jnius/jnius.o
/usr/bin/clang -bundle -undefined dynamic_lookup -arch i386 -arch x86_64 -isysroot / -L/usr/local/Cellar/readline/6.2.2/lib build/temp.macosx-10.5-intel-2.7/jnius/jnius.o -L/System/Library/Frameworks/JavaVM.framework/Libraries -ljvm -o /Users/Nick/workspace/python/pyjnius/jnius/jnius.so -Wl,-rpath /System/Library/Frameworks/JavaVM.framework/Libraries
ld: warning: ignoring file /System/Library/Frameworks/JavaVM.framework/Libraries/libjvm.dylib, file was built for unsupported file format which is not the architecture being linked (x86_64)

Would be really nice to play around with this but just can't get it to work on Mac OS X

from pyjnius.

MLnick avatar MLnick commented on July 28, 2024

After doing the above, in iPython:

In [1]: from jnius import autoclass

ImportError Traceback (most recent call last)
in ()
----> 1 from jnius import autoclass

/Users/Nick/workspace/python/pyjnius/jnius/init.py in ()
10 version = '1.1-dev'
11
---> 12 from .jnius import *
13 from .reflect import *

ImportError: dlopen(jnius/jnius.so, 2): Symbol not found: _JNI_CreateJavaVM
Referenced from: /Users/Nick/workspace/python/pyjnius/jnius/jnius.so
Expected in: dynamic lookup

from pyjnius.

tito avatar tito commented on July 28, 2024

Can you retry the compilation with the 64 bits Python?
It look like your're using the 32 bits version, and the libjvm is 64 bits.

Or the inverse, use a 32 bits jvm instead :)

from pyjnius.

MLnick avatar MLnick commented on July 28, 2024

I'm using 64-bit Python. Forcing it:

arch -x86_64 python setup.py build_ext --inplac
e -f
/usr/local/Cellar/python/2.7.2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'install_requires'
warnings.warn(msg)
running build_ext
cythoning jnius/jnius.pyx to jnius/jnius.c
building 'jnius' extension
/usr/bin/clang -fno-strict-aliasing -fno-common -dynamic -arch i386 -arch x86_64 -Os -w -pipe -march=native -Qunused-arguments -fwrapv -DNDEBUG -g -O3 -Wall -Wstrict-prototypes -I/System/Library/Frameworks/JavaVM.framework/Headers -I/usr/local/Cellar/python/2.7.2/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c jnius/jnius.c -o build/temp.macosx-10.5-intel-2.7/jnius/jnius.o
/usr/bin/clang -bundle -undefined dynamic_lookup -arch i386 -arch x86_64 -isysroot / -L/usr/local/Cellar/readline/6.2.2/lib build/temp.macosx-10.5-intel-2.7/jnius/jnius.o -L/System/Library/Frameworks/JavaVM.framework/Libraries -ljvm -o /Users/Nick/workspace/python/pyjnius/jnius/jnius.so -Wl,-rpath /System/Library/Frameworks/JavaVM.framework/Libraries
ld: warning: ignoring file /System/Library/Frameworks/JavaVM.framework/Libraries/libjvm.dylib, file was built for unsupported file format which is not the architecture being linked (x86_64)

I will see if I can get a 32-bit JVM to work. But still not quite getting why it's not working.

from pyjnius.

tito avatar tito commented on July 28, 2024

Ok, maybe the jvm is already 32 bits then, and you're using a 64 bits python?
Try with 32bits python?

from pyjnius.

ytwu avatar ytwu commented on July 28, 2024

Hi tito, you can try to down load JDK from :
http://www.oracle.com/technetwork/java/javase/downloads/jdk7u7-downloads-1836413.html

and recompile it with

10:~ ytwu$ echo $JDK_HOME
/Library/Java/JavaVirtualMachines/jdk1.7.0_07.jdk/Contents/Home
10:~ ytwu$ echo $JRE_HOME
/Library/Java/JavaVirtualMachines/jdk1.7.0_07.jdk/Contents/Home/jre

Modified below in setup.py:

library_dirs = ['/Library/Java/JavaVirtualMachines/jdk1.7.0_07.jdk/Contents/Home/jre/lib/
include_dirs = ['/Library/Java/JavaVirtualMachines/jdk1.7.0_07.jdk/Contents/Home/include

you should be able to get jnius work on mac lion.

from pyjnius.

allfro avatar allfro commented on July 28, 2024

Hi

You can try this pull request: #42.

from pyjnius.

dreampuf avatar dreampuf commented on July 28, 2024

@allfro I have use request. And it's could compile. But it throw an exception:

jnius/jnius.c:20472: error: expected ‘)’ before ‘val’
lipo: can't figure out the architecture type of: /var/folders/sr/m9lk94tn4x75p8nyg6dm31cr0000gn/T//ccyyZWp7.out
error: command 'gcc-4.2' failed with exit status 1
make: *** [build_ext] Error 1

env : mac osx lion
java version "1.7.0_06"
Java(TM) SE Runtime Environment (build 1.7.0_06-b24)
Java HotSpot(TM) 64-Bit Server VM (build 23.2-b09, mixed mode)

from pyjnius.

allfro avatar allfro commented on July 28, 2024

@dreampuf do 'man python' for instructions on how to make your version of python run in 32-bit mode.

from pyjnius.

dreampuf avatar dreampuf commented on July 28, 2024

@allfro It's must 32-bit mode? I have try VERSIONER_PYTHON_PREFER_32_BIT=yes python setup.py build_ext, and fail again.

from pyjnius.

allfro avatar allfro commented on July 28, 2024

Not sure but I wanted to see what would happen. Did you download the latest of pyjnius and apple jvm? Did you compile from fresh sources?

from pyjnius.

dreampuf avatar dreampuf commented on July 28, 2024

@allfro I don't know what's wrong of environment.
I pull the lastest version of pyjnius and use the openjdk with osx build(http://code.google.com/p/openjdk-osx-build/).

I think my environment is broken (I'm use the homebrew and customize install path prefix of it's).
now, I have some lib was install in /usr/lib, and some one else was /myhomebrewpath/lib.
I can't install some normally python module(like scipy) manually.I need install it by DMG package, but DMG path can't customize..........

Finally, I decide to use the VM to try these.

from pyjnius.

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.