Opened 11 years ago

Closed 11 years ago

Last modified 10 years ago

#5267 closed defect (fixed)

MDB driver does not find Mac Java installs

Reported by: larrysh Owned by: warmerdam
Priority: normal Milestone: 1.11.0
Component: ConfigBuild Version: 1.10.1
Severity: normal Keywords: mdb, access, java
Cc:

Description

On Mac, with GDAL 1.10.1, the PGeo and Geomedia OGR drivers do not work due to non-functioning MDB Tools (I can install and config, but fails to load .mdb files). However, the MDB driver does function well, though Java installs aren't found by ./configure on Mac.

The two Java JDK setups on Mac are Apple-supported (<= 10.8, up to recent Java 1.6) and Oracle third-party manual install (10.8+, Java 1.6+). The Apple-supported Java is framework-based, the Oracle install has a similar layout to Unix/Linux installs.

Attached to ticket is a patch to ./configure to add support for finding Java installs for Mac. Note, I don't do much editing of configure scripts, so some code review would be appreciated. I tried to allow for auto-finding of install, with Oracle taking preference:

--with-java=yes \
--with-jvm-lib-add-rpath=yes \
--with-mdb=yes

The rpath is only embedded for Oracle (non-framework) installs. Since the Mac install_name id of the Oracle libjvm.dylib starts with @rpath already, the dylib is set up for lazy dynamic loading, otherwise the embedded rpath is ignored and gdal throws a dylib loading error. The lazy loading also avoids needing to 'fix' gdal after building by using install_name_tool to adjust the libjvm id.

I also tried to ensure the following could be used, in addition to auto-finding:

--with-java=/path/to/jdk/root/path \
--with-jvm-lib=/path/to/libjvm/directory \
--with-mdb=yes

Patch tested on Mac 10.7.5 with Apple-supported Java 1.6, and on Mac 10.8.5 with Oracle Java 1.7 install. Not tested on Mac 10.6.8, yet.

On a documentation note, the location of .jar extensions on Mac, for the extra .jar files noted on the MDB driver page, regardless of Apple or Oracle Java install, is:

/Library/Java/Extensions/

Attachments (1)

gdal-mdb-patch.diff (8.8 KB ) - added by larrysh 11 years ago.
patch to find Java installs on Mac for MDB driver

Download all attachments as: .zip

Change History (8)

comment:1 by Even Rouault, 11 years ago

You must provide a diff on the configure.in, not configure. configure is generated from configure.in

by larrysh, 11 years ago

Attachment: gdal-mdb-patch.diff added

patch to find Java installs on Mac for MDB driver

comment:2 by larrysh, 11 years ago

Well, that was embarrassing. :) Formatted the configure patch for the Mac homebrew project and completely spaced editing configure.in.

Patch attachment replaced and reformatted with edits to configure.in and m4/acinclude.m4 (adding a new macro, AC_CHECK_FW_FUNC) and based off of current SVN trunk. Not sure if there is a cleaner means of testing for a symbol in a framework than adding that macro.

Now tested on:

  • Mac OS X 10.6.8 (default Java 1.6.0)
  • Mac OS X 10.7.5 (default Java 1.6.0)
  • Mac OS X 10.8.5 (Oracle Java 1.7.0 install)

Don't have 10.5 anymore, or latest 10.9 to test. I suspect 10.9 will be no different than 10.8, since Java is no longer included by default, i.e. will use Oracle install.

comment:3 by Even Rouault, 11 years ago

Component: OGR_SFConfigBuild
Milestone: 2.0
Resolution: fixed
Status: newclosed

I've just verified that it still works on Linux.

trunk r26534 "configure: fix so that Java installs are found on the MAC to enable the MDB driver (patch by larrysh, #5267)"

comment:4 by larrysh, 11 years ago

I see the milestone was set for 2.0 release. Any reason this should not be included in the 1.10.2 release, since it is essentially a configure issue?

I would like to note when the configure patch should be removed in my Mac homebrew pull request code.

comment:5 by Even Rouault, 11 years ago

There's always the possibility that it breaks in subtle ways we didn't see. And I'm always more shy backporting code I didn't write myself. So let it settle a bit in trunk before considering backporting.

comment:6 by larrysh, 11 years ago

I understand. Thank you for the reply.

comment:7 by Even Rouault, 10 years ago

Milestone: 2.01.11.0
Note: See TracTickets for help on using tickets.