Bug #38324 Cannot build with OpenSSL
Submitted: 24 Jul 2008 0:01 Modified: 28 Jul 21:48
Reporter: Andy Shellam
Status: Analyzing
Category:Server: Compiling Severity:S2 (Serious)
Version:5.1.30, 5.1.32, 5.1.36 OS:Other (Debian/GNU Linux 4.0r3)
Assigned to: Target Version:
Tags: openssl, server, beta, MySQL

[24 Jul 2008 0:01] Andy Shellam
Description:
I am unable to compile MySQL 5.1.26-rc with OpenSSL on a Debian system without passing
all the compiler flags individually before running configure.  OpenSSL is installed in
/usr/local/openssl.

Configure finds OpenSSL successfully, but make then complains it cannot find the OpenSSL
files (which are under /usr/local/openssl/include/openssl.)

The following configure lines succeed, but then fail on make.

./configure --prefix=/usr/local/mysql --with-ssl=/usr/local/openssl

./configure --prefix=/usr/local/mysql --with-ssl=/usr/local/openssl
--with-mysqld-ldflags="-L/usr/local/openssl/lib -lssl -lcrypto"
--with-lib-ccflags="-I/usr/local/openssl/include"

Make complains with the following error:

g++ -DHAVE_CONFIG_H -I. -I. -I../../include -I../../include -I../../include -I../../regex
-I../../sql -I. -DMYSQL_DYNAMIC_PLUGIN -O3 -fno-implicit-templates -fno-exceptions
-fno-rtti -MT ha_archive_la-ha_archive.lo -MD -MP -MF .deps/ha_archive_la-ha_archive.Tpo
-c ha_archive.cc  -fPIC -DPIC -o .libs/ha_archive_la-ha_archive.o
In file included from ../../sql/mysql_priv.h:88,
from ha_archive.cc:20:
../../include/violite.h:93:30: error: openssl/opensslv.h: No such file or directory
../../include/violite.h:109:25: error: openssl/ssl.h: No such file or directory
../../include/violite.h:110:25: error: openssl/err.h: No such file or directory
In file included from ha_archive.cc:20:
../../sql/mysql_priv.h:1304:25: error: openssl/des.h: No such file or directory
../../include/violite.h:114: error: ISO C++ forbids declaration of 'SSL_CTX' with no
type
../../include/violite.h:114: error: expected ';' before '*' token
../../sql/mysql_priv.h:1307: error: 'des_cblock' does not name a type
../../sql/mysql_priv.h:1311: error: 'des_key_schedule' does not name a type
make[2]: *** [ha_archive_la-ha_archive.lo] Error 1
make[2]: Leaving directory `/var/software/mysql-5.1.26-rc/storage/archive'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/var/software/mysql-5.1.26-rc/storage'
make: *** [all-recursive] Error 1

The end of the resulting config.log file locates OpenSSL in the correct place:

CLIENT_LIBS='-lcrypt -lnsl -lm  -L/usr/local/openssl/lib/ -lssl -lcrypto -lz '
CONF_COMMAND='./configure '--prefix=/usr/local/mysql' '--with-ssl=/usr/local/openssl'
'CPPFLAGS=-I/usr/local/openssl/include' 'CXXFLAGS=-I/usr/local/openssl/include''
CPPFLAGS='-I/usr/local/openssl/include'
CXXFLAGS=' -I/usr/local/openssl/include   -fno-implicit-templates -fno-exceptions
-fno-rtti'
SAVE_CXXFLAGS='-I/usr/local/openssl/include'
openssl_includes='-I/usr/local/openssl/include'
openssl_libs='-L/usr/local/openssl/lib/ -lssl -lcrypto'

The following command-line compiles successfully:

CCFLAGS="-I/usr/local/openssl/include" CPPFLAGS="-I/usr/local/openssl/include"
CXXFLAGS="-I/usr/local/openssl/include" ./configure --prefix=/usr/local/mysql
--with-ssl=/usr/local/openssl && make

The OpenSSL include files are where they're expected to be:

# find / -name opensslv.h
/usr/local/openssl/include/openssl/opensslv.h
# find / -name err.h
...
/usr/local/openssl/include/openssl/err.h
...
# find / -name ssl.h
...
/usr/local/openssl/include/openssl/ssl.h
...

How to repeat:
Attempt to compile MySQL with OpenSSL using the following configure line when OpenSSL is
installed in /usr/local/openssl.

./configure --prefix=/usr/local/mysql --with-ssl=/usr/local/openssl

Configure succeeds, then try to run make... fails with the above error.

I have to manually add the CC, CPP and CXX flags in order to get it to compile:

CCFLAGS="-I/usr/local/openssl/include" CPPFLAGS="-I/usr/local/openssl/include"
CXXFLAGS="-I/usr/local/openssl/include" ./configure --prefix=/usr/local/mysql
--with-ssl=/usr/local/openssl && make

The above command ^^ works.

Suggested fix:
Automatically add the relevant flags after running configure, so that a line such as:

./configure --prefix=/usr/local/mysql --with-ssl=/usr/local/openssl

will compile and make successfully when OpenSSL is installed under /usr/local/openssl.
[29 Jul 2008 13:22] Andy Shellam
Note, this is not a problem on FreeBSD.  I successfully built 5.1.26-rc1 on FreeBSD
7.0-RELEASE-p2 using the command lines I had tried on Debian.
[31 Jul 2008 19:35] Valeriy Kravchuk
Thank you for a problem report. What exact versions of OpenSSL you had used on Debian
Linux and FreeBSD 7?
[31 Jul 2008 19:58] Andy Shellam
Hi, this was with OpenSSL 0.9.8g on Debian and 0.9.8h on FreeBSD (darn, never noticed they
were different until just!)

Want me to try with h on Debian too?
[1 Aug 2008 7:26] Valeriy Kravchuk
Please, try h on Debian, just to be sure OpenSSL version is not relevant.
[1 Aug 2008 9:51] Andy Shellam
Hi,

I've installed OpenSSL 0.9.8h on my server, retried with a fresh download and extract of
MySQL 5.1.26-rc - same issue.

I'll attach the config.log and make output (from the command "make > /tmp/make.log 2>&1"
- this exited with return code 2.)

Configure line was: ./configure --prefix=/usr/local/mysql --with-ssl=/usr/local/openssl
--enable-assembler.

Also tried enabling the "max-no-ndb" plugins:

./configure --prefix=/usr/local/mysql --with-ssl=/usr/local/openssl --enable-assembler
--with-plugins=max-no-ndb

Hope this helps!
[1 Aug 2008 9:53] Andy Shellam
Configure and make log files

Attachment: bug-data-38324.zip (application/zip, text), 71.96 KiB.

[6 Aug 2008 8:28] Valeriy Kravchuk
Please, send the results of:

ls -l /usr/include | grep ssl

from both Debian and FreeBSD machines.
[6 Aug 2008 18:54] Andy Shellam
From the Debian machine:

root / # ls -l /usr/include | grep ssl
-rw-r--r--  1 root root   7304 Oct 19  2006 cursslk.h
root / #

From the FreeBSD machine:

root / # ls -l /usr/include | grep ssl
drwxr-xr-x   2 root  wheel   1536 Jul 17 21:29 openssl
root / #
[15 Aug 2008 14:57] Daniel Gubber
Apparently the CPPFLAG is not being read properly. Add the CFLAGS environment variable
with "-I<path to ssl>" and it compiles fine.
[30 Nov 2008 12:42] Andy Shellam
This is still the case with the stable release of MySQL 5.1.30.

Here's my configure line, as recommended by the documentation:

CFLAGS="-O3" CXX=gcc CXXFLAGS="-O3 -felide-constructors -fno-exceptions -fno-rtti"
./configure --prefix=/usr/local/mysql --enable-assembler --with-ssl=/usr/local/openssl

Configure produced the following line - note there is no presence of
"-I/usr/local/openssl/include" which is where the OpenSSL include files are - I've had to
manually set the CFLAGS.

gcc -DHAVE_CONFIG_H -I. -I../../include -I../../include -I../../include -I../../regex
-I../../sql -I. -DMYSQL_DYNAMIC_PLUGIN -O3 -felide-constructors -fno-exceptions -fno-rtti
-fno-implicit-templates -fno-exceptions -fno-rtti -MT ha_archive_la-ha_archive.lo -MD -MP
-MF .deps/ha_archive_la-ha_archive.Tpo -c ha_archive.cc  -fPIC -DPIC -o
.libs/ha_archive_la-ha_archive.o

The "--with-ssl=/usr/local/openssl" should append "-I/usr/local/openssl/include" to the
C/CPPFLAGS and "-L/usr/local/openssl -lssl -lcrypto" to the LDFLAGS.
[30 Nov 2008 13:00] Andy Shellam
Adding CPPFLAGS="-I/usr/local/openssl/include" to the configure line worked.
[3 Mar 22:00] Kent Mein
I had the same problem on solaris. 5.10  and 5.10x86 with
mysql 5.1.31

I had to add the ssl include manually for the following Makefiles.
storage/archive/Makefile
storage/archive/blackhole/Makefile
storage/cvs/Makefile
storage/example/Makefile
storage/federated/Makefile
storage/heap/Makefile
storage/innobase/Makefile
storage/myisam/Makefile
storage/myisammrg/Makefile
plugin/daemon_example/Makefile

I was using --with-ssl=/usr/local and had to add -I/usr/local/include to those Makefiles
to get things to work.
[11 Mar 0:00] Jan Alphenaar
Hi,

I just tried to compile MySQL 5.1.32 on RedHat 2.6.18-8.el5 with OpenSSL version 0.9.8j

Here is the output.

Hope this helps in resolving this issue.

Regards,

Jan

=== BEGIN OUTPUT ===
make[2]: Entering directory
`/home/jan/sources/mysql/sources/mysql-5.1.32/storage/archive'
/bin/sh ../../libtool --preserve-dup-deps --tag=CXX   --mode=compile g++ -DHAVE_CONFIG_H
-I. -I../../include -I../../include -I../../include -I../../regex -I../../sql -I.
-I/opt/zlib/include    -DMYSQL_DYNAMIC_PLUGIN -O3    -fno-implicit-templates
-fno-exceptions -fno-rtti -MT ha_archive_la-ha_archive.lo -MD -MP -MF
.deps/ha_archive_la-ha_archive.Tpo -c -o ha_archive_la-ha_archive.lo `test -f
'ha_archive.cc' || echo './'`ha_archive.cc
 g++ -DHAVE_CONFIG_H -I. -I../../include -I../../include -I../../include -I../../regex
