-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix to allow building pljava with Microsoft Visual C
Code changes to allow compilation and linking with Microsoft Visual C. Maven build process conditionalized to to detect Visual C and adjust options appropriately. See msvc-build-notes.txt for full details. Property names updated for clarity
- Loading branch information
Kenneth Olson
committed
Jul 23, 2015
1 parent
328fc5d
commit dbf2bdc
Showing
8 changed files
with
205 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
pljava-so/pom.xml is conditionalized for Microsoft Visual C versus | ||
other platforms based on the environment variable VCINSTALLDIR that | ||
is defined in the MSVC vcvars*.bat files. | ||
|
||
The Java architecture and shared library / dll architecture must | ||
match - use a 32-bit JDK if you are building a 32-bit library and | ||
use a 64-bit JDK if you are building a 64-bit library. | ||
|
||
You must define environment variables: | ||
JAVA6_HOME to point to a Java 6 JDK | ||
JAVA_HOME MUST point to the same Java 6 JDK | ||
This Java 6 JDK must be the FIRST Java found on your path | ||
Fail do these things and the pljava-examples project will fail to build. | ||
|
||
For compiling with Microsoft Visual C - | ||
For Visual Studio 2013 - | ||
. In the start menu, find Visual Studio 2013 | Visual Studio Tools and | ||
use one of these links to open the appropriate command window. This | ||
will make sure the appropriate environment variables are defined | ||
for Visual C. (Use one of the "Native Tools Command Prompt" links) | ||
. Or use one of the appropriate command lines below to define the | ||
necessary environment variables. | ||
Visual Studio 2013: | ||
"C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" x86 | ||
"C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" amd64 | ||
Visual Studio 2012: | ||
"C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\vcvarsall.bat" x86 | ||
"C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\vcvarsall.bat" amd64 | ||
Visual Studio 2010: | ||
"C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat" x86 | ||
"C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat" amd64 | ||
|
||
Then, at a command prompt in the pljava folder, use | ||
mvn clean package | ||
to build the requisite jars and dll. The resulting files will be found under the | ||
target directories of the various projects. | ||
|
||
The code and scripts have been tested and build successfully with | ||
Visual Studio 2010, 2012 and 2013 and with Postgresql releases | ||
9.3.4, 9.2.8, 9.1.13, 9.0.17 and 8.4.21. | ||
|
||
The build scripts were conditionalized to allow building with Visual Studio 2013 | ||
in Postgresql versions prior to 9.4. | ||
|
||
The scripts have been verified to continue to work with Linux. They have NOT | ||
been tested with mingw. | ||
|
||
Postgresql 9.4beta1 - | ||
A modification to Oid.c was necessary to accommodate a modified Postgresql API. | ||
|
||
The modifications have been tested with Postgresql 9.4beta1 and build | ||
correctly on Linux. | ||
|
||
While the pljava code compiles with Visual Studio 2013 and Postgresql 9.4beta1, | ||
the link fails with 3 unresolved symbols (which are successfully found in | ||
previous Postgresql releases). This appears to be an artifact of the use of | ||
Visual Studio 2013 to compile Postgresql 9.4beta1. I have not had a chance to | ||
rebuild Postgresql 9.4beta1 from source to determine a workaround. | ||
|
||
About the code changes for Visual Studio compilation: | ||
Backend.c - need to dllexport functions referenced by Java JNI calls. | ||
Function.c - need to define macros for strcasecmp and strncasecmp. | ||
JNICalls.c - cannot change the linkage of previously declared fields.** | ||
Oid.c - conditionalized code foe method signature change in 9.4. | ||
Timestamp.c - cannot change the linkage of previously declared fields.** | ||
Commands.java - removed reference to column no longer in pljava schema. | ||
jvm.def - removed file (defines jvm exports, not pljava exports, causes link errors) | ||
|
||
** These fields are the ones that become unresolved when linking against 9.4. I | ||
suspect that ultimately the correct solution would be for Postgresql to declare | ||
these dllexport and then adjusting the conditionalization in pljava to account | ||
for this in 9.4 and above. | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters