Permalink
Browse files

Fix for cygwin setup on 64 bit. (#302)

  • Loading branch information...
Thrameos authored and marscher committed Mar 28, 2018
1 parent 72ac687 commit 205d9ff98ef109fdf039a3b6e1e8da5c2eb8e38f
Showing with 76 additions and 42 deletions.
  1. +43 −30 appveyor.yml
  2. +20 −1 appveyor/install.sh
  3. +5 −0 appveyor/runTestsuite.sh
  4. +0 −1 native/common/include/jp_utility.h
  5. +5 −7 native/common/include/jpype.h
  6. +3 −3 setup.py
View
@@ -6,64 +6,77 @@ environment:
CMD_IN_ENV: "cmd /E:ON /V:ON /C .\\appveyor\\run_with_env.cmd"
ANT_HOME: "C:\\ProgramData\\chocolatey\\lib\\ant\\apache-ant-1.10.1"
NUMPY_: "numpy x.x"
JAVA_HOME: "C:\\jdk8"
CINST_OPTS:
matrix:
- PYTHON: "python3"
CYGWIN: "C:\\cygwin"
JAVA_HOME: "C:\\Program Files (x86)\\Java\\jdk1.8.0"
ARCH: x86
CYGSH: C:\Cygwin\bin\bash -c
- PYTHON: "python2"
CYGWIN: "C:\\cygwin64"
JAVA_HOME: "C:\\Program Files\\Java\\jdk1.8.0"
ARCH: x86_64
CYGSH: C:\Cygwin64\bin\bash -c
## This one is failing from gcc died with sig 11.
## This error is apparently common when building python 2 modules with cygwin32.
## The failure depends on the windows version and will cause a failure
## on appveyor depending on which image is used.
## We will disable it for now
#
# - PYTHON: "python2"
# CYGWIN: "C:\\cygwin"
# ARCH: x86
# CYGSH: C:\Cygwin\bin\bash -c
## This one is failing due to a segfault when executing the first test in
## the test suite. We have been unable to replicate it outside of appveyor
## We will disable it for now
#
# - PYTHON: "python3"
# CYGWIN: "C:\\cygwin"
# ARCH: x86
# CYGSH: C:\Cygwin\bin\bash -c
# CINST_OPTS: --x86
## Python 2 on this platform is failing in the multi-threaded test.
## It is not clear if the issue is with the python build or incorrect
## locking code in jpype.
## We will disable it for now
# - PYTHON: "python2"
# CYGWIN: "C:\\cygwin64"
# ARCH: x86_64
# CYGSH: C:\Cygwin64\bin\bash -c
- PYTHON: "python3"
CYGWIN: "C:\\cygwin64"
JAVA_HOME: "C:\\Program Files\\Java\\jdk1.8.0"
ARCH: x86_64
ARCH: x86_64
CYGSH: C:\Cygwin64\bin\bash -c
- PYTHON: "C:\\Miniconda"
CONDA_PY: "2.7"
JAVA_HOME: "C:\\Program Files (x86)\\Java\\jdk1.8.0"
- PYTHON: "C:\\Miniconda-x64"
CONDA_PY: "2.7"
JAVA_HOME: "C:\\Program Files\\Java\\jdk1.8.0"
ARCH: "64"
- PYTHON: "C:\\Miniconda3"
CONDA_PY: "3.5"
JAVA_HOME: "C:\\Program Files (x86)\\Java\\jdk1.8.0"
- PYTHON: "C:\\Miniconda3-x64"
CONDA_PY: "3.6"
JAVA_HOME: "C:\\Program Files\\Java\\jdk1.8.0"
ARCH: "64"
- PYTHON: "C:\\Miniconda3-x64"
CONDA_PY: "3.6"
JAVA_HOME: "C:\\Program Files\\Java\\jdk1.8.0"
ARCH: "64"
NUMPY_: "python"
## This one is failing from gcc died with sig 11.
## This error is apparently common when building python 2 modules with cygwin32.
## The failure depends on the windows version and will cause a failure
## on appveyor depending on which image is used.
## We will disable it for now
#
# - PYTHON: "python2"
# CYGWIN: "C:\\cygwin"
# JAVA_HOME: "C:\\Program Files (x86)\\Java\\jdk1.8.0"
# ARCH: x86
# CYGSH: C:\Cygwin\bin\bash -c
install:
- cinst ant
# Force java to be installed where JAVA_HOME points
# We can install and test multiple versions of java here
# - We will have to move the JAVA_HOME and the build of the harness to the test section.
# - We will need to figure out how to run nose multiple times on the same run so that
# we can get the result from each of the java version runs.
#
- cinst jdk8 -params 'installdir=C:\\jdk8' %CINST_OPTS%
# - cinst jdk7 -params 'installdir=C:\\jdk7'
# - cinst jdk9 -version 9.0.4.11 -params 'installdir=C:\\jdk9'
- cinst ant %CINST_OPTS%
# Add thinges to path
- "SET PATH=%PYTHON%;%PYTHON%\\Scripts;%ANT_HOME%\\bin;%PATH%"
View
@@ -1,10 +1,21 @@
# Setup cygwin path
export PATH="$ANT_BIN/bin:/bin:/usr/bin"
export PATH="/bin:/usr/bin:$PATH"
echo JAVA_HOME=$JAVA_HOME
echo ARCH=$ARCH
echo PATH=$PATH
echo PYTHON=$PYTHON
echo ANT_HOME=$ANT_HOME
# If we do not have Java installed we can't proceed
if [ ! -d "$JAVA_HOME" ]; then
echo "JAVA_HOME is not valid"
exit -1
fi
# Make sure the jvm.dll is where it should be
find "$JAVA_HOME" -name "jvm.dll"
# Define programs
SETUP=/setup-$ARCH
@@ -30,6 +41,12 @@ $EASYINSTALL mock
echo "==== Check versions"
"$ANT_HOME"/bin/ant -version
$PYTHON --version
$JAVA_HOME/bin/java.exe -version
echo "==== Check architectures"
file -L `which $PYTHON`
file -L $JAVA_HOME/bin/java.exe
file -L `find $JAVA_HOME -name "jvm.dll"`
echo "==== Check modules"
$PYTHON -c 'import pip; print(sorted(["%s==%s" % (i.key, i.version) for i in pip.get_installed_distributions()]))'
@@ -46,3 +63,5 @@ echo "==== Build test"
echo "==== Build module"
$PYTHON setup.py install
echo "==== Verify jvm.dll found"
$PYTHON -c "import jpype; print(jpype.getDefaultJVMPath())"
View
@@ -13,4 +13,9 @@ $NOSETESTS -v --with-xunit --all-modules -s test.jpypetest
status=$?
echo "result code of nosetests:" $status
# Even if the nose gave a 0, we better have a result to upload.
if [ ! -e nosetests.xml ]; then
exit -1
fi
exit $status
@@ -17,7 +17,6 @@
#ifndef _JPYPE_UTILITY_H_
#define _JPYPE_UTILITY_H_
#include <jni.h>
#define RAISE(exClass, msg) { throw exClass(msg, __FILE__, __LINE__); }
@@ -74,20 +74,18 @@
#ifdef WIN32
#if defined(__CYGWIN__)
// jni_md.h does not work for cygwin. Use this instead.
#define _JAVASOFT_JNI_MD_H_
#define JNIEXPORT __declspec(dllexport)
#define JNIIMPORT __declspec(dllimport)
#define JNICALL __stdcall
typedef int jint;
typedef long long jlong;
typedef signed char jbyte;
//#define _JAVASOFT_JNI_MD_H_
//#define JNIEXPORT __declspec(dllexport)
//#define JNIIMPORT __declspec(dllimport)
#elif defined(__GNUC__)
// JNICALL causes problem for function prototypes .. since I am not defining any JNI methods there is no need for it
#undef JNICALL
#define JNICALL
#endif
#endif
#include <jni.h>
#if PY_MAJOR_VERSION >= 3
// Python 3
#define PyInt_FromLong PyLong_FromLong
View
@@ -51,22 +51,22 @@ def find_sources():
# try to include JNI first from eventually given JAVA_HOME, then from distributed
java_home = os.getenv('JAVA_HOME', '')
found_jni = False
if os.path.exists(java_home):
if os.path.exists(java_home) and sys.platform !="cygwin":
platform_specific['include_dirs'] += [os.path.join(java_home, 'include')]
# check if jni.h can be found
for d in platform_specific['include_dirs']:
if os.path.exists(os.path.join(d, 'jni.h')):
print("Found native jni.h at %s"%d)
found_jni = True
break
if not found_jni:
import warnings
warnings.warn('Falling back to provided JNI headers, since your provided'
' JAVA_HOME "%s" does not provide jni.h' % java_home)
platform_specific['include_dirs'] += [fallback_jni]
else:
if not found_jni:
platform_specific['include_dirs'] += [fallback_jni]
if sys.platform == 'win32':

0 comments on commit 205d9ff

Please sign in to comment.