-I../../sql -I. -I/opt/zlib/include -DMYSQL_DYNAMIC_PLUGIN -O3 -fno-implicit-templates
-fno-exceptions -fno-rtti -MT ha_archive_la-ha_archive.lo -MD -MP -MF
.deps/ha_archive_la-ha_archive.Tpo -c ha_archive.cc -o ha_archive_la-ha_archive.o
In file included from ../../sql/mysql_priv.h:90,
                 from ha_archive.cc:20:
../../include/violite.h:93:30: error: openssl/opensslv.h: No such file or directory
../../include/violite.h:109:25: error: openssl/ssl.h: No such file or directory
../../include/violite.h:110:25: error: openssl/err.h: No such file or directory
In file included from ha_archive.cc:20:
../../sql/mysql_priv.h:1315:25: error: openssl/des.h: No such file or directory
../../include/violite.h:114: error: ISO C++ forbids declaration of 'SSL_CTX' with no
type
../../include/violite.h:114: error: expected ';' before '*' token
../../sql/mysql_priv.h:1318: error: 'des_cblock' does not name a type
../../sql/mysql_priv.h:1322: error: 'des_key_schedule' does not name a type
make[2]: *** [ha_archive_la-ha_archive.lo] Error 1
make[2]: Leaving directory
`/home/jan/sources/mysql/sources/mysql-5.1.32/storage/archive'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/jan/sources/mysql/sources/mysql-5.1.32/storage'
make: *** [all-recursive] Error 1
=== END OUTPUT ===
[5 Apr 20:12] Valeriy Kravchuk
Try with 5.1.33 maybe. 5.1.34 still coimpiles OK for me with:

./configure --prefix=/home2/openxs/dbs/5.1 --with-ssl=/usr/local/ssl
make clean
make

as soon as I have OpenSSL 0.9.8h installed in /usr/local/ssl.
[7 Apr 9:51] Jan Alphenaar
Hi again,

Just tried to compile MySQL 5.1.33 on RedHat 2.6.18-8.e15 with OpenSSL version 0.9.8j,
but I get the same error as with MySQL 5.1.32.

For clarity I copied the commands I executed and the output below.

Regards,

Jan

=== BEGIN COMMANDS ===
./configure --prefix=/opt/mysql --enable-thread-safe-client --enable-assembler
--disable-shared --with-ssl=/opt/openssl --with-zlib-dir=/opt/zlib --without-docs
make clean
make
=== END COMMANDS ===

=== BEGIN OUTPUT ===
Making all in archive
make[2]: Entering directory
`/home/jan/sources/mysql/sources/mysql-5.1.33/storage/archive'
/bin/sh ../../libtool --preserve-dup-deps --tag=CXX   --mode=compile g++ -DHAVE_CONFIG_H
-I. -I../../include -I../../include -I../../include -I../../regex -I../../sql -I.
-I/opt/zlib/include    -DMYSQL_DYNAMIC_PLUGIN -O3    -fno-implicit-templates
-fno-exceptions -fno-rtti -MT ha_archive_la-ha_archive.lo -MD -MP -MF
.deps/ha_archive_la-ha_archive.Tpo -c -o ha_archive_la-ha_archive.lo `test -f
'ha_archive.cc' || echo './'`ha_archive.cc
 g++ -DHAVE_CONFIG_H -I. -I../../include -I../../include -I../../include -I../../regex
