Forum OpenACS Q&A: When building nsopenssl-2.1a I get the "OpenSSL was not compiled with thread support!" error

Hi,

I'm trying to build nsopenssl-2.1a and I get the following error "OpenSSL was not compiled with thread support!".

I'm using aolserver-3.3+ad13 and Red Hat Enterprise Linux ES 3 with an up2date version of openssl-0.9.7a-33.17.

I read the Red Hat 9 and OpenACS 4.6.2 forum (https://openacs.org/forums/message-view?message_id=92882) and I believe my error is different since nsopenssl's 2.1a version of thread.c already comes with "#ifndef OPENSSL_THREADS" and I'm not running into any kerberos problems (but just in case i tried changing the CFLAGS line to include kerberos and got the same result)

I placed the source of nsopenssl in the "root" directory of AOLserver's source:

[aol@my root]$ ls /home/aol/source/root
aolserver arsdigita-aol3 nscache nsopenssl-2.1a nsrewrite nssha1 oracle-driver

And executed gmake as follows:

cd /home/aol/source/root/nsopenssl-2.1a/
make OPENSSL=/home/aol/source/openssl-0.9.8b

And I would get the following output:

gcc -I/home/aol/source/openssl-0.9.8b/include -I../aolserver/include -D_REENTRANT=1 -DNDEBUG=1 -g -fPIC -Wall -Wno-unused -mcpu=i686 -DHAVE_CMMSG=1 -DUSE_FI\
ONREAD=1 -DHAVE_COND_EINTR=1 -c -o nsopenssl.o nsopenssl.c
gcc -I/home/aol/source/openssl-0.9.8b/include -I../aolserver/include -D_REENTRANT=1 -DNDEBUG=1 -g -fPIC -Wall -Wno-unused -mcpu=i686 -DHAVE_CMMSG=1 -DUSE_FI\
ONREAD=1 -DHAVE_COND_EINTR=1 -c -o config.o config.c
gcc -I/home/aol/source/openssl-0.9.8b/include -I../aolserver/include -D_REENTRANT=1 -DNDEBUG=1 -g -fPIC -Wall -Wno-unused -mcpu=i686 -DHAVE_CMMSG=1 -DUSE_FI\
ONREAD=1 -DHAVE_COND_EINTR=1 -c -o init.o init.c
init.c: In function `MakeDriverSSLContext':
init.c:382: warning: assignment from incompatible pointer type
init.c: In function `MakeSockServerSSLContext':
init.c:556: warning: assignment from incompatible pointer type
init.c: In function `MakeSockClientSSLContext':
init.c:731: warning: assignment from incompatible pointer type
gcc -I/home/aol/source/openssl-0.9.8b/include -I../aolserver/include -D_REENTRANT=1 -DNDEBUG=1 -g -fPIC -Wall -Wno-unused -mcpu=i686 -DHAVE_CMMSG=1 -DUSE_FI\
ONREAD=1 -DHAVE_COND_EINTR=1 -c -o ssl.o ssl.c
ssl.c: In function `NsOpenSSLTrace':
ssl.c:343: warning: assignment discards qualifiers from pointer target type
ssl.c:345: warning: assignment discards qualifiers from pointer target type
gcc -I/home/aol/source/openssl-0.9.8b/include -I../aolserver/include -D_REENTRANT=1 -DNDEBUG=1 -g -fPIC -Wall -Wno-unused -mcpu=i686 -DHAVE_CMMSG=1 -DUSE_FI\
ONREAD=1 -DHAVE_COND_EINTR=1 -c -o thread.o thread.c
thread.c:42:2: #error "OpenSSL was not compiled with thread support!"
make: *** [thread.o] Error 1

I guess OpenSSL was REALLY not compiled with thread support. But how do I enable thread support?

I tried uninstalling the openssl rpm (with an rpm -e openssl) so I could install it manually instad of using up2date (doing something like "./confing threaded" before the actual make) but there are many dependencies so I chickened out and did not try a forced uninstall.

Any help would be greatly appreciated! Thanks,

Pedro

I came up with a dirty workaround. I guess this is not a common aolserver-3.3+ad13 problem.

To build aolserver-3.3+ad13 with nsopenssl I did the following:

----------------------------------------------
- Get the source for aolserver-3.3+ad13
    wget http://www.eveandersson.com/arsdigita/acs-repository/log-downloads?software_filename=aolserver-src.tar.gz
- Get the source for nsopenssl-2.1a
    wget http://easynews.dl.sourceforge.net/sourceforge/aolserver/nsopenssl-2.1a.tar.gz
- Get the source for openssl
    wget http://www.openssl.org/source/openssl-0.9.8b.tar.gz
- Untar the sources
- Move the nsopenssl source to the /home/aol3/source direcotry
    mv /home/aol3/source/nsopenssl-2.1a /home/aol3/source/root/
- Build and install AOLserver
    cd /home/aol3/source/root/aolserver
    gmake
    gmake install PREFIX=/home/aol3
- Build and install nsopenssl
    cd /home/aol3/source/root/nsopenssl-2.1a
    export OPENSSL=/home/aol3/source/openssl-0.9.8b
    gmake
    - if you run into the following error "OpenSSL was not compiled with thread support!"
      - comment the lines that throw the error in the thread.c file:
          /* pliska: I commented the lines below! This might bring some future problems */
          /* #ifndef OPENSSL_THREADS */
          /* #error "OpenSSL was not compiled with thread support!" */
          /* #endif */
    - if it can't find the ssl library or the crypto library:
        ln -s /lib/libssl.so.0.9.7a /lib/libssl.so
          - There are new libraries availabe libssl.so.2 and .4! test this in dev
        ln -s /lib/libcrypto.so.0.9.7a /lib/libcrypto.so
          - There are new libraries availabe libcrypto.so.2 and .4! test this in dev
    gmake install INST=/home/aol3
----------------------------------------------

I say this is dirty because I just commented out the code that displays the error message.

Also note that I just obtained the openssl tar.gz to use the code when building nsopenssl by setting the OPENSSL environment variable before the gmake. I'm not sure if this is what I had to do.

Things are working ok but I do get the following errors on the error.log:
- Error:nsopenssl: nsdserver: connection closed by peer
- Error:nsopenssl: error 0/6 during SSL handshake
- Error: nsopenssl: EOF during SSL handshake
- Debug: nsopenssl: nsdserver: NsOpenSSLCreateConn failed

Any comments are appreciated,

Pedro

I guess OpenSSL was REALLY not compiled with thread support. But how do I enable thread support?

read the INSTALL file in the openssl source directory and/or
type there ./Configure --help

You should be able to install openssl in the aolserver tree, make sure you can load shared libraries from there, and recompile ns_openssl with that source-tree/installation.

commenting out the warning message is not a solution.

-gustaf
PS: we are not using nsopenssl.

Gustaf,

This time I compiled and installed OpenSSL before compiling and installing nsopenssl

# compile and install OpenSSL
cd /home/aol3/source/openssl-0.9.8b
./config --prefix=/home/aol3/openssl
gmake
gmake install

# compile and install nsopenssl
cd /home/aol3/source/root/nsopenssl-2.1a
export OPENSSL=/home/aol3/openssl
gmake
gmake install INST=/home/aol3

When running building nsopenssl I did not get the"OpenSSL was not compiled with thread support!" error!

But I do run into other issues now. When I run AOLserver, all the http pages work just fine. But when I hit the first https page, I get the following error message:

"*** glibc detected *** double free or corruption (!prev): 0x08ff3548 ***
Aborted"

and the AOLserver process dies.

I guess I'm one step closer to solving this problem. Thanks for your help Gustaf!

Pedro

pedro,

why you are building still an aolserver 3.*? I would expect, that the problem disappears, when you use aolserver 4.*.

However, if you have to go the hard way, i would recommend that you post the problem into the aolserver mailing list (with exact version numbers of tcl, aolserver, openssl, glibc, your operating system, architecture, etc.)

-gustaf neumann

Hi Gustaf,

I'm running ACS-3.4.9, and for a while I've been getting the nsopenssl errors mentioned above. So I took the task of recompiling AOLserver-3.3.1+ad13 to see if the errors disappeared.

I now believe the errors occur because OpenSSL is not compiled with thread support on the box. The person that originally installed everything on the box didn't compile the AOLserver, he just copied the executables, so he had no way of knowing what was going on.

We have a lot of in house code written for this ACS system and migrating to OpenACS would be HARD work (https://openacs.org/forums/message-view?message_id=250524). I'll probably end up doing this some day.

Before posting to the AOLserver mailing list I'll try running ACS 3 on AOLserver 4. I have not tried this because of the ad13 part in AOLserver-3.3.1+ad13 but who knows, maybe I'll be extremely lucky and get it working =). If you know this just won't work, please let me know.

Thanks!

Pedro

Collapse
Posted by Andrew Piskorski on
Ah, so you work with Eve, Pedro?

Using AOLserver 4.0.x or 4.5.x will probably work for ACS 3.4.9, but you might have to tweak a few things. AFAIK, all the ad13 features that you should need to run ACS were eventually forward-ported to AOLserver 4.0.x. I don't know whether they kept the exact same API or not in all cases though, particularly for the character set stuff.

I don't think 4.0.x includes the ad13 Tcl bytecode cache, which might be a performance issue if your site is very busy. Then again, some very large sites (like Gustaf's) are running on OpenACS + AOLserver 4.x, and they don't seem to have missed it.

