Mantis - Resin
Viewing Issue Advanced Details
4004 minor always 04-19-10 10:44 02-18-11 17:15
emil  
ferg  
normal  
closed 4.0.4  
fixed  
none    
none 4.0.16  
0004004: solaris 10 jni build issue
(rep by skippopotamus via forum)

Then I used ./configure --disable-ssl --prefix=/appservers/resin-pro-4.0.4 --enable-64bit --with-java-home=/usr/jdk/jdk1.6.0_18

Resin Configuration summary:

RESIN_HOME: /appservers/resin-pro-4.0.4
root: /var/www
conf: /etc/resin
log : /var/log/resin
init: /etc/init.d/resin

JAVA_HOME: /usr/jdk/jdk1.6.0_18

+ 64-bit JNI in -I/usr/jdk/jdk1.6.0_18/include -I/usr/jdk/jdk1.6.0_18/include/solaris
+ JNI CFLAGS: -g -O2 -DPOLL -D_POSIX_PTHREAD_SEMANTICS -DB64 -m64 -D__SOLARIS__ -DHAS_JVMTI
+ poll() for keepalives
+ not using OpenSSL

-bash-3.00$ make
Makefile:282: warning: overriding commands for target `modules/c/src/Makefile'
Makefile:272: warning: ignoring old commands for target `modules/c/src/Makefile'
(cd modules/c/src; make)
make[1]: Entering directory `/export/home/nbbs/resin-pro-4.0.4/modules/c/src'
for dir in common resin_os resin resinssl; do (cd $dir; make); done
make[2]: Entering directory `/export/home/nbbs/resin-pro-4.0.4/modules/c/src/common'
gcc -c -g -O2 -DPOLL -D_POSIX_PTHREAD_SEMANTICS -DB64 -m64 -D__SOLARIS__ -DHAS_JVMTI stream.c
stream.c: In function `select_host':
stream.c:1394: warning: cast from pointer to integer of different size
gcc -c -g -O2 -DPOLL -D_POSIX_PTHREAD_SEMANTICS -DB64 -m64 -D__SOLARIS__ -DHAS_JVMTI config.c
gcc -c -g -O2 -DPOLL -D_POSIX_PTHREAD_SEMANTICS -DB64 -m64 -D__SOLARIS__ -DHAS_JVMTI memory.c
/export/home/nbbs/resin-pro-4.0.4/libtool --silent --mode=compile gcc -o stream.lo -c -g -O2 -DPOLL -D_POSIX_PTHREAD_SEMANTICS -DB64 -m64 -D__SOLARIS__ -DHAS_JVMTI stream.c
stream.c: In function `select_host':
stream.c:1394: warning: cast from pointer to integer of different size
/export/home/nbbs/resin-pro-4.0.4/libtool --silent --mode=compile gcc -o config.lo -c -g -O2 -DPOLL -D_POSIX_PTHREAD_SEMANTICS -DB64 -m64 -D__SOLARIS__ -DHAS_JVMTI config.c
/export/home/nbbs/resin-pro-4.0.4/libtool --silent --mode=compile gcc -o memory.lo -c -g -O2 -DPOLL -D_POSIX_PTHREAD_SEMANTICS -DB64 -m64 -D__SOLARIS__ -DHAS_JVMTI memory.c
make[2]: Leaving directory `/export/home/nbbs/resin-pro-4.0.4/modules/c/src/common'
make[2]: Entering directory `/export/home/nbbs/resin-pro-4.0.4/modules/c/src/resin_os'
gcc -g -O2 -DPOLL -D_POSIX_PTHREAD_SEMANTICS -DB64 -m64 -D__SOLARIS__ -DHAS_JVMTI -m64 -DRESIN_HOME=\"/appservers/resin-pro-4.0.4\" -I/usr/jdk/jdk1.6.0_18/include -I/usr/jdk/jdk1.6.0_18/include/solaris -I../common -DCPU=\"sparcv9\" -DOS= -c -o boot.o boot.c
gcc -g -O2 -DPOLL -D_POSIX_PTHREAD_SEMANTICS -DB64 -m64 -D__SOLARIS__ -DHAS_JVMTI -m64 -DRESIN_HOME=\"/appservers/resin-pro-4.0.4\" -I/usr/jdk/jdk1.6.0_18/include -I/usr/jdk/jdk1.6.0_18/include/solaris -I../common -DCPU=\"sparcv9\" -DOS= -c -o java.o java.c
gcc -g -O2 -DPOLL -D_POSIX_PTHREAD_SEMANTICS -DB64 -m64 -D__SOLARIS__ -DHAS_JVMTI -m64 -DRESIN_HOME=\"/appservers/resin-pro-4.0.4\" -I/usr/jdk/jdk1.6.0_18/include -I/usr/jdk/jdk1.6.0_18/include/solaris -I../common -DCPU=\"sparcv9\" -DOS= -c -o jni_os.o jni_os.c
gcc -g -O2 -DPOLL -D_POSIX_PTHREAD_SEMANTICS -DB64 -m64 -D__SOLARIS__ -DHAS_JVMTI -m64 -DRESIN_HOME=\"/appservers/resin-pro-4.0.4\" -I/usr/jdk/jdk1.6.0_18/include -I/usr/jdk/jdk1.6.0_18/include/solaris -I../common -DCPU=\"sparcv9\" -DOS= -c -o jni_jvmti.o jni_jvmti.c
gcc -g -O2 -DPOLL -D_POSIX_PTHREAD_SEMANTICS -DB64 -m64 -D__SOLARIS__ -DHAS_JVMTI -m64 -DRESIN_HOME=\"/appservers/resin-pro-4.0.4\" -I/usr/jdk/jdk1.6.0_18/include -I/usr/jdk/jdk1.6.0_18/include/solaris -I../common -DCPU=\"sparcv9\" -DOS= -c -o jni_socket.o jni_socket.c
jni_socket.c: In function `Java_com_caucho_vfs_JniServerSocketImpl_bindPort' :
jni_socket.c:691: warning: passing arg 2 of `getsockname' from incompatible pointer type
gcc -g -O2 -DPOLL -D_POSIX_PTHREAD_SEMANTICS -DB64 -m64 -D__SOLARIS__ -DHAS_JVMTI -m64 -DRESIN_HOME=\"/appservers/resin-pro-4.0.4\" -I/usr/jdk/jdk1.6.0_18/include -I/usr/jdk/jdk1.6.0_18/include/solaris -I../common -DCPU=\"sparcv9\" -DOS= -c -o memory.o memory.c
gcc -g -O2 -DPOLL -D_POSIX_PTHREAD_SEMANTICS -DB64 -m64 -D__SOLARIS__ -DHAS_JVMTI -m64 -DRESIN_HOME=\"/appservers/resin-pro-4.0.4\" -I/usr/jdk/jdk1.6.0_18/include -I/usr/jdk/jdk1.6.0_18/include/solaris -I../common -DCPU=\"sparcv9\" -DOS= -c -o std.o std.c
gcc -G -fPIC -o libresin_os.so boot.o java.o jni_os.o jni_jvmti.o jni_socket.o memory.o std.o -lnsl -lsocket -lthread
ld: fatal: file boot.o: wrong ELF class: ELFCLASS64
ld: fatal: File processing errors. No output written to libresin_os.so
collect2: ld returned 1 exit status
make[2]: *** [libresin_os.so] Error 1
make[2]: Leaving directory `/export/home/nbbs/resin-pro-4.0.4/modules/c/src/resin_os'
make[2]: Entering directory `/export/home/nbbs/resin-pro-4.0.4/modules/c/src/resin'
gcc -g -O2 -DPOLL -D_POSIX_PTHREAD_SEMANTICS -DB64 -m64 -D__SOLARIS__ -DHAS_JVMTI -DRESIN_HOME=\"/appservers/resin-pro-4.0.4\" -I/usr/jdk/jdk1.6.0_18/include -I/usr/jdk/jdk1.6.0_18/include/solaris -I../common -DCPU=\"sparcv9\" -DOS= -m64 -fPIC -c -o jni_vfs.o jni_vfs.c
jni_vfs.c:1344:8: warning: extra tokens at end of #endif directive
gcc -g -O2 -DPOLL -D_POSIX_PTHREAD_SEMANTICS -DB64 -m64 -D__SOLARIS__ -DHAS_JVMTI -DRESIN_HOME=\"/appservers/resin-pro-4.0.4\" -I/usr/jdk/jdk1.6.0_18/include -I/usr/jdk/jdk1.6.0_18/include/solaris -I../common -DCPU=\"sparcv9\" -DOS= -m64 -fPIC -c -o profile.o profile.c
gcc -g -O2 -DPOLL -D_POSIX_PTHREAD_SEMANTICS -DB64 -m64 -D__SOLARIS__ -DHAS_JVMTI -DRESIN_HOME=\"/appservers/resin-pro-4.0.4\" -I/usr/jdk/jdk1.6.0_18/include -I/usr/jdk/jdk1.6.0_18/include/solaris -I../common -DCPU=\"sparcv9\" -DOS= -m64 -fPIC -c -o heap.o heap.c
gcc -g -O2 -DPOLL -D_POSIX_PTHREAD_SEMANTICS -DB64 -m64 -D__SOLARIS__ -DHAS_JVMTI -DRESIN_HOME=\"/appservers/resin-pro-4.0.4\" -I/usr/jdk/jdk1.6.0_18/include -I/usr/jdk/jdk1.6.0_18/include/solaris -I../common -DCPU=\"sparcv9\" -DOS= -m64 -fPIC -c -o lru.o lru.c
gcc -g -O2 -DPOLL -D_POSIX_PTHREAD_SEMANTICS -DB64 -m64 -D__SOLARIS__ -DHAS_JVMTI -DRESIN_HOME=\"/appservers/resin-pro-4.0.4\" -I/usr/jdk/jdk1.6.0_18/include -I/usr/jdk/jdk1.6.0_18/include/solaris -I../common -DCPU=\"sparcv9\" -DOS= -m64 -fPIC -c -o symbol.o symbol.c
gcc -g -O2 -DPOLL -D_POSIX_PTHREAD_SEMANTICS -DB64 -m64 -D__SOLARIS__ -DHAS_JVMTI -DRESIN_HOME=\"/appservers/resin-pro-4.0.4\" -I/usr/jdk/jdk1.6.0_18/include -I/usr/jdk/jdk1.6.0_18/include/solaris -I../common -DCPU=\"sparcv9\" -DOS= -m64 -fPIC -c -o stat.o stat.c
gcc -G -fPIC -o libresin.so ../resin_os/std.o ../resin_os/memory.o ../resin_os/java.o jni_vfs.o profile.o heap.o lru.o symbol.o crc64.o stat.o -lnsl -lsocket -lthread
ld: fatal: file ../resin_os/std.o: wrong ELF class: ELFCLASS64
ld: fatal: File processing errors. No output written to libresin.so
collect2: ld returned 1 exit status
make[2]: *** [libresin.so] Error 1
make[2]: Leaving directory `/export/home/nbbs/resin-pro-4.0.4/modules/c/src/resin'
make[2]: Entering directory `/export/home/nbbs/resin-pro-4.0.4/modules/c/src/resinssl'
gcc -g -O2 -DPOLL -D_POSIX_PTHREAD_SEMANTICS -DB64 -m64 -D__SOLARIS__ -DHAS_JVMTI -DRESIN_HOME=\"/appservers/resin-pro-4.0.4\" -I/usr/jdk/jdk1.6.0_18/include -I/usr/jdk/jdk1.6.0_18/include/solaris -I../common -I../resin -DCPU=\"sparcv9\" -DOS= -m64 -fPIC -c -o ssl_stub.o ssl_stub.c
gcc -G -fPIC -o libresinssl.so ssl_stub.o ../resin_os/memory.o ../resin_os/std.o ../resin_os/java.o -lnsl -lsocket -lthread
ld: fatal: file ssl_stub.o: wrong ELF class: ELFCLASS64
ld: fatal: File processing errors. No output written to libresinssl.so
collect2: ld returned 1 exit status
make[2]: *** [libresinssl.so] Error 1
make[2]: Leaving directory `/export/home/nbbs/resin-pro-4.0.4/modules/c/src/resinssl'
make[1]: *** [plugins] Error 2
make[1]: Leaving directory `/export/home/nbbs/resin-pro-4.0.4/modules/c/src'
make: *** [all] Error 2
Both of the following exhibit the error:

