[CMake] Problems finding the SSL library

Maciej (Matchek) Bliziński maciej at opencsw.org
Thu Dec 22 09:33:29 EST 2011


Hello everyone,

I'm attempting to build mysql-5.5. It fails while finding the OpenSSL
library, and I can't figure out why. All other problems can find
OpenSSL without any problems.

The source code:
http://ftp.heanet.ie/mirrors/www.mysql.com/Downloads/MySQL-5.5/mysql-5.5.19.tar.gz

Here's what the build attempt looks like. Note how the environment is
controlled by invoking /usr/bin/env -i which cleans the environment,
and then explicitly setting all the environment variables.

maciej at netra ~/src/opencsw/pkg/mysql5/branches/mysql-5.5.x $ mgar package
[===== NOW BUILDING: mysql-5.5.19 =====]
        [prerequisite] complete for mysql55.
        [fetch] complete for mysql55.
        [checksum] complete for mysql55.
        [checksum-global] complete for mysql55.
        [checksum-modulated] complete for mysql55.
[===== NOW BUILDING: mysql-5.5.19 MODULATION global: ISA= =====]
        [extract-modulated] complete for mysql55.
[===== Building modulation 'isa-sparcv8plus' on host '' =====]
gmake  MODULATION=isa-sparcv8plus  ISA=sparcv8plus  merge-modulated
gmake[1]: Entering directory
`/home/maciej/src/opencsw/pkg/mysql5/branches/mysql-5.5.x'
[===== NOW BUILDING: mysql-5.5.19 MODULATION isa-sparcv8plus:
ISA=sparcv8plus =====]
        [extract-modulated] complete for mysql55.
        [patch-modulated] complete for mysql55.
#               --debug-output \
#               --debug-trycompile \
(cd work/build-isa-sparcv8plus/mysql-5.5.19 && \
        /usr/bin/env -i \
          PATH="/opt/csw/gnu:/home/maciej/src/opencsw/.buildsys/v2/gar/bin/sos12-wrappers:/home/maciej/src/opencsw/pkg/mysql5/branches/mysql-5.5.x/work/install-isa-sparcv8plus/opt/csw/bin:/home/maciej/src/opencsw/pkg/mysql5/branches/mysql-5.5.x/work/install-isa-sparcv8plus/opt/csw/bin:/home/maciej/src/opencsw/pkg/mysql5/branches/mysql-5.5.x/work/install-isa-sparcv8plus/opt/csw/sbin:/home/maciej/src/opencsw/pkg/mysql5/branches/mysql-5.5.x/work/install-isa-sparcv8plus/opt/csw/sbin:/opt/csw/bin:/opt/csw/bin:/opt/csw/sbin:/opt/csw/sbin:/opt/studio/SOS12/SUNWspro/bin:/home/maciej/src/opencsw/.buildsys/v2/gar/bin:/usr/bin:/usr/sbin:/usr/java/bin:/usr/ccs/bin:/usr/openwin/bin"
LC_ALL="C" prefix="/opt/csw" exec_prefix="/opt/csw"
bindir="/opt/csw/bin" sbindir="/opt/csw/sbin"
libexecdir="/opt/csw/libexec" datadir="/opt/csw/share/mysql/5.5"
sysconfdir="/etc/opt/csw" sharedstatedir="/opt/csw/share"
localstatedir="/var/opt/csw/mysql55" libdir="/opt/csw/lib"
infodir="/opt/csw/share/info" lispdir="/opt/csw/share/emacs/site-lisp"
includedir="/opt/csw/include" mandir="/opt/csw/share/man"
docdir="/opt/csw/share/doc" sourcedir="/opt/csw/src"
CPPFLAGS="-I/opt/csw/include" CFLAGS="-xO3 -m32 -xarch=sparc"
CXXFLAGS="-xO3 -m32 -xarch=sparc" LDFLAGS="-m32 -xarch=sparc
-L/opt/csw/lib" FFLAGS="-xO3 -m32 -xarch=sparc" FCFLAGS="-xO3 -m32
-xarch=sparc" ASFLAGS="" OPTFLAGS="-xO3 -m32 -xarch=sparc"
CC="/opt/studio/SOS12/SUNWspro/bin/cc"
CXX="/opt/studio/SOS12/SUNWspro/bin/CC"
CC_HOME="/opt/studio/SOS12/SUNWspro" CC_VERSION="Sun C 5.10
SunOS_sparc 2009/06/03" CXX_VERSION="Sun C++ 5.10 SunOS_sparc
2009/06/03" GARCH="sparc" GAROSREL="5.10" GARPACKAGE="mysql-5.5.x"
LD_OPTIONS="-R/opt/csw/lib/\$ISALIST -R/opt/csw/lib"
PKG_CONFIG_PATH="/opt/csw/lib/pkgconfig"
DESTDIR="/home/maciej/src/opencsw/pkg/mysql5/branches/mysql-5.5.x/work/install-isa-sparcv8plus"
 \
                cmake \
                . \
                -DCMAKE_INSTALL_PREFIX=/opt/csw
-DMYSQL_DATADIR=/var/opt/csw/mysql55 -DSYSCONFDIR=/etc/opt/csw
-DINSTALL_BINDIR=bin -DINSTALL_SBINDIR=libexec
-DINSTALL_MANDIR=share/man -DINSTALL_LIBDIR=lib
-DINSTALL_PLUGINDIR=lib/mysql55/./plugin -DWITH_READLINE=1
-DWITH_SSL=system -DWITH_ZLIB=system -DDEFAULT_CHARSET=utf8
-DDEFAULT_COLLATION=utf8_general_ci -DWITH_COMMENT='OpenCSW'
-DCMAKE_C_FLAGS="-xO3 -m32 -xarch=sparc" -DCMAKE_CXX_FLAGS="-xO3 -m32
-xarch=sparc" -DBUILD_CONFIG=mysql_release
-DOPENSSL_ROOT_DIR=/opt/csw)
-- MySQL 5.5.19
CMake Error at cmake/ssl.cmake:83 (MESSAGE):
  Cannot find appropriate system libraries for SSL.  Use WITH_SSL=bundled to
  enable SSL support
Call Stack (most recent call first):
  CMakeLists.txt:255 (MYSQL_CHECK_SSL)


-- Configuring incomplete, errors occurred!
gmake[1]: *** [configure-custom] Error 1
gmake[1]: Leaving directory
`/home/maciej/src/opencsw/pkg/mysql5/branches/mysql-5.5.x'
gmake: *** [merge-isa-sparcv8plus] Error 2


