Friday, May 13, 2011

64 bit Edge Openssl Does Not Like Me

‹prev | My Chain | next›

Tonight I think I will explore node-spdy a little. Especially after it helped me solve my minor zlib issue yesterday, I am eager to kick the tires.

Unfortunately, things get off to a poor start:
➜  test git:(master) ✗ node spdy-server.js 

throw e; // process.nextTick error, or 'error' event on first tick
You're using not NPN-enabled version of node.js
Hunh? I know I installed it against the NPN-enabled openssl. What does ldd tell me?
➜  test git:(master) ✗ pwd           
➜ test git:(master) ✗ which node
➜ test git:(master) ✗ ldd `which node` => (0x00007fff4f2bc000) => /lib/x86_64-linux-gnu/ (0x00007f6a4e4b7000) => /lib/ (0x00007f6a4e264000) => /lib/ (0x00007f6a4ded4000) => /lib/x86_64-linux-gnu/ (0x00007f6a4dcd0000) => /lib/x86_64-linux-gnu/ (0x00007f6a4dacd000) => /usr/lib/x86_64-linux-gnu/ (0x00007f6a4d7c6000) => /lib/x86_64-linux-gnu/ (0x00007f6a4d541000) => /lib/x86_64-linux-gnu/ (0x00007f6a4d32b000) => /lib/x86_64-linux-gnu/ (0x00007f6a4d10c000) => /lib/x86_64-linux-gnu/ (0x00007f6a4cd78000)
/lib64/ (0x00007f6a4e6e7000) => /lib/x86_64-linux-gnu/ (0x00007f6a4cb60000)
Now just a cotton picking second. How is that linked against the old 0.9 openssl libraries, I very specifically built it against the 1.0 / NPN enabled version of openssl:
./configure --openssl-includes=$HOME/local/include/openssl --openssl-libpath=$HOME/local/lib/openssl --prefix=$HOME/local/node-v0.5.0-pre
But... there are no openssl shared libraries in my $HOME/local directory:
➜ test git:(master) ✗ find $HOME/local/lib | grep openssl\.\*so
Well, that explains why node is linked against the system (old) openssl. But what gives?

Eventually, I realize that I ought to be able to build the shared objects directly:
➜  openssl  make               
make[1]: Entering directory `/home/cstrom/repos/openssl'
make[2]: Entering directory `/home/cstrom/repos/openssl'
/usr/bin/ld: libcrypto.a(e_gost_err.o): relocation R_X86_64_32 against `.data' can not be used when making a shared object; recompile with -fPIC
libcrypto.a(e_gost_err.o): could not read symbols: Bad value
collect2: ld returned 1 exit status
make[2]: *** [link_a.gnu] Error 1
make[2]: Leaving directory `/home/cstrom/repos/openssl'
make[1]: *** [do_linux-shared] Error 2
make[1]: Leaving directory `/home/cstrom/repos/openssl'
make: *** [] Error 2

I find an open openssl ticket which seem vaguely similar. So I download an apply the second patch:
➜  openssl  wget
➜ openssl patch -p0 < openssl-dev.diff
patching file crypto/aes/asm/
patching file crypto/rc4/asm/
patching file crypto/
And then I run through the compilation steps one more time:
➜  openssl  ./config --prefix=$HOME/local
➜ openssl make depend
➜ openssl make
Unfortunately, I still end up with the same R_X86_64_32 relocation error. I try passing in various options (-fPIC and -m32), but to no avail. I just cannot seem to get this installed on a 64 bit system.

Ah well, definitely a worthwhile sidebar. I will pick this back up tomorrow by installing on my 32 bit VM. I will also pursue further on the openssl mailing list.

Day #19

No comments:

Post a Comment