Comments (12)
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.
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.
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.
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.
Ok, maybe the jvm is already 32 bits then, and you're using a 64 bits python?
Try with 32bits python?
from pyjnius.
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.
Hi
You can try this pull request: #42.
from pyjnius.
@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.
@dreampuf do 'man python' for instructions on how to make your version of python run in 32-bit mode.
from pyjnius.
@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.
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.
@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)
- ClassNotFoundException for android.media.midi.MidiManager.OnDeviceOpenedListener HOT 3
- unexpected error for jdk17 HOT 4
- Crashes on Apple M1 HOT 27
- How to add everything under M2 repository to pyjnius classpath? HOT 2
- DeprecationWarning: pkg_resources is deprecated as an API
- pyjnius build error, still coming HOT 10
- Including a JAR on Android HOT 2
- Support mail address is broken HOT 2
- OverflowError: value too large to convert to jshort HOT 4
- How to create Webview with FileChooser HOT 1
- Moderinze `java` code? HOT 2
- installation documentation could be refreshed HOT 3
- Usage without JDK HOT 6
- AttributeError: 'Class' object has no attribute '_JavaClass__cls_storage' HOT 4
- Running python script on Android but in Docker container HOT 1
- Getting a pointer to JavaVM
- Dependency Dashboard
- No jvm.dll found HOT 3
- Unrecognized option: --add-exports / --add-opens HOT 2
- JVM exception: Verifier rejected class … Constructor returning without calling superclass constructor
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pyjnius.