[exim-dev] [Bug 1531] New: mysql module build incorrectly on…

Top Page
Delete this message
Reply to this message
Author: Todd Lyons
Date:  
To: exim-dev
Subject: [exim-dev] [Bug 1531] New: mysql module build incorrectly on Amazon AMI 2014.3
------- You are receiving this mail because: -------
You are on the CC list for the bug.

http://bugs.exim.org/show_bug.cgi?id=1531
           Summary: mysql module build incorrectly on Amazon AMI 2014.3
           Product: Exim
           Version: 4.84
          Platform: x86-64
        OS/Version: Linux
            Status: NEW
          Severity: bug
          Priority: medium
         Component: Lookups
        AssignedTo: tlyons@???
        ReportedBy: tlyons@???
                CC: exim-dev@???



I normally build Exim with mysql configured as a dynamically loaded lookup
module. I build it this way on CentOS 5.x and CentOS 6.x systems with no
problem. When I am building on Amazon's AMI 2014.3, the resulting mysql.so
cannot see the "mysql_servers" globally defined variable. It's basically a
CentOS 6 system that they upgraded almost everything:

$ uname -a
Linux localhost.localdomain 3.10.37-47.135.amzn1.x86_64 #1 SMP Fri Apr 18
03:28:26 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux

$ gcc -v
Using built-in specs.
COLLECT_GCC=/usr/bin/gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-amazon-linux/4.8.2/lto-wrapper
Target: x86_64-amazon-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man
--infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla
--enable-bootstrap --enable-shared --enable-threads=posix
--enable-checking=release --with-system-zlib --enable-__cxa_atexit
--disable-libunwind-exceptions --enable-gnu-unique-object
--enable-linker-build-id --with-linker-hash-style=gnu
--enable-languages=c,c++,fortran,ada,lto --enable-plugin
--enable-initfini-array --disable-libgcj --without-isl --without-cloog
--with-tune=generic --with-arch_32=i686 --build=x86_64-amazon-linux
Thread model: posix
gcc version 4.8.2 20131212 (Red Hat 4.8.2-7) (GCC)

The symptoms:

$ exim -bV
Exim version 4.84 #2 built 06-Sep-2014 14:26:19
Copyright (c) University of Cambridge, 1995 - 2014
(c) The Exim Maintainers and contributors in ACKNOWLEDGMENTS file, 2007 - 2014
Berkeley DB: Berkeley DB 4.7.25: (November 27, 2013)
Support for: crypteq iconv() IPv6 PAM Perl Expand_dlfunc TCPwrappers OpenSSL
Content_Scanning DKIM Old_Demime PRDR OCSP Experimental_SPF Experimental_SRS
Experimental_DMARC Experimental_Proxy Experimental_TPDA Experimental_Certnames
Lookups (built-in): lsearch wildlsearch nwildlsearch iplsearch cdb dbm dbmjz
dbmnz dnsdb dsearch ldap ldapdn ldapm nis nis0 nisplus passwd sqlite
Lookups (as-module): mysql
Authenticators: cram_md5 cyrus_sasl dovecot plaintext spa
Routers: accept dnslookup ipliteral manualroute queryprogram redirect
Transports: appendfile/maildir/mailstore/mbx autoreply lmtp pipe smtp
Fixed never_users: 0
Size of off_t: 8
Error loading mysql.so: /usr/lib64/exim/4.84-2.amzn1/lookups/mysql.so:
undefined symbol: mysql_servers
2014-09-17 17:06:00 Error loading lookup module mysql.so: NULL

The symbol list from the object file:

$ nm ../BUILD/exim-4.84/build-Linux-x86_64/lookups/mysql.so | tail -n 20
00000000000010c0 t mysql_open
                 U mysql_query@@libmysqlclient_16
0000000000001111 t mysql_quote
                 U mysql_real_connect@@libmysqlclient_16
                 U mysql_servers
0000000000001223 t mysql_tidy
                 U mysql_use_result@@libmysqlclient_16
00000000000010c6 T mysql_version_report
00000000000012be t perform_mysql_search
0000000000001000 t register_tm_clones
                 U store_get_3
                 U store_reset_3
                 U strchr@@GLIBC_2.2.5
                 U strcmp@@GLIBC_2.2.5
                 U string_cat
                 U string_copy
                 U string_sprintf
                 U strrchr@@GLIBC_2.2.5
                 U strtol@@GLIBC_2.2.5
00000000002023a8 d __TMC_END__


It actually looks the same on my CentOS 5.x build systems so the "U" may not be
an issue. But the libmysqlclient version confuses me. My CentOS 5.x systems
have percona compatibility libs for libmysqlclient.so.16, and this Amazon box
has mysql-5.5 isntalled, which the libs are libmysqlclient.so.18. I thought
the libmysqlclient_* label had to match the so version of the library?

The mysql shared module builds with no errors:

gcc -I/usr/include/mysql -L/usr/lib64/mysql -lmysqlclient -DDYNLOOKUP -shared
-rdynamic -O2 -g -I/usr/include -I/usr/include -O2 -g -DSPF -DSRS -fpie -DSPF
-I../src -I../../src -I../src/srs/src -I../../src/srs/src -I../../src/srs
-I/usr/include/mysql mysql.c -o mysql.so

The above compile command should be roughly explained by this:

$ grep -E '^(CFLAGS|LOOKUP_MYSQL)' ../BUILD/exim-4.84/Local/Makefile
LOOKUP_MYSQL_INCLUDE=-I/usr/include/mysql
LOOKUP_MYSQL_LIBS=-L/usr/${_lib}/mysql -lmysqlclient
LOOKUP_MYSQL=2
CFLAGS += -I/usr/include
CFLAGS += -I/usr/include
CFLAGS+=$(RPM_OPT_FLAGS) -DSPF -DSRS $(PIE)
CFLAGS += -DSPF -I../src -I../../src
CFLAGS += -I../src/srs/src -I../../src/srs/src -I../../src/srs

Any ideas where to start debugging this?


--
Configure bugmail: http://bugs.exim.org/userprefs.cgi?tab=email