-I../../sql -I. -I/opt/zlib/include -DMYSQL_DYNAMIC_PLUGIN -O3 -fno-implicit-templates
-fno-exceptions -fno-rtti -MT ha_archive_la-ha_archive.lo -MD -MP -MF
.deps/ha_archive_la-ha_archive.Tpo -c ha_archive.cc -o ha_archive_la-ha_archive.o
In file included from ../../sql/mysql_priv.h:90,
                 from ha_archive.cc:20:
../../include/violite.h:93:30: error: openssl/opensslv.h: No such file or directory
../../include/violite.h:109:25: error: openssl/ssl.h: No such file or directory
../../include/violite.h:110:25: error: openssl/err.h: No such file or directory
In file included from ha_archive.cc:20:
../../sql/mysql_priv.h:1311:25: error: openssl/des.h: No such file or directory
../../include/violite.h:114: error: ISO C++ forbids declaration of 'SSL_CTX' with no
type
../../include/violite.h:114: error: expected ';' before '*' token
../../sql/mysql_priv.h:1314: error: 'des_cblock' does not name a type
../../sql/mysql_priv.h:1318: error: 'des_key_schedule' does not name a type
make[2]: *** [ha_archive_la-ha_archive.lo] Error 1
make[2]: Leaving directory
`/home/jan/sources/mysql/sources/mysql-5.1.33/storage/archive'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/jan/sources/mysql/sources/mysql-5.1.33/storage'
make: *** [all-recursive] Error 1
=== END OUTPUT ===
[23 Apr 23:43] Jan Alphenaar
Hi again,

Just tried to compile MySQL 5.1.34 on RedHat 2.6.18-8.e15 with OpenSSL version 0.9.8j,
but I get the same error as with MySQL 5.1.30.

Regards,

Jan
[6 May 1:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
[21 Jun 10:52] Jan Alphenaar
Just tried for version 5.1.35, still a NO-GO.

======= BEGIN OUTPUT =======
ha_archive_la-ha_archive.lo `test -f 'ha_archive.cc' || echo './'`ha_archive.cc
libtool: compile:  g++ -DHAVE_CONFIG_H -I. -I../../include -I../../include
-I../../include -I../../regex -I../../sql -I. -I../../zlib -DMYSQL_DYNAMIC_PLUGIN -O3
-fno-implicit-templates -fno-exceptions -fno-rtti -MT ha_archive_la-ha_archive.lo -MD -MP
-MF .deps/ha_archive_la-ha_archive.Tpo -c ha_archive.cc -o ha_archive_la-ha_archive.o
In file included from ../../sql/mysql_priv.h:90,
                 from ha_archive.cc:20:
../../include/violite.h:93:30: error: openssl/opensslv.h: No such file or directory
../../include/violite.h:109:25: error: openssl/ssl.h: No such file or directory
../../include/violite.h:110:25: error: openssl/err.h: No such file or directory
In file included from ha_archive.cc:20:
../../sql/mysql_priv.h:1330:25: error: openssl/des.h: No such file or directory
../../include/violite.h:114: error: ISO C++ forbids declaration of âSSL_CTXâ with no
type
../../include/violite.h:114: error: expected â;â before â*â token
../../sql/mysql_priv.h:1333: error: âdes_cblockâ does not name a type
../../sql/mysql_priv.h:1337: error: âdes_key_scheduleâ does not name a type
make[2]: *** [ha_archive_la-ha_archive.lo] Error 1
make[2]: Leaving directory
`/home/jan/sources/mysql/sources/mysql-5.1.35/storage/archive'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/jan/sources/mysql/sources/mysql-5.1.35/storage'
make: *** [all-recursive] Error 1
======= END OUTPUT =======
[22 Jun 22:21] Andy Shellam
Still a problem with 5.1.35, and on Solaris 10.
[4 Jul 22:37] Jan Alphenaar
Just tried for version 5.1.36, still does not work... Is defect going to be fixed or is it
abandoned?
[28 Jul 12:10] Sveta Smirnova
Thank you for the feedback.