Collapse
Posted by Pedro Liska on
Thanks for your help Andrew. I'll try this out as soon as I get a chance.

Pedro

PS: I do work with Eve, she's awesome. I see you also worked with her in the ArsDigita times =)

I finally got a chance to get back to this and had some successes and failures.

As a recap, I was getting the "OpenSSL was not compiled with thread support!" error because I was using an up2date installation of OpenSSL (through the Red Hat Network for Enterprise Linux ES release 4). I'm now using a local installation of OpenSSL. Since I did that, I stopped getting the "OpenSSL was not compiled with thread support!" error. I'm now also using a local installation of Tcl, just to make sure I have threads enabled (--enable_threads).

After getting the "thread support" error out of the way I ran into other problems that lead me to trying out AOLserver 4.5. I WAS able to run ACS 3.4.9 under AOLserver 4.5 =). I just had to tweak the ReturnHeaders proc (like Andrew said). I tweaked it based on the ReturnHeaders proc of OpenACS.

But I ran into problems when trying to get SSL working. My ideal configuration would be AOLserver 4.5 and nsopenssl-2.1a but I also tried getting nsopenssl-3.0beta26 to work.

When gmake'ing nsopenssl-2.1a I get the following error:

------------------------------------------------------------------
[root@predevlms nsopenssl-2.1a]# gmake OPENSSL=/usr/local/ssl
gcc -pipe -I/usr/local/ssl/include -O2 -Wall -Wno-implicit-int -fno-strict-aliasing -fPIC -I/usr/local/aolserver/include -I/usr/local/aolserver/include -DNO_CONST -DHAVE_LIMITS_H=1 -DHAVE_UNISTD_H=1 -DHAVE_SYS_PARAM_H=1 -DUSE_THREAD_ALLOC=1 -D_REENTRANT=1 -D_THREAD_SAFE=1 -DHAVE_PTHREAD_ATTR_SETSTACKSIZE=1 -DHAVE_PTHREAD_ATFORK=1 -DTCL_THREADS=1 -DPEEK_XCLOSEIM=1 -D_LARGEFILE64_SOURCE=1 -DTCL_WIDE_INT_TYPE=long\ long -DHAVE_STRUCT_STAT64=1 -DHAVE_OPEN64=1 -DHAVE_LSEEK64=1 -DHAVE_TYPE_OFF64_T=1 -DHAVE_GETCWD=1 -DHAVE_OPENDIR=1 -DHAVE_STRSTR=1 -DHAVE_STRTOL=1 -DHAVE_STRTOLL=1 -DHAVE_STRTOULL=1 -DHAVE_TMPNAM=1 -DHAVE_WAITPID=1 -DHAVE_GETPWUID_R_5=1 -DHAVE_GETPWUID_R=1 -DHAVE_GETPWNAM_R_5=1 -DHAVE_GETPWNAM_R=1 -DHAVE_GETGRGID_R_5=1 -DHAVE_GETGRGID_R=1 -DHAVE_GETGRNAM_R_5=1 -DHAVE_GETGRNAM_R=1 -DHAVE_GETHOSTBYNAME_R_6=1 -DHAVE_GETHOSTBYNAME_R=1 -DHAVE_GETHOSTBYADDR_R_8=1 -DHAVE_GETHOSTBYADDR_R=1 -DUSE_TERMIOS=1 -DHAVE_SYS_TIME_H=1 -DTIME_WITH_SYS_TIME=1 -DHAVE_TM_ZONE=1 -DHAVE_GMTIME_R=1 -DHAVE_LOCALTIME_R=1 -DHAVE_TM_GMTOFF=1 -DHAVE_TIMEZONE_VAR=1 -DHAVE_ST_BLKSIZE=1 -DSTDC_HEADERS=1 -DHAVE_SIGNED_CHAR=1 -DHAVE_LANGINFO=1 -DHAVE_FTS=1 -DHAVE_SYS_IOCTL_H=1 -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_TIMEGM=1 -DHAVE_DRAND48=1 -DHAVE_RANDOM=1 -DHAVE_POLL=1 -DHAVE_GETADDRINFO=1 -DHAVE_GETNAMEINFO=1 -c -o nsopenssl.o nsopenssl.c
nsopenssl.c: In function `Ns_ModuleInit':
nsopenssl.c:167: warning: passing arg 3 of `Ns_DriverInit' from incompatible pointer type
nsopenssl.c:167: error: too many arguments to function `Ns_DriverInit'
nsopenssl.c: In function `NsOpenSSLGetModuleName':
nsopenssl.c:190: warning: unused variable `sdPtr'
nsopenssl.c: In function `NsOpenSSLGetSockServerSSLContext':
nsopenssl.c:228: error: `firstSSLDriverPtr' undeclared (first use in this function)
nsopenssl.c:228: error: (Each undeclared identifier is reported only once
nsopenssl.c:228: error: for each function it appears in.)
nsopenssl.c: In function `NsOpenSSLGetSockClientSSLContext':
nsopenssl.c:257: error: `firstSSLDriverPtr' undeclared (first use in this function)
nsopenssl.c: At top level:
nsopenssl.c:850: error: syntax error before "Ns_Buf"
nsopenssl.c: In function `OpenSSLProc':
nsopenssl.c:851: error: number of arguments doesn't match prototype
nsopenssl.c:117: error: prototype declaration
nsopenssl.c:853: error: `sock' undeclared (first use in this function)
nsopenssl.c:856: error: `cmd' undeclared (first use in this function)
nsopenssl.c:870: error: structure has no member named `sdPtr'
nsopenssl.c:871: error: structure has no member named `sdPtr'
nsopenssl.c:872: error: `sdPtr' undeclared (first use in this function)
nsopenssl.c:891: error: `bufs' undeclared (first use in this function)
nsopenssl.c:901: error: `nbufs' undeclared (first use in this function)
nsopenssl.c: At top level:
nsopenssl.c:41: warning: 'RCSID' defined but not used
gmake: *** [nsopenssl.o] Error 1
------------------------------------------------------------------

So decided to give nsopenssl-3.0beta26 a shot. The building of the source and installation went successfully but when running AOLserver I get the following error:

------------------------------------------------------------------
[root@predevlms ~]# cat run-aol4-server
/usr/local/aolserver/bin/nsd -u pliska -g nmont -ft /usr/local/aolserver/neumont-dev.tcl -b 127.0.0.1:80
[root@predevlms ~]# ./run-aol4-server
[22/Jan/2007:16:04:43][6250.3086841536][-main-] Notice: prebind: bound: 127.0.0.1:80
[22/Jan/2007:16:04:43][6250.3086841536][-main-] Notice: nsmain: AOLserver/4.5.0 starting
[22/Jan/2007:16:04:43][6250.3086841536][-main-] Notice: nsmain: security info: uid=500, euid=500, gid=504, egid=504
[22/Jan/2007:16:04:43][6250.3086841536][-main-] Notice: nsmain: max files: FD_SETSIZE = 1024, rl_cur = 1024, rl_max = 1024
[22/Jan/2007:16:04:43][6250.3086841536][-main-] Notice: encoding: loaded: utf-8
[22/Jan/2007:16:04:43][6250.3086841536][-main-] Notice: fastpath[neumont-dev]: mapped GET /
[22/Jan/2007:16:04:43][6250.3086841536][-main-] Notice: fastpath[neumont-dev]: mapped HEAD /
[22/Jan/2007:16:04:43][6250.3086841536][-main-] Notice: fastpath[neumont-dev]: mapped POST /
[22/Jan/2007:16:04:43][6250.3086841536][-main-] Notice: adp[neumont-dev]: mapped GET /*.adp
[22/Jan/2007:16:04:43][6250.3086841536][-main-] Notice: adp[neumont-dev]: mapped HEAD /*.adp
[22/Jan/2007:16:04:43][6250.3086841536][-main-] Notice: adp[neumont-dev]: mapped POST /*.adp
[22/Jan/2007:16:04:43][6250.3086841536][-main-] Notice: modload: loading '/usr/local/aolserver/bin/nssock.so'
[22/Jan/2007:16:04:43][6250.3086841536][-main-] Notice: modload: loading '/usr/local/aolserver/bin/nslog.so'
[22/Jan/2007:16:04:43][6250.3086841536][-main-] Notice: nslog: opened '/usr/local/aolserver/servers/neumont-dev/log/neumont-dev.log'
[22/Jan/2007:16:04:43][6250.3086841536][-main-] Notice: modload: loading '/usr/local/aolserver/bin/nsdb.so'
[22/Jan/2007:16:04:43][6250.3086841536][-main-] Notice: modload: loading '/usr/local/aolserver/bin/ora8.so'
[22/Jan/2007:16:04:43][6250.3086841536][-main-] Notice: ora8 driver LobBufferSize = 16384
[22/Jan/2007:16:04:43][6250.3086841536][-main-] Notice: ora8 driver PrefetchRows = 0
[22/Jan/2007:16:04:43][6250.3086841536][-main-] Notice: ora8 driver PrefetchMemory = 0
[22/Jan/2007:16:04:43][6250.3086841536][-main-] Notice: Loaded ArsDigita Oracle Driver version 2.7, built on 15:17:54/Mar 28 2006
[22/Jan/2007:16:04:43][6250.3086841536][-main-] Notice: modload: loading '/usr/local/aolserver/bin/nspasswd.so'
[22/Jan/2007:16:04:43][6250.3086841536][-main-] Notice: modload: loading '/usr/local/aolserver/bin/nsopenssl.so'
[22/Jan/2007:16:04:43][6250.3086841536][-main-] Notice: nsopenssl: generating 512-bit temporary RSA key ...
[22/Jan/2007:16:04:43][6250.3086841536][-main-] Fatal: received fatal signal 11
./run-aol4-server: line 1: 6250 Aborted /usr/local/aolserver/bin/nsd -u pliska -g nmont -ft /usr/local/aolserver/neumont-dev.tcl -b 127.0.0.1:80
------------------------------------------------------------------

Please let me know if you see something I'm missing. I'll also post my errors on the AOLserver mailing list (as Gustaf recommended) and see if I get some help through them.

Thanks!

Just as a follow up: nsopenssl 2.x won't work with AOLserver 4.5.x. Scott Goodwin informed me about that through the AOLserver mailing list.

I'm still fighting with nsopenssl-3.0beta26 ...

Collapse
Posted by Pedro Liska on
I finally got things working.

To get rid of the "fatal signal 11" error I just started from absolute scratch. Deleting all executables and sources.

I made sure Tcl and OpenSSL were compiled with thread support (which I had done before as well). And things worked. I probably had a typo or some other tiny error that made things break.

Thank you Gustaf and Andrew for your help,

Pedro