maciej at netra ~/src/opencsw/pkg/mysql5/branches/mysql-5.5.x $ glocate openssl.pc
/home/maciej/src/opencsw/pkg/mysql5/branches/mysql-5.5.x/files/64/openssl.pc
/opt/csw/lib/pkgconfig/openssl.pc
/opt/csw/lib/sparcv9/pkgconfig/openssl.pc
/usr/lib/pkgconfig/openssl.pc
/usr/lib/sparcv9/pkgconfig/openssl.pc
/zones/netra-zone1.chopin.edu.pl/root/opt/csw/lib/pkgconfig/openssl.pc
/zones/netra-zone1.chopin.edu.pl/root/opt/csw/lib/sparcv9/pkgconfig/openssl.pc
/zones/netra-zone1.chopin.edu.pl/root/usr/lib/pkgconfig/openssl.pc
/zones/netra-zone1.chopin.edu.pl/root/usr/lib/sparcv9/pkgconfig/openssl.pc
/zones/netra-zone2.chopin.edu.pl/root/opt/csw/lib/pkgconfig/openssl.pc
/zones/netra-zone2.chopin.edu.pl/root/opt/csw/lib/sparcv9/pkgconfig/openssl.pc
/zones/netra-zone2.chopin.edu.pl/root/usr/lib/pkgconfig/openssl.pc
/zones/netra-zone2.chopin.edu.pl/root/usr/lib/sparcv9/pkgconfig/openssl.pc

maciej at netra ~/src/opencsw/pkg/mysql5/branches/mysql-5.5.x $ cat
/opt/csw/lib/pkgconfig/openssl.pc
prefix=/opt/csw
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include