-bash-3.00$ uname -a
SunOS mbbs-app1 5.10 Generic_118833-33 sun4u sparc SUNW,Sun-Fire-V215

-bash-3.00$ uname -a
SunOS hostname-a 5.10 Generic_142900-01 sun4v sparc SUNW,SPARC-Enterprise-T5120

Notes
(0004578)
emil   
05-13-10 11:52   
Fixed for amd64 - testing for sparc to follow
(0004728)
alex   
08-17-10 13:45   
rep by Atahualpa Ledesma
SunOS aidlacsapp1 5.10 Generic_142900-07 sun4v sparc SUNW,SPARC-Enterprise-T5120
(0004729)
alex   
08-18-10 12:03   
way to resolve the issue, according to this, there is a bug in gcc versions => 3.4.3 where 64 bit libraries are linked to the 32-bit libgcc.

http://bugs.opensolaris.org/bugdatabase/view_bug.do?bug_id=6328513 [^]

and it's parent bug:

http://bugs.opensolaris.org/bugdatabase/view_bug.do?bug_id=6223255 [^]



This seemed to be the issue, to work around this you need to add -R/usr/sfw/lib/64 to the Makefile.

I tried to do it on the ./configure command line, but it didn't work. So I manually edited all Makefiles and changed this:

LDFLAGS_SHLIB = -m64 -shared -fPIC

