Add -jvm-destructor to fix jacop-related crashes (bz 1858054)
- Remove RHEL 6 support
This commit is contained in:
parent
e94e7ae597
commit
25a9051f10
64
mp-jvm-destructor.patch
Normal file
64
mp-jvm-destructor.patch
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
--- mp-7fd4828c934fccf7367499c9e01cc9a1e90a2093/solvers/jacop/java.cc.orig 2020-03-03 23:39:58.000000000 -0700
|
||||||
|
+++ mp-7fd4828c934fccf7367499c9e01cc9a1e90a2093/solvers/jacop/java.cc 2021-01-15 14:48:04.231938853 -0700
|
||||||
|
@@ -119,7 +119,7 @@ std::string RegKey::GetStrValue(fmt::CSt
|
||||||
|
|
||||||
|
namespace mp {
|
||||||
|
|
||||||
|
-JVM JVM::instance_;
|
||||||
|
+JVM *JVM::instance_;
|
||||||
|
|
||||||
|
void Env::Throw(jthrowable exception, const char *method_name) {
|
||||||
|
env_->ExceptionClear();
|
||||||
|
@@ -190,8 +190,16 @@ JVM::~JVM() {
|
||||||
|
jvm_->DestroyJavaVM();
|
||||||
|
}
|
||||||
|
|
||||||
|
+void JVM::cleanup_jvm()
|
||||||
|
+{
|
||||||
|
+ if (instance_) {
|
||||||
|
+ delete instance_;
|
||||||
|
+ instance_ = nullptr;
|
||||||
|
+ }
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
Env JVM::env(const char *const *options) {
|
||||||
|
- if (!instance_.jvm_) {
|
||||||
|
+ if (!instance_) {
|
||||||
|
#ifdef _WIN32
|
||||||
|
std::string runtime_lib_path;
|
||||||
|
bool exists = false;
|
||||||
|
@@ -251,15 +259,19 @@ Env JVM::env(const char *const *options)
|
||||||
|
}
|
||||||
|
vm_args.nOptions = static_cast<jint>(jvm_options.size());
|
||||||
|
vm_args.options = &jvm_options[0];
|
||||||
|
+ instance_ = new JVM();
|
||||||
|
void *envp = 0;
|
||||||
|
- jint result = JNI_CreateJavaVM(&instance_.jvm_, &envp, &vm_args);
|
||||||
|
+ jint result = JNI_CreateJavaVM(&instance_->jvm_, &envp, &vm_args);
|
||||||
|
if (result != JNI_OK) {
|
||||||
|
+ delete instance_;
|
||||||
|
+ instance_ = nullptr;
|
||||||
|
throw JavaError(fmt::format(
|
||||||
|
"Java VM initialization failed, error code = {}", result));
|
||||||
|
}
|
||||||
|
- instance_.env_ = Env(static_cast<JNIEnv*>(envp));
|
||||||
|
+ instance_->env_ = Env(static_cast<JNIEnv*>(envp));
|
||||||
|
+ std::atexit(cleanup_jvm);
|
||||||
|
}
|
||||||
|
- return instance_.env_;
|
||||||
|
+ return instance_->env_;
|
||||||
|
}
|
||||||
|
|
||||||
|
ClassBase::~ClassBase() {}
|
||||||
|
--- mp-7fd4828c934fccf7367499c9e01cc9a1e90a2093/solvers/jacop/java.h.orig 2020-03-03 23:39:58.000000000 -0700
|
||||||
|
+++ mp-7fd4828c934fccf7367499c9e01cc9a1e90a2093/solvers/jacop/java.h 2021-01-15 14:33:39.263164981 -0700
|
||||||
|
@@ -215,7 +215,8 @@ class JVM {
|
||||||
|
private:
|
||||||
|
JavaVM *jvm_;
|
||||||
|
Env env_;
|
||||||
|
- static JVM instance_;
|
||||||
|
+ static JVM *instance_;
|
||||||
|
+ static void cleanup_jvm();
|
||||||
|
|
||||||
|
JVM() : jvm_() {}
|
||||||
|
~JVM();
|
95
mp.spec
95
mp.spec
@ -1,9 +1,5 @@
|
|||||||
%global __cmake_in_source_build 1
|
%global __cmake_in_source_build 1
|
||||||
|
|
||||||
# 'libmp.so' from 'gmp' conflicts with same library provided by this package.
|
|
||||||
# mp's libraries are so installed in a private directory on epel6.
|
|
||||||
# https://lists.centos.org/pipermail/centos-devel/2016-June/014820.html
|
|
||||||
|
|
||||||
%if 0%{?fedora}
|
%if 0%{?fedora}
|
||||||
%global with_jacop 1
|
%global with_jacop 1
|
||||||
%global with_gecode 1
|
%global with_gecode 1
|
||||||
@ -22,10 +18,6 @@
|
|||||||
%global blaslib openblas
|
%global blaslib openblas
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
%if 0%{?rhel} && 0%{?rhel} < 7
|
|
||||||
%{!?__global_ldflags: %global __global_ldflags -Wl,-z,relro}
|
|
||||||
%endif
|
|
||||||
|
|
||||||
%if 0%{?rhel} && 0%{?rhel} < 8
|
%if 0%{?rhel} && 0%{?rhel} < 8
|
||||||
%{!?_modulesdir: %global _modulesdir %{_datadir}/Modules/modulefiles}
|
%{!?_modulesdir: %global _modulesdir %{_datadir}/Modules/modulefiles}
|
||||||
%endif
|
%endif
|
||||||
@ -36,7 +28,7 @@
|
|||||||
|
|
||||||
Name: mp
|
Name: mp
|
||||||
Version: 3.1.0
|
Version: 3.1.0
|
||||||
Release: 31.%{date}git%{shortcommit}%{?dist}
|
Release: 32.%{date}git%{shortcommit}%{?dist}
|
||||||
License: MIT and BSD
|
License: MIT and BSD
|
||||||
Summary: An open-source library for mathematical programming
|
Summary: An open-source library for mathematical programming
|
||||||
URL: https://github.com/ampl/mp
|
URL: https://github.com/ampl/mp
|
||||||
@ -51,6 +43,9 @@ Patch0: %{name}-strtod.patch
|
|||||||
Patch1: %{name}-%{version}-jni.patch
|
Patch1: %{name}-%{version}-jni.patch
|
||||||
# Adapt to python 3
|
# Adapt to python 3
|
||||||
Patch2: %{name}-python3.patch
|
Patch2: %{name}-python3.patch
|
||||||
|
# Avoid crashes due to ambiguous order of destructor execution
|
||||||
|
# https://bugzilla.redhat.com/show_bug.cgi?id=1858054
|
||||||
|
Patch3: %{name}-jvm-destructor.patch
|
||||||
|
|
||||||
%if 0%{?rhel} && 0%{?rhel} <= 7
|
%if 0%{?rhel} && 0%{?rhel} <= 7
|
||||||
Requires: config(environment-modules)
|
Requires: config(environment-modules)
|
||||||
@ -137,22 +132,14 @@ Requires: %{name}%{?_isa} = %{version}-%{release}
|
|||||||
%description devel
|
%description devel
|
||||||
This package contains the header files for %{name}.
|
This package contains the header files for %{name}.
|
||||||
|
|
||||||
%if 0%{?fedora} || 0%{?rhel} > 6
|
|
||||||
%package doc
|
%package doc
|
||||||
Summary: Documentation for %{name}
|
Summary: Documentation for %{name}
|
||||||
|
|
||||||
%description doc
|
%description doc
|
||||||
This package contains the developer documentation for %{name}.
|
This package contains the developer documentation for %{name}.
|
||||||
%endif
|
|
||||||
|
|
||||||
%prep
|
%prep
|
||||||
%autosetup -n %{name}-%{commit} -N
|
%autosetup -n %{name}-%{commit} -a 2 -p1
|
||||||
%setup -n %{name}-%{commit} -q -T -D -a 2
|
|
||||||
%patch0 -p1
|
|
||||||
%patch1 -p1
|
|
||||||
%if 0%{?fedora} || 0%{?rhel} > 6
|
|
||||||
%patch2 -p1
|
|
||||||
%endif
|
|
||||||
|
|
||||||
%if 0%{?with_jacop}
|
%if 0%{?with_jacop}
|
||||||
jacopver=$(sed -n 's,^ <version>\(.*\)</version>,\1,p' %{_mavenpomdir}/jacop/jacop.pom)
|
jacopver=$(sed -n 's,^ <version>\(.*\)</version>,\1,p' %{_mavenpomdir}/jacop/jacop.pom)
|
||||||
@ -183,8 +170,8 @@ done
|
|||||||
sed -i 's,sphinx-build,&-3.6,' support/build-docs.py
|
sed -i 's,sphinx-build,&-3.6,' support/build-docs.py
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
# python-breathe is broken in EPEL 7 and absent in EPEL 6 and 8, so skip
|
# python-breathe is broken in EPEL 7 and absent in EPEL 8, so skip building
|
||||||
# building sphinx docs for those distributions.
|
# sphinx docs for those distributions.
|
||||||
%if 0%{?rhel}
|
%if 0%{?rhel}
|
||||||
sed -i 's,returncode == 0,False,' support/build-docs.py
|
sed -i 's,returncode == 0,False,' support/build-docs.py
|
||||||
%endif
|
%endif
|
||||||
@ -202,12 +189,6 @@ BUILD="jacop,$BUILD"
|
|||||||
export CPPFLAGS="-I$PWD/src/asl/solvers"
|
export CPPFLAGS="-I$PWD/src/asl/solvers"
|
||||||
export CFLAGS="%{optflags} -DNDEBUG"
|
export CFLAGS="%{optflags} -DNDEBUG"
|
||||||
export CXXFLAGS="%{optflags} -DNDEBUG"
|
export CXXFLAGS="%{optflags} -DNDEBUG"
|
||||||
export LDFLAGS="%{__global_ldflags}"
|
|
||||||
%if 0%{?rhel} && 0%{?rhel} < 7
|
|
||||||
export CFLAGS="$CFLAGS -Wl,-z,relro -fPIC -pie -Wl,-z,now"
|
|
||||||
export CXXFLAGS="$CXXFLAGS -Wl,-z,relro -fPIC -pie -Wl,-z,now"
|
|
||||||
export LDFLAGS="$LDFLAGS -fPIC -pie -Wl,-z,now -Wl,--as-needed"
|
|
||||||
%endif
|
|
||||||
# Let cmake create rpaths, so the jacop-using files can find libjvm.so.
|
# Let cmake create rpaths, so the jacop-using files can find libjvm.so.
|
||||||
# We strip out the ones we don't want with chrpath at install time.
|
# We strip out the ones we don't want with chrpath at install time.
|
||||||
%cmake3 -DCMAKE_INSTALL_PREFIX:PATH=%{_libdir}/%{name} \
|
%cmake3 -DCMAKE_INSTALL_PREFIX:PATH=%{_libdir}/%{name} \
|
||||||
@ -221,10 +202,8 @@ export LDFLAGS="$LDFLAGS -fPIC -pie -Wl,-z,now -Wl,--as-needed"
|
|||||||
-DBUILD_SHARED_LIBS:BOOL=YES \
|
-DBUILD_SHARED_LIBS:BOOL=YES \
|
||||||
-DBUILD:STRING=$BUILD ..
|
-DBUILD:STRING=$BUILD ..
|
||||||
%make_build
|
%make_build
|
||||||
%if 0%{?fedora} || 0%{?rhel} > 6
|
|
||||||
make doc
|
make doc
|
||||||
rm doc/ampl.github.io/models/*/.depend
|
rm doc/ampl.github.io/models/*/.depend
|
||||||
%endif
|
|
||||||
popd
|
popd
|
||||||
|
|
||||||
%install
|
%install
|
||||||
@ -266,31 +245,6 @@ install -pm 755 build/bin/smpswriter %{buildroot}%{_libdir}/%{name}/bin
|
|||||||
install -pm 755 build/bin/tableproxy%{__isa_bits} %{buildroot}%{_libdir}/%{name}/bin
|
install -pm 755 build/bin/tableproxy%{__isa_bits} %{buildroot}%{_libdir}/%{name}/bin
|
||||||
|
|
||||||
## Fix symbolic links
|
## Fix symbolic links
|
||||||
## On epel6 'mp' conflicts with 'gmp'
|
|
||||||
## We need to install libraries in a private lib directory
|
|
||||||
%if 0%{?rhel} && 0%{?rhel} < 7
|
|
||||||
install -pm 755 build/bin/libasl.so* %{buildroot}%{_libdir}/%{name}
|
|
||||||
ln -sf %{_libdir}/%{name}/libasl.so.%{version} %{buildroot}%{_libdir}/%{name}/libasl.so.%{majver}
|
|
||||||
ln -sf libasl.so.%{majver} %{buildroot}%{_libdir}/%{name}/libasl.so
|
|
||||||
|
|
||||||
install -pm 755 build/bin/libmp.so* %{buildroot}%{_libdir}/%{name}
|
|
||||||
ln -sf %{_libdir}/%{name}/libmp.so.%{version} %{buildroot}%{_libdir}/%{name}/libmp.so.%{majver}
|
|
||||||
ln -sf libmp.so.%{majver} %{buildroot}%{_libdir}/%{name}/libmp.so
|
|
||||||
|
|
||||||
chrpath --replace %{_libdir}/%{name} %{buildroot}%{_libdir}/%{name}/libasl.so.%{version}
|
|
||||||
chrpath --replace %{_libdir}/%{name} %{buildroot}%{_libdir}/%{name}/bin/amplgsl.dll
|
|
||||||
chrpath --replace %{_libdir}/%{name} %{buildroot}%{_libdir}/%{name}/bin/ampltabl.dll
|
|
||||||
chrpath --replace %{_libdir}/%{name} %{buildroot}%{_libdir}/%{name}/bin/cp.dll
|
|
||||||
chrpath --replace %{_libdir}/%{name} %{buildroot}%{_libdir}/%{name}/bin/fullbit.dll
|
|
||||||
chrpath --replace %{_libdir}/%{name} %{buildroot}%{_libdir}/%{name}/bin/gecode
|
|
||||||
chrpath --replace %{_libdir}/%{name} %{buildroot}%{_libdir}/%{name}/bin/gjh
|
|
||||||
chrpath --replace %{_libdir}/%{name} %{buildroot}%{_libdir}/%{name}/bin/gsl-info
|
|
||||||
chrpath --replace %{_libdir}/%{name} %{buildroot}%{_libdir}/%{name}/bin/libamplgecode.so
|
|
||||||
chrpath --replace %{_libdir}/%{name} %{buildroot}%{_libdir}/%{name}/bin/libamplsmpswriter.so
|
|
||||||
chrpath --replace %{_libdir}/%{name} %{buildroot}%{_libdir}/%{name}/bin/simpbit.dll
|
|
||||||
chrpath --replace %{_libdir}/%{name} %{buildroot}%{_libdir}/%{name}/bin/smpswriter
|
|
||||||
chrpath --replace %{_libdir}/%{name} %{buildroot}%{_libdir}/%{name}/bin/tableproxy%{__isa_bits}
|
|
||||||
%else
|
|
||||||
install -pm 755 build/bin/libasl.so* %{buildroot}%{_libdir}
|
install -pm 755 build/bin/libasl.so* %{buildroot}%{_libdir}
|
||||||
ln -sf libasl.so.%{version} %{buildroot}%{_libdir}/libasl.so.%{majver}
|
ln -sf libasl.so.%{version} %{buildroot}%{_libdir}/libasl.so.%{majver}
|
||||||
ln -sf libasl.so.%{majver} %{buildroot}%{_libdir}/libasl.so
|
ln -sf libasl.so.%{majver} %{buildroot}%{_libdir}/libasl.so
|
||||||
@ -321,32 +275,15 @@ chrpath --delete %{buildroot}%{_libdir}/%{name}/bin/libamplsmpswriter.so
|
|||||||
chrpath --delete %{buildroot}%{_libdir}/%{name}/bin/simpbit.dll
|
chrpath --delete %{buildroot}%{_libdir}/%{name}/bin/simpbit.dll
|
||||||
chrpath --delete %{buildroot}%{_libdir}/%{name}/bin/smpswriter
|
chrpath --delete %{buildroot}%{_libdir}/%{name}/bin/smpswriter
|
||||||
chrpath --delete %{buildroot}%{_libdir}/%{name}/bin/tableproxy%{__isa_bits}
|
chrpath --delete %{buildroot}%{_libdir}/%{name}/bin/tableproxy%{__isa_bits}
|
||||||
%endif
|
|
||||||
##
|
##
|
||||||
|
|
||||||
## Some tests fail on EPEL6 ppc64
|
|
||||||
# https://github.com/ampl/mp/issues/101
|
|
||||||
%check
|
%check
|
||||||
pushd build
|
pushd build
|
||||||
# Some of the tests use the SAME FILENAME to store temporary results, so
|
# Some of the tests use the SAME FILENAME to store temporary results, so
|
||||||
# running the tests in parallel leads to intermittent test failures, generally
|
# running the tests in parallel leads to intermittent test failures, generally
|
||||||
# in either os-test or solver-test. Do not pass the parallel flags to ctest.
|
# in either os-test or solver-test. Do not pass the parallel flags to ctest.
|
||||||
%if 0%{?rhel}
|
|
||||||
%if 0%{?rhel} < 7
|
|
||||||
# https://github.com/ampl/mp/issues/103
|
|
||||||
ctest3 --force-new-ctest-process -E gsl
|
|
||||||
%else
|
|
||||||
ctest3 --force-new-ctest-process
|
|
||||||
%endif
|
|
||||||
%else
|
|
||||||
# jacop-test is failing with new java-11-openjdk-11.0.8.10 (rhbz#1859925)
|
|
||||||
#ctest --force-new-ctest-process -j1 -VV --output-on-failure --debug -R 'jacop-test' && exit 1
|
|
||||||
%ifarch %{power64}
|
|
||||||
ctest --force-new-ctest-process -j1 -E 'jacop-test'
|
|
||||||
%else
|
|
||||||
ctest --force-new-ctest-process -j1
|
ctest --force-new-ctest-process -j1
|
||||||
%endif
|
popd
|
||||||
%endif
|
|
||||||
|
|
||||||
%ldconfig_scriptlets
|
%ldconfig_scriptlets
|
||||||
|
|
||||||
@ -355,33 +292,25 @@ ctest --force-new-ctest-process -j1
|
|||||||
%license LICENSE.rst
|
%license LICENSE.rst
|
||||||
%dir %{_libdir}/%{name}
|
%dir %{_libdir}/%{name}
|
||||||
%{_libdir}/%{name}/bin/
|
%{_libdir}/%{name}/bin/
|
||||||
%if 0%{?rhel} && 0%{?rhel} < 7
|
|
||||||
%{_libdir}/%{name}/libasl.so.3*
|
|
||||||
%{_libdir}/%{name}/libmp.so.3*
|
|
||||||
%else
|
|
||||||
%{_libdir}/libasl.so.3*
|
%{_libdir}/libasl.so.3*
|
||||||
%{_libdir}/libmp.so.3*
|
%{_libdir}/libmp.so.3*
|
||||||
%endif
|
|
||||||
%{_modulesdir}/%{name}-%{_arch}
|
%{_modulesdir}/%{name}-%{_arch}
|
||||||
|
|
||||||
%files devel
|
%files devel
|
||||||
%if 0%{?rhel} && 0%{?rhel} < 7
|
|
||||||
%{_libdir}/%{name}/libasl.so
|
|
||||||
%{_libdir}/%{name}/libmp.so
|
|
||||||
%else
|
|
||||||
%{_libdir}/libasl.so
|
%{_libdir}/libasl.so
|
||||||
%{_libdir}/libmp.so
|
%{_libdir}/libmp.so
|
||||||
%endif
|
|
||||||
%{_includedir}/asl
|
%{_includedir}/asl
|
||||||
%{_includedir}/mp
|
%{_includedir}/mp
|
||||||
|
|
||||||
%if 0%{?fedora} || 0%{?rhel} > 6
|
|
||||||
%files doc
|
%files doc
|
||||||
%license LICENSE.rst
|
%license LICENSE.rst
|
||||||
%doc build/doc/ampl.github.io/*
|
%doc build/doc/ampl.github.io/*
|
||||||
%endif
|
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Fri Jan 15 2021 Jerry James <loganjerry@gmail.com> - 3.1.0-32.20200303git7fd4828
|
||||||
|
- Add -jvm-destructor to fix jacop-related crashes (bz 1858054)
|
||||||
|
- Remove RHEL 6 support
|
||||||
|
|
||||||
* Thu Aug 27 2020 Iñaki Úcar <iucar@fedoraproject.org> - 3.1.0-31.20200303git7fd4828
|
* Thu Aug 27 2020 Iñaki Úcar <iucar@fedoraproject.org> - 3.1.0-31.20200303git7fd4828
|
||||||
- https://fedoraproject.org/wiki/Changes/FlexiBLAS_as_BLAS/LAPACK_manager
|
- https://fedoraproject.org/wiki/Changes/FlexiBLAS_as_BLAS/LAPACK_manager
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user