Name: OpenSSL
Description: Secure Sockets Layer and cryptography libraries and tools
Version: 0.9.8r
Requires:
Libs: -L${libdir} -lssl -lcrypto -lsocket -lnsl -ldl
Cflags: -I${includedir}

maciej at netra ~/src/opencsw/pkg/mysql5/branches/mysql-5.5.x $ glocate
-r libssl.so$
/opt/csw/lib/libssl.so
/opt/csw/lib/sparcv9/libssl.so
/usr/sfw/lib/libssl.so
/usr/sfw/lib/sparcv9/libssl.so
/zones/netra-zone1.chopin.edu.pl/root/opt/csw/lib/libssl.so
/zones/netra-zone1.chopin.edu.pl/root/opt/csw/lib/sparcv9/libssl.so
/zones/netra-zone1.chopin.edu.pl/root/usr/sfw/lib/libssl.so
/zones/netra-zone1.chopin.edu.pl/root/usr/sfw/lib/sparcv9/libssl.so
/zones/netra-zone2.chopin.edu.pl/root/opt/csw/lib/libssl.so
/zones/netra-zone2.chopin.edu.pl/root/opt/csw/lib/sparcv9/libssl.so
/zones/netra-zone2.chopin.edu.pl/root/usr/sfw/lib/libssl.so
/zones/netra-zone2.chopin.edu.pl/root/usr/sfw/lib/sparcv9/libssl.so
maciej at netra ~/src/opencsw/pkg/mysql5/branches/mysql-5.5.x $ ls -l
/opt/csw/lib/libssl.so
lrwxrwxrwx   1 root     root          15 Dec 17 00:40
/opt/csw/lib/libssl.so -> libssl.so.0.9.8
maciej at netra ~/src/opencsw/pkg/mysql5/branches/mysql-5.5.x $ ls -l
/opt/csw/lib/libssl.so.0.9.8
-r-xr-xr-x   1 root     bin       386880 Dec  4 21:34
/opt/csw/lib/libssl.so.0.9.8

...so the library + .so symlink look ok.

My journey so far was this:

- I contacted the mysql IRC channel and was told that something's
wrong with cmake
- I contacted the cmake IRC channel and was told that something's
wrong with mysql
- I was given some debugging commands, flags, and environment
variables but none of that helped
- I tried to work out what exactly is cmake doing, and it turned out
to be quite opaque
- I looked into the CMakeError.log file and found this:

Run Build Command:/opt/csw/bin/gmake "cmTryCompileExec/fast"
/opt/csw/bin/gmake -f CMakeFiles/cmTryCompileExec.dir/build.make
CMakeFiles/cmTryCompileExec.dir/build
gmake[1]: Entering directory
`/home/maciej/src/opencsw/pkg/mysql5/branches/mysql-5.5.x/work/build-isa-sparcv8plus/mysql-5.5.19/CMakeFiles/CMakeTmp'
/opt/csw/bin/cmake -E cmake_progress_report
/home/maciej/src/opencsw/pkg/mysql5/branches/mysql-5.5.x/work/build-isa-sparcv8plus/mysql-5.5.19/CMakeFiles/CMakeTmp/CMakeFiles
1
Building C object CMakeFiles/cmTryCompileExec.dir/CheckSymbolExists.c.o
/opt/studio/SOS12/SUNWspro/bin/cc  -D_LARGEFILE_SOURCE -D_LARGE_FILES
-D_FILE_OFFSET_BITS=64 -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS
-D__STDC_FORMAT_MACROS -xO3 -m32 -xarch=sparc -KPIC     -o
CMakeFiles/cmTryCompileExec.dir/CheckSymbolExists.c.o   -c
/home/maciej/src/opencs
w/pkg/mysql5/branches/mysql-5.5.x/work/build-isa-sparcv8plus/mysql-5.5.19/CMakeFiles/CMakeTmp/CheckSymbolExists.c
"/home/maciej/src/opencsw/pkg/mysql5/branches/mysql-5.5.x/work/build-isa-sparcv8plus/mysql-5.5.19/CMakeFiles/CMakeTmp/CheckSymbolExists.c",
line 2: cannot find include file: <openssl/sha.h>
"/home/maciej/src/opencsw/pkg/mysql5/branches/mysql-5.5.x/work/build-isa-sparcv8plus/mysql-5.5.19/CMakeFiles/CMakeTmp/CheckSymbolExists.c",
line 8: undefined symbol: SHA512_DIGEST_LENGTH
cc: acomp failed for
/home/maciej/src/opencsw/pkg/mysql5/branches/mysql-5.5.x/work/build-isa-sparcv8plus/mysql-5.5.19/CMakeFiles/CMakeTmp/CheckSymbolExists.c
gmake[1]: *** [CMakeFiles/cmTryCompileExec.dir/CheckSymbolExists.c.o] Error 1
gmake[1]: Leaving directory
`/home/maciej/src/opencsw/pkg/mysql5/branches/mysql-5.5.x/work/build-isa-sparcv8plus/mysql-5.5.19/CMakeFiles/CMakeTmp'
gmake: *** [cmTryCompileExec/fast] Error 2

