You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Charlie O'Keefe <ch...@gmail.com> on 2012/02/27 04:07:02 UTC
tomcat-native 1.1.22 doesn't find JDK on OS X 10.6.8 Snow Leopard
$cd native; ./configure --with-apr=`apr-1-config --prefix`
checking build system type... x86_64-apple-darwin10.8.0
checking host system type... x86_64-apple-darwin10.8.0
checking target system type... x86_64-apple-darwin10.8.0
checking for a BSD-compatible install... /usr/bin/install -c
checking for working mkdir -p... yes
Tomcat Native Version: 1.1.22
checking for chosen layout... tcnative
checking for APR... yes
setting CC to "gcc"
setting CPP to "gcc -E"
checking for a BSD-compatible install... /usr/bin/install -c
configure: error: can't locate a valid JDK location
checking for JDK location (please wait)... checking Try to guess JDK
location...
Strange, why can't it locate a JDK?
Looks like the code that failed is in native/build/tcnative.m4:
if test -z "${JAVA_HOME}" ; then
# Oh well, nobody set neither JAVA_HOME nor JAVA_HOME, have to guess
# The following code is based on the code submitted by Henner Zeller
# for ${srcdir}/src/scripts/package/rpm/ApacheJServ.spec
# Two variables will be set as a result:
#
# JAVA_HOME
# JAVA_PLATFORM
AC_MSG_CHECKING([Try to guess JDK location])
for JAVA_PREFIX in /usr/local /usr/local/lib /usr /usr/lib /opt
/usr/java /System/Library/Frameworks/JavaVM.framework/Versions/ ; do
for JAVA_PLATFORM in 6 5 4 3 2 ; do
for subversion in .9 .8 .7 .6 .5 .4 .3 .2 .1 .0 "" ; do
for VARIANT in IBMJava2- java java- jdk jdk- ""; do
GUESS="${JAVA_PREFIX}/${VARIANT}1.${JAVA_PLATFORM}${subversion}"
dnl AC_MSG_CHECKING([${GUESS}])
if test -d "${GUESS}/bin" & test -d "${GUESS}/include" ; then
JAVA_HOME="${GUESS}"
AC_MSG_RESULT([${GUESS}])
break
fi
if test -d "${GUESS}/Commands" & test -d "${GUESS}/Headers" ;
then
JAVA_HOME="${GUESS}"
AC_MSG_RESULT([${GUESS}])
break
fi
done
if test -n "${JAVA_HOME}" ; then
break;
fi
done
if test -n "${JAVA_HOME}" ; then
break;
fi
done
if test -n "${JAVA_HOME}" ; then
break;
fi
done
if test ! -n "${JAVA_HOME}" ; then
AC_MSG_ERROR(can't locate a valid JDK location)
fi
fi
The loop in that code which is trying a bunch of guesses will eventually
get to the following combination of values:
JAVA_PREFIX = /System/Library/Frameworks/JavaVM.framework/Versions/
JAVA_PLATFORM = 6
subversion = .0
VARIANT = ""
Line 127 constructs a guess:
GUESS="${JAVA_PREFIX}/${VARIANT}1.${JAVA_PLATFORM}${subversion}"
For the above combination, that guess will be:
/System/Library/Frameworks/JavaVM.framework/Versions//1.6.0
On my machine running OS X 10.6.8 (Snow Leopard), here's what that path
resolves to:
$ ls -l /System/Library/Frameworks/JavaVM.framework/Versions//1.6.0
lrwxr-xr-x 1 root wheel 10 Nov 21 08:42
/System/Library/Frameworks/JavaVM.framework/Versions//1.6.0 -> CurrentJDK
Following the symlink:
$ ls -l /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK
lrwxr-xr-x 1 root wheel 59 Nov 21 08:42
/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK ->
/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents
Following the second symlink:
$ ls -l /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents
total 0
drwxr-xr-x 12 root wheel 408 Nov 21 08:43 Classes
drwxr-xr-x 41 root wheel 1394 Nov 21 08:43 Commands
drwxr-xr-x 7 root wheel 238 Nov 21 08:43 Home
-rw-r--r-- 1 root wheel 1963 Nov 1 12:05 Info.plist
drwxr-xr-x 50 root wheel 1700 Nov 21 08:43 Libraries
drwxr-xr-x 3 root wheel 102 Nov 21 08:43 MacOS
drwxr-xr-x 21 root wheel 714 Nov 21 08:43 Resources
-rw-r--r-- 1 root wheel 454 Nov 1 12:08 version.plist
So there is a directory here with some useful JDK-type things in it. The
Home subdirectory here does look like something that would be universally
recognized as a JAVA_HOME:
$ ls -l /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/
total 16
drwxr-xr-x 41 root wheel 1394 Nov 21 08:43 bin
lrwxr-xr-x 1 root wheel 3 Nov 21 08:42 bundle -> ../
lrwxr-xr-x 1 root wheel 51 Nov 21 08:42 include ->
/System/Library/Frameworks/JavaVM.framework/Headers
drwxr-xr-x 42 root wheel 1428 Nov 21 08:43 lib
drwxr-xr-x 41 root wheel 1394 Nov 1 12:03 man
$ ls -l
/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/bin/ |
grep java
-rwxr-xr-x 1 root wheel 100560 Nov 1 12:03 java
-rwxr-xr-x 1 root wheel 100560 Nov 1 12:03 javac
-rwxr-xr-x 1 root wheel 100560 Nov 1 12:03 javadoc
-rwxr-xr-x 1 root wheel 100560 Nov 1 12:03 javah
-rwxr-xr-x 1 root wheel 100560 Nov 1 12:03 javap
lrwxr-xr-x 1 root wheel 67 Nov 21 08:42 javaws ->
/System/Library/Java/Support/Deploy.bundle/Contents/Home/bin/javaws
At the point it isn't clear to me which directory we actually want. This
script checks for some directories that look like they're apple-named:
if test -d "${GUESS}/Commands" & test -d "${GUESS}/Headers" ;
then
JAVA_HOME="${GUESS}"
AC_MSG_RESULT([${GUESS}])
break
fi
However, as the above listing shows, in
/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents we have a
“Commands” subdirectory but no “Headers” subdirectory. I think that's the
reason it's coming up empty here.
There is another location on OS X that does have both a “Commands”
subdirectory and a “Headers” subdirectory:
$ ls -l /System/Library/Frameworks/JavaVM.framework
total 72
lrwxr-xr-x 1 root wheel 27 Nov 21 08:42 Classes ->
Versions/CurrentJDK/Classes
lrwxr-xr-x 1 root wheel 24 Nov 21 08:42 CodeResources ->
Versions/A/CodeResources
lrwxr-xr-x 1 root wheel 28 Nov 21 08:42 Commands ->
Versions/CurrentJDK/Commands
lrwxr-xr-x 1 root wheel 27 Nov 21 08:42 Frameworks ->
Versions/Current/Frameworks
lrwxr-xr-x 1 root wheel 24 Nov 21 08:42 Headers ->
Versions/Current/Headers
lrwxr-xr-x 1 root wheel 24 Nov 21 08:42 Home ->
Versions/CurrentJDK/Home
lrwxr-xr-x 1 root wheel 23 Nov 21 08:42 JavaVM ->
Versions/Current/JavaVM
lrwxr-xr-x 1 root wheel 29 Nov 21 08:42 Libraries ->
Versions/CurrentJDK/Libraries
lrwxr-xr-x 1 root wheel 26 Nov 21 08:42 Resources ->
Versions/Current/Resources
drwxr-xr-x 13 root wheel 442 Nov 21 08:45 Versions
However, this code as written will not check that location.
There seem to be a few ways this could be patched to find a valid JDK
location. May main question is, which is most preferable? My guess is that
if JAVA_HOME has not been set, in this particular situation we probably
want it to land on /System/Library/Frameworks/JavaVM.framework
Re: tomcat-native 1.1.22 doesn't find JDK on OS X 10.6.8 Snow Leopard
Posted by Mladen Turk <mt...@apache.org>.
On 02/27/2012 04:51 AM, Charlie O'Keefe wrote:
> Christopher,
>
> Thanks, wasn't aware of /usr/libexec/java_home
>
> $ /usr/libexec/java_home
> /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
> $ ls -Al `/usr/libexec/java_home`
> total 16
> drwxr-xr-x 41 root wheel 1394 Nov 21 08:43 bin
> lrwxr-xr-x 1 root wheel 3 Nov 21 08:42 bundle -> ../
> lrwxr-xr-x 1 root wheel 51 Nov 21 08:42 include ->
> /System/Library/Frameworks/JavaVM.framework/Headers
> drwxr-xr-x 42 root wheel 1428 Nov 21 08:43 lib
> drwxr-xr-x 41 root wheel 1394 Nov 1 12:03 man
> GLOBE-Mandalay:~ cokeefe$
>
> That path specifically says "jdk" (not "jre"). Does this mean I have a JDK
> rather than just a JRE?
>
> Also, would it be a good idea for the configure script to attempt to run
> /usr/libexec/java_home in this section where it is looking for a JDK?
>
Nope.
At the end you can always set JAVA_HOME before running configure.
But like Chris said, think you have something missing on your box
since on my 10.6.8 Headers contains what it should.
Regards
--
^TM
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: tomcat-native 1.1.22 doesn't find JDK on OS X 10.6.8 Snow Leopard
Posted by Charlie O'Keefe <ch...@gmail.com>.
Christopher,
Thanks, wasn't aware of /usr/libexec/java_home
$ /usr/libexec/java_home
/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
$ ls -Al `/usr/libexec/java_home`
total 16
drwxr-xr-x 41 root wheel 1394 Nov 21 08:43 bin
lrwxr-xr-x 1 root wheel 3 Nov 21 08:42 bundle -> ../
lrwxr-xr-x 1 root wheel 51 Nov 21 08:42 include ->
/System/Library/Frameworks/JavaVM.framework/Headers
drwxr-xr-x 42 root wheel 1428 Nov 21 08:43 lib
drwxr-xr-x 41 root wheel 1394 Nov 1 12:03 man
GLOBE-Mandalay:~ cokeefe$
That path specifically says "jdk" (not "jre"). Does this mean I have a JDK
rather than just a JRE?
Also, would it be a good idea for the configure script to attempt to run
/usr/libexec/java_home in this section where it is looking for a JDK?
-Charlie
On Sun, Feb 26, 2012 at 8:27 PM, Christopher Schultz <
chris@christopherschultz.net> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Charlie,
>
> On 2/26/12 10:07 PM, Charlie O'Keefe wrote:
> > $cd native; ./configure --with-apr=`apr-1-config --prefix` checking
> > build system type... x86_64-apple-darwin10.8.0 checking host system
> > type... x86_64-apple-darwin10.8.0 checking target system type...
> > x86_64-apple-darwin10.8.0 checking for a BSD-compatible install...
> > /usr/bin/install -c checking for working mkdir -p... yes Tomcat
> > Native Version: 1.1.22 checking for chosen layout... tcnative
> > checking for APR... yes setting CC to "gcc" setting CPP to "gcc
> > -E" checking for a BSD-compatible install... /usr/bin/install -c
> > configure: error: can't locate a valid JDK location checking for
> > JDK location (please wait)... checking Try to guess JDK
> > location...
> >
> > Strange, why can't it locate a JDK?
>
> Are you sure you have one installed? Maybe you just have a JRE.
>
> You might need a package you didn't need in the past:
> https://discussions.apple.com/thread/2630649?start=0&tstart=0
>
> > The loop in that code which is trying a bunch of guesses will
> > eventually get to the following combination of values:
> >
> > JAVA_PREFIX =
> > /System/Library/Frameworks/JavaVM.framework/Versions/ JAVA_PLATFORM
> > = 6 subversion = .0 VARIANT = ""
> >
> > Line 127 constructs a guess:
> > GUESS="${JAVA_PREFIX}/${VARIANT}1.${JAVA_PLATFORM}${subversion}"
> >
> > For the above combination, that guess will be:
> > /System/Library/Frameworks/JavaVM.framework/Versions//1.6.0
> >
> > On my machine running OS X 10.6.8 (Snow Leopard), here's what that
> > path resolves to:
> >
> > $ ls -l
> > /System/Library/Frameworks/JavaVM.framework/Versions//1.6.0
> > lrwxr-xr-x 1 root wheel 10 Nov 21 08:42
> > /System/Library/Frameworks/JavaVM.framework/Versions//1.6.0 ->
> > CurrentJDK
> >
> > Following the symlink:
> >
> > $ ls -l
> > /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK
> > lrwxr-xr-x 1 root wheel 59 Nov 21 08:42
> > /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK ->
> > /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents
> >
> > Following the second symlink:
> >
> > $ ls -l
> > /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents total
> > 0 drwxr-xr-x 12 root wheel 408 Nov 21 08:43 Classes drwxr-xr-x
> > 41 root wheel 1394 Nov 21 08:43 Commands drwxr-xr-x 7 root
> > wheel 238 Nov 21 08:43 Home -rw-r--r-- 1 root wheel 1963 Nov
> > 1 12:05 Info.plist drwxr-xr-x 50 root wheel 1700 Nov 21 08:43
> > Libraries drwxr-xr-x 3 root wheel 102 Nov 21 08:43 MacOS
> > drwxr-xr-x 21 root wheel 714 Nov 21 08:43 Resources -rw-r--r--
> > 1 root wheel 454 Nov 1 12:08 version.plist
>
> This is what I have in my Lion environment, too.
>
> > So there is a directory here with some useful JDK-type things in
> > it. The Home subdirectory here does look like something that would
> > be universally recognized as a JAVA_HOME:
> >
> > $ ls -l
> > /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/
> > total 16 drwxr-xr-x 41 root wheel 1394 Nov 21 08:43 bin
> > lrwxr-xr-x 1 root wheel 3 Nov 21 08:42 bundle -> ../
> > lrwxr-xr-x 1 root wheel 51 Nov 21 08:42 include ->
> > /System/Library/Frameworks/JavaVM.framework/Headers drwxr-xr-x 42
> > root wheel 1428 Nov 21 08:43 lib drwxr-xr-x 41 root wheel 1394
> > Nov 1 12:03 man
>
> I've got all that except for no "include" symlink. The target
> directory in your 'ls' listing doesn't contain a 'Headers' directory,
> which is probably why I don't have the symlink at all.
>
> > $ ls -l
> > /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/bin/
> > | grep java -rwxr-xr-x 1 root wheel 100560 Nov 1 12:03 java
> > -rwxr-xr-x 1 root wheel 100560 Nov 1 12:03 javac -rwxr-xr-x 1
> > root wheel 100560 Nov 1 12:03 javadoc -rwxr-xr-x 1 root wheel
> > 100560 Nov 1 12:03 javah -rwxr-xr-x 1 root wheel 100560 Nov 1
> > 12:03 javap lrwxr-xr-x 1 root wheel 67 Nov 21 08:42 javaws
> > ->
> > /System/Library/Java/Support/Deploy.bundle/Contents/Home/bin/javaws
> >
> > At the point it isn't clear to me which directory we actually
> > want. This script checks for some directories that look like
> > they're apple-named:
>
> You want the one with the header files in it. :)
>
> > However, this code as written will not check that location.
> >
> > There seem to be a few ways this could be patched to find a valid
> > JDK location. May main question is, which is most preferable? My
> > guess is that if JAVA_HOME has not been set, in this particular
> > situation we probably want it to land on
> > /System/Library/Frameworks/JavaVM.framework
>
> Best thing to do on Mac OS X is this:
>
> JAVA_HOME=`/usr/libexec/java_home`
>
> I still think you need to install another package, though.
>
> - -chris
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
> Comment: GPGTools - http://gpgtools.org
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
>
> iEYEARECAAYFAk9K+CcACgkQ9CaO5/Lv0PAxjgCfVsTN3WmI6NJzELdspLz/1vRY
> vH8AnAp6PitnDmgTtJ9s0SKf1UZ9D3ZK
> =EOjs
> -----END PGP SIGNATURE-----
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
Re: tomcat-native 1.1.22 doesn't find JDK on OS X 10.6.8 Snow Leopard
Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Charlie,
On 2/26/12 10:07 PM, Charlie O'Keefe wrote:
> $cd native; ./configure --with-apr=`apr-1-config --prefix` checking
> build system type... x86_64-apple-darwin10.8.0 checking host system
> type... x86_64-apple-darwin10.8.0 checking target system type...
> x86_64-apple-darwin10.8.0 checking for a BSD-compatible install...
> /usr/bin/install -c checking for working mkdir -p... yes Tomcat
> Native Version: 1.1.22 checking for chosen layout... tcnative
> checking for APR... yes setting CC to "gcc" setting CPP to "gcc
> -E" checking for a BSD-compatible install... /usr/bin/install -c
> configure: error: can't locate a valid JDK location checking for
> JDK location (please wait)... checking Try to guess JDK
> location...
>
> Strange, why can't it locate a JDK?
Are you sure you have one installed? Maybe you just have a JRE.
You might need a package you didn't need in the past:
https://discussions.apple.com/thread/2630649?start=0&tstart=0
> The loop in that code which is trying a bunch of guesses will
> eventually get to the following combination of values:
>
> JAVA_PREFIX =
> /System/Library/Frameworks/JavaVM.framework/Versions/ JAVA_PLATFORM
> = 6 subversion = .0 VARIANT = ""
>
> Line 127 constructs a guess:
> GUESS="${JAVA_PREFIX}/${VARIANT}1.${JAVA_PLATFORM}${subversion}"
>
> For the above combination, that guess will be:
> /System/Library/Frameworks/JavaVM.framework/Versions//1.6.0
>
> On my machine running OS X 10.6.8 (Snow Leopard), here's what that
> path resolves to:
>
> $ ls -l
> /System/Library/Frameworks/JavaVM.framework/Versions//1.6.0
> lrwxr-xr-x 1 root wheel 10 Nov 21 08:42
> /System/Library/Frameworks/JavaVM.framework/Versions//1.6.0 ->
> CurrentJDK
>
> Following the symlink:
>
> $ ls -l
> /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK
> lrwxr-xr-x 1 root wheel 59 Nov 21 08:42
> /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK ->
> /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents
>
> Following the second symlink:
>
> $ ls -l
> /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents total
> 0 drwxr-xr-x 12 root wheel 408 Nov 21 08:43 Classes drwxr-xr-x
> 41 root wheel 1394 Nov 21 08:43 Commands drwxr-xr-x 7 root
> wheel 238 Nov 21 08:43 Home -rw-r--r-- 1 root wheel 1963 Nov
> 1 12:05 Info.plist drwxr-xr-x 50 root wheel 1700 Nov 21 08:43
> Libraries drwxr-xr-x 3 root wheel 102 Nov 21 08:43 MacOS
> drwxr-xr-x 21 root wheel 714 Nov 21 08:43 Resources -rw-r--r--
> 1 root wheel 454 Nov 1 12:08 version.plist
This is what I have in my Lion environment, too.
> So there is a directory here with some useful JDK-type things in
> it. The Home subdirectory here does look like something that would
> be universally recognized as a JAVA_HOME:
>
> $ ls -l
> /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/
> total 16 drwxr-xr-x 41 root wheel 1394 Nov 21 08:43 bin
> lrwxr-xr-x 1 root wheel 3 Nov 21 08:42 bundle -> ../
> lrwxr-xr-x 1 root wheel 51 Nov 21 08:42 include ->
> /System/Library/Frameworks/JavaVM.framework/Headers drwxr-xr-x 42
> root wheel 1428 Nov 21 08:43 lib drwxr-xr-x 41 root wheel 1394
> Nov 1 12:03 man
I've got all that except for no "include" symlink. The target
directory in your 'ls' listing doesn't contain a 'Headers' directory,
which is probably why I don't have the symlink at all.
> $ ls -l
> /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/bin/
> | grep java -rwxr-xr-x 1 root wheel 100560 Nov 1 12:03 java
> -rwxr-xr-x 1 root wheel 100560 Nov 1 12:03 javac -rwxr-xr-x 1
> root wheel 100560 Nov 1 12:03 javadoc -rwxr-xr-x 1 root wheel
> 100560 Nov 1 12:03 javah -rwxr-xr-x 1 root wheel 100560 Nov 1
> 12:03 javap lrwxr-xr-x 1 root wheel 67 Nov 21 08:42 javaws
> ->
> /System/Library/Java/Support/Deploy.bundle/Contents/Home/bin/javaws
>
> At the point it isn't clear to me which directory we actually
> want. This script checks for some directories that look like
> they're apple-named:
You want the one with the header files in it. :)
> However, this code as written will not check that location.
>
> There seem to be a few ways this could be patched to find a valid
> JDK location. May main question is, which is most preferable? My
> guess is that if JAVA_HOME has not been set, in this particular
> situation we probably want it to land on
> /System/Library/Frameworks/JavaVM.framework
Best thing to do on Mac OS X is this:
JAVA_HOME=`/usr/libexec/java_home`
I still think you need to install another package, though.
- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAk9K+CcACgkQ9CaO5/Lv0PAxjgCfVsTN3WmI6NJzELdspLz/1vRY
vH8AnAp6PitnDmgTtJ9s0SKf1UZ9D3ZK
=EOjs
-----END PGP SIGNATURE-----
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org