To

LDFLAGS_SHLIB = -m64 -shared -fPIC -R/usr/sfw/lib/64


Effectively adding the required path to the right libraries to the linking flags and now the libraries are loaded correctly:
(0004773)
tokyoturnip   
10-04-10 05:14   
Would like to add that on
Alex's note 0004729 did not work for me...

SunOS myserver 5.10 Generic_142900-13 sun4v sparc SUNW,T5140
patched with 123647-04 (gcc patch)
gcc (GCC) 3.4.3 (csl-sol210-3_4-branch+sol_rpath)

However,
I did the following to get the compile and make to work.
CC="gcc -m64" LD="/usr/ccs/bin/ld -wL,-64" CFLAGS=" -O2 -mcpu=v9 -m64" ./configure --disable-ssl --disable-jni --enable-64bit --prefix=/opt/app/itas/resin-4.0.7 --with-apxs=/opt/app/itas/apache_2.2.15-64/bin/apxs --with-java-home=/opt/app/java/jdk1.6.0_18/

I found that although -m64 is specified in CFLAGS, with troubleshooting found that "-m64" was not being passed to the gcc when mod_caucho is being linked. but setting CC="ggc -m64" seems to work around that issue.
Simularly attempting to pass -64 in LDFLAGS does not seem to pass to LD when the libtool is run during make. But setting LD="/usr/ccs/bin/ld -wL,-64" seems to work around the issue.

This may work with out the gcc patches...I did not figure out the issue of not passing -m64 until after applying patches.