File /home/maciej/src/opencsw/pkg/mysql5/branches/mysql-5.5.x/work/build-isa-sparcv8plus/mysql-5.5.19/CMakeFiles/CMakeTmp/CheckSymbolExists.c:
/* */
#include <openssl/sha.h>

void cmakeRequireSymbol(int dummy,...){(void)dummy;}
int main()
{
#ifndef SHA512_DIGEST_LENGTH
  cmakeRequireSymbol(0,&SHA512_DIGEST_LENGTH);
#endif
  return 0;
}

The relevant compiler command is:

/opt/studio/SOS12/SUNWspro/bin/cc  -D_LARGEFILE_SOURCE -D_LARGE_FILES
-D_FILE_OFFSET_BITS=64 -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS
-D__STDC_FORMAT_MACROS -xO3 -m32 -xarch=sparc -KPIC     -o
CMakeFiles/cmTryCompileExec.dir/CheckSymbolExists.c.o   -c
/home/maciej/src/opencsw/pkg/mysql5/branches/mysql-5.5.x/work/build-isa-sparcv8plus/mysql-5.5.19/CMakeFiles/CMakeTmp/CheckSymbolExists.c

It fails with line 2: "cannot find include file: <openssl/sha.h>"

The file exists on disk:

maciej at netra ~/src/opencsw/pkg/mysql5/branches/mysql-5.5.x $ glocate
openssl/sha.h
/home/maciej/src/opencsw/pkg/mysql5/branches/mysql-5.0.x/work/build-isa-sparcv8/mysql-5.0.84/extra/yassl/include/openssl/sha.h
/home/maciej/src/opencsw/pkg/mysql5/branches/mysql-5.0.x/work/build-isa-sparcv9/mysql-5.0.84/extra/yassl/include/openssl/sha.h
/home/maciej/src/opencsw/pkg/mysql5/branches/mysql-5.1.x-optcsw/work/build-isa-sparcv8/mysql-5.1.40/extra/yassl/include/openssl/sha.h
** here ** → /opt/csw/include/openssl/sha.h ← ** here **
/usr/sfw/include/openssl/sha.h
/zones/netra-zone1.chopin.edu.pl/root/opt/csw/include/openssl/sha.h
/zones/netra-zone1.chopin.edu.pl/root/usr/sfw/include/openssl/sha.h
/zones/netra-zone2.chopin.edu.pl/root/opt/csw/include/openssl/sha.h
/zones/netra-zone2.chopin.edu.pl/root/usr/sfw/include/openssl/sha.h

...but the compiler invocation is missing -I/opt/csw/include.

"-DOPENSSL_ROOT_DIR=/opt/csw" is set as one of the cmake flags. Also,
there's an environment variable: CPPFLAGS="-I/opt/csw/include", but it
doesn't seem to be processed by cmake.

Please don't send me away saying that the MySQL macros are at fault.
Maybe they are! But I've already tried[1] asking there and got no
answer. I need to find out what exactly is cmake doing and how can I
tell it that it needs to add -I${prefix}/include to the compiler
invocation if OpenSSL is at ${prefix}.

Maciej

[1] http://lists.mysql.com/packagers/517


More information about the CMake mailing list