os.arch='ppc64'
To link objects into a shared library, the (-fPIC) flag
is needed and the wrapper bin compiles only with the
math library (-lm).
With this two changes, the library (libwrapper.so) will
compile as an 'ELF 32-bit MSB shared object'.
When you use the 64-bit release of IBM JDK 1.4.x or 1.
5, loading of libwrapper.so fails with the following
error:
java.lang.NullPointerException
at java.lang.ClassLoader.loadLibrary0(ClassLoader.
java:2171)
at java.lang.ClassLoader.loadLibrary(ClassLoader.
java:1975)
at java.lang.Runtime.load0(Runtime.java:773)
at java.lang.System.load(System.java:885)
at test.loadNativeLibrary(test.java:13)
at test.main(test.java:6)
(great error message...)
This happens, because the IBM JDK cannot load a 32-bit
library into a 64-bit environment. To solve the
problem, compile the wrapper project with the (-m64)
flag.
Note: The 'glibc-devel-2.3.x-y.z.ppc64.rpm' (64-bit)
must be installed on the system!
After this, the library is load fine into the IBM JDK.
With the 'file' command can you check the type:
# file libwrapper.so
libwrapper.so: ELF 64-bit MSB shared object, PowerPC or
cisco 7500, version 1 (SYSV), not stripped
The attachement contains all changes to compile the
project as 64-bit version.
Logged In: NO
here the Makefile
------------------
COMPILE = gcc -m64 -fPIC -O3 -Wall --pedantic -pthread -
DUSE_NANOSLEEP
INCLUDE=$(JAVA_HOME)/include
DEFS = -I$(INCLUDE) -I$(INCLUDE)/linux
wrapper_SOURCE = wrapper.c wrapperinfo.c wrappereventloop.c
wrapper_unix.c property.c logger.c
libwrapper_so_OBJECTS = wrapperjni_unix.o wrapperinfo.o
wrapperjni.o
BIN = ../../bin
LIB = ../../lib
all: init wrapper libwrapper.so
clean:
rm -f *.o
cleanall: clean
rm -rf *~ .deps
rm -f $(BIN)/wrapper $(LIB)/libwrapper.so
init:
if test ! -d .deps; then mkdir .deps; fi
wrapper: $(wrapper_SOURCE)
$(COMPILE) $(wrapper_SOURCE) -lm -o $(BIN)/wrapper
libwrapper.so: $(libwrapper_so_OBJECTS)
${COMPILE} -shared $(libwrapper_so_OBJECTS) -o $(LIB)/
libwrapper.so
%.o: %.c
@echo '$(COMPILE) -c $<'; \ $(COMPILE) $(DEFS) -Wp,-MD,.deps/$(*F).pp -c $<
@-cp .deps/$(*F).pp .deps/$(*F).P; \ tr ' ' '\012' < .deps/$(*F).pp \ | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/
$$/ :/' \ >> .deps/$(*F).P; \ rm .deps/$(*F).pp