From ddd34ceaf48394a16ee60d851c3a34ca7998c30c Mon Sep 17 00:00:00 2001 From: Gabriel Pichot Date: Sat, 5 Dec 2015 11:51:51 +0100 Subject: [PATCH 1/3] Adds usage of /usr/libexec/java_home for OS X platforms (cherry picked from commit ff5af73676ff1cb9cf26f5920ab2a4033f680536) Signed-off-by: KAWASHIMA Takahiro --- config/opal_setup_java.m4 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/config/opal_setup_java.m4 b/config/opal_setup_java.m4 index dac50b9cf20..e6b48a73099 100644 --- a/config/opal_setup_java.m4 +++ b/config/opal_setup_java.m4 @@ -95,7 +95,9 @@ AC_DEFUN([OPAL_SETUP_JAVA],[ [ # OS X Snow Leopard and Lion (10.6 and 10.7 -- did not # check prior versions) opal_java_found=0 - opal_java_dir=/System/Library/Frameworks/JavaVM.framework/Versions/Current/Headers + AS_IF([test -x /usr/libexec/java_home], + [opal_java_dir=`/usr/libexec/java_home`/include], + [opal_java_dir=/System/Library/Frameworks/JavaVM.framework/Versions/Current/Headers]) AC_MSG_CHECKING([OSX locations]) AS_IF([test -d $opal_java_dir], [AC_MSG_RESULT([found ($opal_java_dir)]) From 849ea9586e1f06d24eb698f63d7713dd521a5da3 Mon Sep 17 00:00:00 2001 From: Bryce Glover Date: Wed, 4 Apr 2018 19:07:17 -0400 Subject: [PATCH 2/3] config/opal_setup_java.m4: Improve JDK tool path resolution on OS X/macOS. Also avoid picking up Apple's Java shims via the sym. links to them in `/usr/bin` on systems where any one of them could possibly exhibit behavior that is erratic and, to some extent, likely to be incorrect nowadays (cf.: - https://www.mail-archive.com/devel@lists.open-mpi.org/msg20551.html - https://github.com/open-mpi/ompi/pull/5015#issuecomment-379324639 - the last part of https://github.com/open-mpi/ompi/pull/5015#discussion_r184187064 - https://github.com/open-mpi/ompi/pull/5015#issuecomment-384136871 for more detailed context.) Works alongside #5001 to close #5000. Signed-off-by: Bryce Glover (cherry picked from commit 8c32cd8970991df3497e6db9d8eab2b6dcbacbee) Signed-off-by: KAWASHIMA Takahiro --- config/opal_setup_java.m4 | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/config/opal_setup_java.m4 b/config/opal_setup_java.m4 index e6b48a73099..0b0951a963b 100644 --- a/config/opal_setup_java.m4 +++ b/config/opal_setup_java.m4 @@ -92,18 +92,29 @@ AC_DEFUN([OPAL_SETUP_JAVA],[ # hard-code a few of the common ones so that users don't have to # specify --with-java-=LONG_ANNOYING_DIRECTORY. AS_IF([test -z "$with_jdk_bindir"], - [ # OS X Snow Leopard and Lion (10.6 and 10.7 -- did not - # check prior versions) + [ # OS X/macOS opal_java_found=0 + # The following logic was deliberately decided upon in https://github.com/open-mpi/ompi/pull/5015 specifically to prevent this script and the + # rest of Open MPI's build system from getting confused by the somewhat unorthodox Java toolchain layout present on OS X/macOS systems, described + # in depth by https://github.com/open-mpi/ompi/pull/5015#issuecomment-379324639, and mishandling OS X/macOS Java toolchain path + # detection as a result. AS_IF([test -x /usr/libexec/java_home], - [opal_java_dir=`/usr/libexec/java_home`/include], - [opal_java_dir=/System/Library/Frameworks/JavaVM.framework/Versions/Current/Headers]) - AC_MSG_CHECKING([OSX locations]) + [opal_java_dir=`/usr/libexec/java_home`], + [opal_java_dir=/System/Library/Frameworks/JavaVM.framework/Versions/Current]) + AC_MSG_CHECKING([OS X/macOS locations]) AS_IF([test -d $opal_java_dir], [AC_MSG_RESULT([found ($opal_java_dir)]) opal_java_found=1 - with_jdk_headers=$opal_java_dir - with_jdk_bindir=/usr/bin], + if test -d "$opal_java_dir/Headers" && test -d "$opal_java_dir/Commands"; then + with_jdk_headers=$opal_java_dir/Headers + with_jdk_bindir=$opal_java_dir/Commands + elif test -d "$opal_java_dir/include" && test -d "$opal_java_dir/bin"; then + with_jdk_headers=$opal_java_dir/include + with_jdk_bindir=$opal_java_dir/bin + else + AC_MSG_WARN([No recognized directory structure found under $opal_java_dir]) + AC_MSG_ERROR([Cannot continue]) + fi], [AC_MSG_RESULT([not found])]) if test "$opal_java_found" = "0"; then From 5e07252a13539e8be319fb147e3f8a5fba29c84e Mon Sep 17 00:00:00 2001 From: Bryce Glover Date: Wed, 9 May 2018 16:08:57 -0400 Subject: [PATCH 3/3] config/opal_setup_java.m4: Fix #5015. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit That PR accidentally changed Open MPI's build configuration infrastruc- ture's Java toolchain detection logic so that it would, as reported by @bosilca in https://github.com/open-mpi/ompi/pull/5001#issuecomment-387803012 and tracked down by me in https://github.com/open-mpi/ompi/pull/5001#issuecomment-387851005, abort your entire in-progress Open MPI build when it failed to find an OS X/macOS JDK instead of simply falling back to checking for a JDK in locations where it would be found on other platforms. _Oops…!_ Signed-off-by: Bryce Glover (cherry picked from commit 4a05c7e29fbe5e20b2b6eb52db529cf19979f8f7) --- config/opal_setup_java.m4 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config/opal_setup_java.m4 b/config/opal_setup_java.m4 index 0b0951a963b..9b667236624 100644 --- a/config/opal_setup_java.m4 +++ b/config/opal_setup_java.m4 @@ -112,8 +112,8 @@ AC_DEFUN([OPAL_SETUP_JAVA],[ with_jdk_headers=$opal_java_dir/include with_jdk_bindir=$opal_java_dir/bin else - AC_MSG_WARN([No recognized directory structure found under $opal_java_dir]) - AC_MSG_ERROR([Cannot continue]) + AC_MSG_WARN([No recognized OS X/macOS JDK directory structure found under $opal_java_dir]) + opal_java_found=0 fi], [AC_MSG_RESULT([not found])])