Bug #3837
closedCannot locate the built PHP extension in Saxon/HE for Mac OS X
Added by Malcolm Fitzgerald over 6 years ago. Updated about 5 years ago.
100%
Description
The install docs say "A built php extension module is included in the Saxon/C distribution, see the directory 'php-library-module'. See the file saxon.so (Available for Linux and Mac OS). This was built using the php 7.2 version."
I can't see php-library-module in the zip download.
I've attempted to build the module but the build fails because jni.h cannot be found.
any suggestions?
Malcolm
Updated by O'Neil Delpratt over 6 years ago
Hi,
You can add the jni files to the environment variable LD_LIBRARY_PATH On a linux machine it is can usually be found here: /usr/lib/jvm/java-6-openjdk-amd64/include/linux
export LD_LIBRARY_PATH=/usr/lib/rt/amd64:/usr/lib/jvm/java-6-openjdk-amd64/include/linux:/usr/lib/jvm/java-6-openjdk-amd64/include:$LD_LIBRARY_PATH
You could also try adding the JAVA_HOME include to the CPLUS_INCLUDE_PATH variable.
CPLUS_INCLUDE_PATH=$JAVA_HOME/include/linux:$JAVA_HOME/include export CPLUS_INCLUDE_PATH
Alternately you can edit references of jni.h in SaxonCGlue.h to a local copy:
change:
#include <jni.h>
To:
#include "jni/jni.h"
You can download here: https://dev.saxonica.com/repos/archive/opensource/latest9.8/hec/Saxon.C.API/jni/
Updated by O'Neil Delpratt over 6 years ago
On the mac OS X use the following environment variable:
DYLD_LIBRARY_PATH
Updated by Malcolm Fitzgerald over 6 years ago
The install docs suggest this too and my profile includes these lines.
export JET_HOME="/usr/local/lib/rt" export DYLD_LIBRARY_PATH="$JET_HOME/lib/jetvm:$DYLD_LIBRARY_PATH"
This is the output I get. ~ echo $DYLD_LIBRARY_PATH /usr/local/lib/rt/lib/jetvm:
I'm guessing that I need to supply a path that leads it to jni.h, no?
Malcolm
On 9/07/2018, at 10:12 PM, Saxonica Developer Community notifications@plan.io wrote:
Updated by Malcolm Fitzgerald over 6 years ago
Thanks for your suggestions. I followed your advice, using DYLD_LIBRARY_PATH.
I located jni.h in /System/Library/Frameworks/JavaVM.framework/Headers and modified the environment to include that path, however I still get the same error when I run make.
I tried modifying SaxonCGlue.h to use that version of jni.h and still got the same error.
I downloaded jni.h and jni_md.h and installed them locally and ran make. A different set of errors were described. So I copied jni.h and jni_md.h into the working directory and ran make again. The same set of errors were found.
I'm not familiar with building code from sources, so I'm probably bumping into problems that are trivial. In any case, the errors are shown below.
/bin/sh /Users/malcolm/Downloads/libsaxon-HEC-mac-setup-v1.1.0/Saxon.C.API/libtool --mode=compile cc -I. -I/Users/malcolm/Downloads/libsaxon-HEC-mac-setup-v1.1.0/Saxon.C.API -DPHP_ATOM_INC -I/Users/malcolm/Downloads/libsaxon-HEC-mac-setup-v1.1.0/Saxon.C.API/include -I/Users/malcolm/Downloads/libsaxon-HEC-mac-setup-v1.1.0/Saxon.C.API/main -I/Users/malcolm/Downloads/libsaxon-HEC-mac-setup-v1.1.0/Saxon.C.API -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /Users/malcolm/Downloads/libsaxon-HEC-mac-setup-v1.1.0/Saxon.C.API/SaxonCGlue.c -o SaxonCGlue.lo cc -I. -I/Users/malcolm/Downloads/libsaxon-HEC-mac-setup-v1.1.0/Saxon.C.API -DPHP_ATOM_INC -I/Users/malcolm/Downloads/libsaxon-HEC-mac-setup-v1.1.0/Saxon.C.API/include -I/Users/malcolm/Downloads/libsaxon-HEC-mac-setup-v1.1.0/Saxon.C.API/main -I/Users/malcolm/Downloads/libsaxon-HEC-mac-setup-v1.1.0/Saxon.C.API -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /Users/malcolm/Downloads/libsaxon-HEC-mac-setup-v1.1.0/Saxon.C.API/SaxonCGlue.c -fno-common -DPIC -o .libs/SaxonCGlue.o In file included from /Users/malcolm/Downloads/libsaxon-HEC-mac-setup-v1.1.0/Saxon.C.API/SaxonCGlue.c:1: ./SaxonCGlue.h:37:23: error: cannot combine with previous 'char' declaration specifier typedef unsigned char bool; ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/9.1.0/include/stdbool.h:31:14: note: expanded from macro 'bool' #define bool _Bool ^ In file included from /Users/malcolm/Downloads/libsaxon-HEC-mac-setup-v1.1.0/Saxon.C.API/SaxonCGlue.c:1: ./SaxonCGlue.h:37:1: warning: typedef requires a name [-Wmissing-declarations] typedef unsigned char bool; ^~~~~~~~~~~~~~~~~~~~~~~~~~ ./SaxonCGlue.h:38:19: error: expected identifier or '(' static const bool false = 0; ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/9.1.0/include/stdbool.h:33:15: note: expanded from macro 'false' #define false 0 ^ In file included from /Users/malcolm/Downloads/libsaxon-HEC-mac-setup-v1.1.0/Saxon.C.API/SaxonCGlue.c:1: ./SaxonCGlue.h:39:19: error: expected identifier or '(' static const bool true = 1; ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/9.1.0/include/stdbool.h:32:14: note: expanded from macro 'true' #define true 1 ^ /Users/malcolm/Downloads/libsaxon-HEC-mac-setup-v1.1.0/Saxon.C.API/SaxonCGlue.c:300:118: error: expected ')' jobject createSaxonProcessor (JNIEnv* penv, jclass myClassInDll, const char * arguments, jobject argument1, jboolean license) ^ ./SaxonCGlue.h:50:19: note: expanded from macro 'license' #define license false ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/9.1.0/include/stdbool.h:33:15: note: expanded from macro 'false' #define false 0 ^ /Users/malcolm/Downloads/libsaxon-HEC-mac-setup-v1.1.0/Saxon.C.API/SaxonCGlue.c:300:30: note: to match this '(' jobject createSaxonProcessor (JNIEnv* penv, jclass myClassInDll, const char * arguments, jobject argument1, jboolean license) ^ /Users/malcolm/Downloads/libsaxon-HEC-mac-setup-v1.1.0/Saxon.C.API/SaxonCGlue.c:300:118: error: parameter name omitted jobject createSaxonProcessor (JNIEnv* penv, jclass myClassInDll, const char * arguments, jobject argument1, jboolean license) ^ ./SaxonCGlue.h:50:19: note: expanded from macro 'license' #define license false ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/9.1.0/include/stdbool.h:33:15: note: expanded from macro 'false' #define false 0 ^ 1 warning and 5 errors generated. make: *** [SaxonCGlue.lo] Error 1
~
On 9/07/2018, at 8:53 PM, Saxonica Developer Community notifications@plan.io wrote:
Updated by O'Neil Delpratt over 6 years ago
- Category set to Mac Os X
- Status changed from New to In Progress
- Assignee set to O'Neil Delpratt
- Priority changed from Low to Normal
Hi,
There seems to be some conflict with the use of defining bool.
To avoid this conflict I have changed the name of the variable. Please can you replace the files SaxonCGlue.h and SaxonCProcessor.c with the following:
https://dev.saxonica.com/repos/archive/opensource/latest9.8/hec/Saxon.C.API/HEC/SaxonCGlue.h https://dev.saxonica.com/repos/archive/opensource/latest9.8/hec/Saxon.C.API/SaxonCProcessor.c
Updated by O'Neil Delpratt over 6 years ago
Hi,
with those changes mentioned in comment #1 and comment #5 I have managed to successfully build a PHP 7 Saxon/C extension module.
This fix will go into the next release of Saxon/C. It should work for you.
Please let me know if you succeed in your build.
Updated by Malcolm Fitzgerald over 6 years ago
Hi,
After replacing the two files the make command runs successfully. Saxon.so is sitting in the modules folder.
thanks for your help,
Malcolm
On 10/07/2018, at 11:07 PM, Saxonica Developer Community notifications@plan.io wrote:
Updated by Malcolm Fitzgerald over 6 years ago
Hi,
To follow up, the build was successful. Installing with sudo make install on OSX10.13 fails because of SIP protections. Advice on StackOverflow is to install to /usr/local/bin not to /usr/bin. Alternately, temporarily remove SIP protections, install, then replace SIP protection, which is what I did.
Calling phpinfo() shows Saxon/C enabled Saxon/C EXT version 1.1.0 Saxon 9.8.0.4 Excelsior JET 11.3 MP1
thanks for your help getting Saxon/C installed.
Some notes from the installation. The readme.md provided, formatted with markdown code, includes this section: The DYLD_LIBRARY_PATH environment variable must be set as follows:
export JET_HOME=/usr/local/lib/rt export DYLD_LIBRARY_PATH=$JET_HOME/lib/lib/jetvm:$DYLD_LIBRARY_PATH
This isn't indented, so the underscores are treated as formatting instructions, making it necessary to read the document in a plain text editor.
Also, the path has a lib directory nested in a lib directory. Is that correct?
Malcolm
On 10/07/2018, at 11:14 PM, Saxonica Developer Community notifications@plan.io wrote:
Updated by O'Neil Delpratt over 6 years ago
Malcolm Fitzgerald wrote:
thanks for your help getting Saxon/C installed.
Glad it now works for you.
Some notes from the installation. The readme.md provided, formatted with markdown code, includes this section: The DYLD_LIBRARY_PATH environment variable must be set as follows:
export JET_HOME=/usr/local/lib/rt export DYLD_LIBRARY_PATH=$JET_HOME/lib/lib/jetvm:$DYLD_LIBRARY_PATH
This isn't indented, so the underscores are treated as formatting instructions, making it necessary to read the document in a plain text editor.
Thanks. I will fix this shortly.
Also, the path has a lib directory nested in a lib directory. Is that correct?
No this is not correct.
Updated by O'Neil Delpratt over 6 years ago
Hi,
A better solution than detailed in comment #1 is the following:
./configure --enable-saxon CPPFLAGS="-Ijni"
We just have to make sure the jni headers are in the local directory jni
I have also reverted the change made in SaxonCGlue.h to the following:
#include <jni.h>
Updated by O'Neil Delpratt over 5 years ago
- Tracker changed from Support to Bug
- Status changed from In Progress to Resolved
- % Done changed from 0 to 100
- Found in version set to 1.1.0
Bug fixed and available in the next maintenance release.
Updated documentation as mentioned in comment #9.
Updated by O'Neil Delpratt about 5 years ago
- Status changed from Resolved to Closed
- Fixed in version set to 1.2.0
Big fix applied in the Saxon/C 1.2.0 release.
Please register to edit this issue