I can not repeat described behavior on different boxes.

Please provide config.log file and indicate how you did install OpenSSL.
[28 Jul 21:35] Jan Alphenaar
Sure, this is the installation sequence for openssl and mysql.

OpenSSL
=======
tar zxvf ../download/openssl-0.9.8j.tar.gz
cd openssl-0.9.8j
./config --prefix=/opt/openssl no-idea
make clean
make depend
make
make install
cd ..
rm -rf openssl-0.9.8j

MySQL
=====
tar zxvf ../download/mysql-5.1.36.tar.gz
cd mysql-5.1.36
CFLAGS="-O3" CXX=gcc CXXFLAGS="-O3 -felide-constructors -fno-exceptions -fno-rtti"
./configure --prefix=/opt/mysql \
            --enable-thread-safe-client \
            --enable-assembler \
            --disable-shared \
            --with-ssl=/opt/openssl \
            --with-zlib-dir=/opt/zlib \
            --without-docs
make clean
make

Make fails with the following error message:

======= BEGIN OUTPUT =========
In file included from ../../sql/mysql_priv.h:90,
                 from ha_archive.cc:20:
../../include/violite.h:93:30: error: openssl/opensslv.h: No such file or directory
../../include/violite.h:109:25: error: openssl/ssl.h: No such file or directory
../../include/violite.h:110:25: error: openssl/err.h: No such file or directory
In file included from ha_archive.cc:20:
../../sql/mysql_priv.h:1330:25: error: openssl/des.h: No such file or directory
../../include/violite.h:114: error: ISO C++ forbids declaration of âSSL_CTXâ with no
type
../../include/violite.h:114: error: expected â;â before â*â token
../../sql/mysql_priv.h:1333: error: âdes_cblockâ does not name a type
../../sql/mysql_priv.h:1337: error: âdes_key_scheduleâ does not name a type
make[2]: *** [ha_archive_la-ha_archive.lo] Error 1
make[2]: Leaving directory
`/home/jan/sources/mysql/sources/mysql-5.1.36/storage/archive'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/jan/sources/mysql/sources/mysql-5.1.36/storage'
make: *** [all-recursive] Error 1
======== END OUTPUT ==========

The config.log should be attached as well.

Please let me know if you have any other questions.

Regards,

Jan
[28 Jul 21:38] Jan Alphenaar
Compressed Config.log

Attachment: ConfigLog.rar (application/x-zip-compressed, text), 33.73 KiB.

[5 Aug 20:58] Jan Alphenaar
Hi again,

Just tried to compile MySQL 5.1.37 on RedHat 2.6.18-8.e15 with OpenSSL version 0.9.8j,
but I still get the same error as before...

Regards,

Jan
[19 Sep 16:18] Jan Alphenaar
Hi again,

Just tried to compile MySQL 5.1.38 on RedHat 2.6.18-8.e15 with OpenSSL version 0.9.8j,
but I still get the same error as before...

Regards,

Jan
[24 Oct 9:33] Jan Alphenaar
Hi again,

Just tried to compile MySQL 5.1.40 on RedHat 2.6.18-8.e15 with OpenSSL version 0.9.8j,
but I still get the same error as before...

Regards,

Jan