Hi Rainer,

Thanks for your hint, I think I've found out the root cause.

When I first compile openssl 1.1.0, the binaries have been installed to 
/usr/local/openssl, the libcrypto.so.1.1 has been installed to 
/usr/local/openssl/lib/.

After I re-installed openssl 1.0.2j, the files in /usr/local/openssl has been 
replaced, however the libcrypto.so.1.1 is still there, because openssl 1.0.x 
did not produce that file.

So when I recompile tc-native 1.2.10, with --with-ssl=/usr/local/openssl 
(1.0.2j), the libcrypto.so.1.1 is referenced, where get_rfc3526_prime_8192 is 
not exist.

Following is the output:

$objdump -p 
/home/admin/tomcat/tcnative/tomcat-native-1.2.10-src/native/.libs/libtcnative-1.so.0.2.10

/home/admin/tomcat/tcnative/tomcat-native-1.2.10-src/native/.libs/libtcnative-1.so.0.2.10:
     file format elf64-x86-64

Program Header:
    LOAD off    0x0000000000000000 vaddr 0x0000000000000000 paddr 
0x0000000000000000 align 2**21
         filesz 0x0000000000028244 memsz 0x0000000000028244 flags r-x
    LOAD off    0x0000000000028248 vaddr 0x0000000000228248 paddr 
0x0000000000228248 align 2**21
         filesz 0x0000000000001450 memsz 0x0000000000001b50 flags rw-
 DYNAMIC off    0x00000000000282c8 vaddr 0x00000000002282c8 paddr 
0x00000000002282c8 align 2**3
         filesz 0x0000000000000200 memsz 0x0000000000000200 flags rw-
    NOTE off    0x0000000000000190 vaddr 0x0000000000000190 paddr 
0x0000000000000190 align 2**2
         filesz 0x0000000000000024 memsz 0x0000000000000024 flags r--
EH_FRAME off    0x0000000000023594 vaddr 0x0000000000023594 paddr 
0x0000000000023594 align 2**2
         filesz 0x0000000000000dbc memsz 0x0000000000000dbc flags r--
   STACK off    0x0000000000000000 vaddr 0x0000000000000000 paddr 
0x0000000000000000 align 2**3
         filesz 0x0000000000000000 memsz 0x0000000000000000 flags rw-

Dynamic Section:
  NEEDED               libssl.so.1.1
  NEEDED               libcrypto.so.1.1
  NEEDED               libapr-1.so.0
  NEEDED               librt.so.1
  NEEDED               libcrypt.so.1
  NEEDED               libpthread.so.0
  NEEDED               libc.so.6
  SONAME               libtcnative-1.so.0
  RPATH                /usr/local/apr/lib:/usr/local/openssl/lib
  INIT                 0x000000000000f2e0
  FINI                 0x00000000000225a8
  GNU_HASH             0x00000000000001b8
  STRTAB               0x0000000000005cf0
  SYMTAB               0x0000000000000de8
  STRSZ                0x0000000000005b7e
  SYMENT               0x0000000000000018
  PLTGOT               0x0000000000228588
  PLTRELSZ             0x0000000000002c58
  PLTREL               0x0000000000000007
  JMPREL               0x000000000000c688
  RELA                 0x000000000000bf98
  RELASZ               0x00000000000006f0
  RELAENT              0x0000000000000018
  VERNEED              0x000000000000bf08
  VERNEEDNUM           0x0000000000000004
  VERSYM               0x000000000000b86e
  RELACOUNT            0x0000000000000024

Version References:
  required from libpthread.so.0:
    0x09691a75 0x00 05 GLIBC_2.2.5
  required from libc.so.6:
    0x0d696913 0x00 06 GLIBC_2.3
    0x09691a75 0x00 04 GLIBC_2.2.5
  required from libssl.so.1.1:
    0x066d1f10 0x00 03 OPENSSL_1_1_0
  required from libcrypto.so.1.1:
    0x066d1f10 0x00 02 OPENSSL_1_1_0

$nm /usr/local/openssl/lib/libcrypto.so.1.1 |  grep get_rfc3526_prime_8192
00000000000a4830 T BN_get_rfc3526_prime_8192

The solution will be cleaning up the /usr/local/openssl and re-compile 
tc-native, and everything works fine.

------------------------------------------------------------------
From:Rainer Jung <rainer.j...@kippdata.de>
Time:2016 Oct 8 (Sat) 19:47
To:Tomcat Developers List <dev@tomcat.apache.org>
Subject:Re: [VOTE] Release Apache Tomcat Native 1.2.10


Hi,

Am 08.10.2016 um 05:08 schrieb Huxing Zhang:
...

>      [echo] tc.library.path = 
> /home/admin/tomcat/tcnative/tomcat-native-1.2.10-src/native/.libs

>      [echo] Running Tomcat Native Echo example ...
>      [java] Exception in thread "main" java.lang.UnsatisfiedLinkError: 
> /home/admin/tomcat/tcnative/tomcat-native-1.2.10-src/native/.libs/libtcnative-1.so.0.2.10:
>  
> /home/admin/tomcat/tcnative/tomcat-native-1.2.10-src/native/.libs/libtcnative-1.so.0.2.10:
>  undefined symbol: get_rfc3526_prime_8192
>      [java]     at java.lang.ClassLoader$NativeLibrary.load(Native Method)
>      [java]     at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1938)
>      [java]     at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1854)
>      [java]     at java.lang.Runtime.loadLibrary0(Runtime.java:870)
>      [java]     at java.lang.System.loadLibrary(System.java:1122)
>      [java]     at org.apache.tomcat.jni.Library.<init>(Unknown Source)
>      [java]     at org.apache.tomcat.jni.Library.initialize(Unknown Source)
>      [java]     at org.apache.tomcat.jni.Echo.main(Unknown Source)
>      [java] Java Result: 1

The symbol get_rfc3526_prime_8192 is part of OpenSSL even in 0.9.8. 
Let's try to find out, why it can't be found.

Assuming Linux for the following.

First look at your library file 
/home/admin/tomcat/tcnative/tomcat-native-1.2.10-src/native/.libs/libtcnative-1.so.0.2.10.
 
Check whether is has an external dependency on libcrypto, what is the 
RUNPATH and/or whether the symbols are statically compiled in:

- What is the output of "objdump -p 
/home/admin/tomcat/tcnative/tomcat-native-1.2.10-src/native/.libs/libtcnative-1.so.0.2.10"?

- What is the output of "nm 
/home/admin/tomcat/tcnative/tomcat-native-1.2.10-src/native/.libs/libtcnative-1.so.0.2.10
 
| grep get_rfc3526_prime_8192"?

Next: assuming you linked against the dynamic libcrypto library, where 
is your libcrypto.so.1.0.0 for OpenSSL 1.0.2 located? Is it inside 
/home/admin/tomcat/tcnative/tomcat-native-1.2.10-src/native/.libs 
(unlikely) or somewhere else? How is Java expected to find it there? Did 
you add the directory to LD_LIBRARY_PATH?

Finally check the libcrypto.so.1.0.0 from OpenSSL 1.0.2 whether it 
contains the symbol: what's the output of "nm 
/path/to/my/libcrypto.so.1.0.0 | grep get_rfc3526_prime_8192"?

Regards,

Rainer




---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to