Bug #28267 | Cannot build with OpenSSL | ||
---|---|---|---|
Submitted: | 6 May 2007 15:07 | Modified: | 9 Jun 2007 17:59 |
Reporter: | Gerry Reno | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | MySQL Server: Compiling | Severity: | S1 (Critical) |
Version: | 5.1.17-beta | OS: | Any |
Assigned to: | Magnus Blåudd | CPU Architecture: | Any |
[6 May 2007 15:07]
Gerry Reno
[6 May 2007 15:24]
Gerry Reno
Here is my version of g++: # g++ --version g++ (GCC) 4.1.1 20070105 (Red Hat 4.1.1-51) When I google this error about crt1.o: underfined reference to 'main' I get threads that talk about things being compiled with incompatible compiler versions. Could that be related to the problem here?
[6 May 2007 16:39]
Gerry Reno
Here is my configure line: env LD_RUN_PATH=/opt/lampp/lib LD_LIBRARY_PATH="/opt/lampp/lib" CFLAGS="-O6 -I/opt/lampp/include -L/opt/lampp/lib -Wl,--rpath -Wl,/opt/lampp/lib" ./configure --prefix=/opt/lampp --enable-assembler --enable-local-infile --with-mysqld-user=nobody --with-unix-socket-path=/opt/lampp/var/mysql/mysql.sock --with-extra-charsets=complex --libexecdir=/opt/lampp/sbin --sysconfdir=/opt/lampp/etc --datadir=/opt/lampp/share --localstatedir=/opt/lampp/var/mysql --infodir=/opt/lampp/info --includedir=/opt/lampp/include --mandir=/opt/lampp/man --with-innodb --with-vio --with-ssl=/opt/lampp --with-ssl-includes=/opt/lampp/include --with-ssl-libs=/opt/lampp/lib --with-archive-storage-engine --with-federated-storage-engine --with-csv-storage-engine --with-ndbcluster --with-bdb --enable-thread-safe-client || exit 1
[6 May 2007 21:25]
Gerry Reno
My original configure had these openssl arguments: --with-openssl=/opt/lampp --with-openssl-includes=/opt/lampp/include --with-openssl-libs=/opt/lampp/lib Here is the original error: checking for SSL... configure: error: The flag --with-openssl is deprecated, use --with-ssl the build exits at this point. I then changed the openssl configure arguments to: --with-ssl=/opt/lampp --with-ssl-includes=/opt/lampp/include --with-ssl-libs=/opt/lampp/lib and the build went quite a bit further but still errored out in sql/ as described earlier. I've also tried a build with these configure arguments: --with-ssl=/opt/lampp --with-openssl-includes=/opt/lampp/include --with-openssl-libs=/opt/lampp/lib Same results.
[6 May 2007 23:00]
Gerry Reno
I just did a build of 5.1 from BitKeeper and had the exact same problems.
[7 May 2007 7:54]
Sveta Smirnova
Thank you for the report. Verified as described. It seems to be duplicate of bug #25337, but as errors are different, I'll let developers who will fix it to decide if this is a duplicate or not.
[7 May 2007 8:24]
Magnus Blåudd
Hi, in 5.1 there is only one switch to configure to use for ssl. It's called --with-ssl. You can't make up your own. ;) [msvensson@pilot mysql-5.1]$ ./configure --help | grep ssl --with-ssl=DIR Include SSL support The switch will by default use the SSL library shipped with MySQL sources called yassl. ./configure --with-ssl To build with the openSSL library you point out the base dir(where your lib and include are lcoated). In your example it would be ./configure --with-ssl=/opt/lampp But this does not explain the compile failure. Let me check.
[7 May 2007 8:33]
Magnus Blåudd
It looks like there is an empty -I in the compile line. That causes the crucial -DTZINFO2SQL to be "sucked into it"... g++ -DMYSQL_SERVER -DDEFAULT_MYSQL_HOME="\"/opt/lampp\"" -DDATADIR="\"/opt/lampp/var/mysql\"" -DSHAREDIR="\"/opt/lampp/share/mysql\"" -DLIBDIR="\"/opt/lampp/lib/mysql\"" -DHAVE_CONFIG_H -I. -I. -I.. -I../include -I../include -I../regex -I. -I -DTZINFO2SQL -O3 -fno-implicit-templates ^^^^^^^^^^^^^^^ This becomes one directive to the compiler and thus the deinfe is lost cuasing mysql_tz_info_to_sql.c to be compiled in the wrong way.
[7 May 2007 8:53]
Magnus Blåudd
My conclusion is that the check for openSSL done by configure in some way outputs the empty -I direcive to the compiler. The configure check will setup the -I and -L switches and the try to compile a a small program that uses SSL_library_init. If that program can be compiled and linked those -I and -L switches will be used ie. they are saved in $openssl_includes and $openssl_libs to be used in Makefile's In this case the $openssl_includes variable becomes set to "-I" and that is no good. I believe it's caused by the -I directives you specify in CFLAGS="-O6 -I/opt/lampp/include -L/opt/lampp/lib -Wl,--rpath -Wl,/opt/lampp/lib" which points to the same dir as specified with --with-ssl. Thus it works anyway. Please try with a minimal configure line and post the results from ./configure when it detects ssl
[7 May 2007 9:07]
Magnus Blåudd
Just found a spelling error in config/ac-macros/ssl.m4 causing this error.
[7 May 2007 9:50]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/26206 ChangeSet@1.2505, 2007-05-07 11:50:38+02:00, msvensson@pilot.blaudden +1 -0 Bug #28267 Cannot build with OpenSSL - Fix use of uninitialized variable in config/ac-macros/ssl.m4
[7 May 2007 14:03]
Gerry Reno
Thanks for the quick attention to this problem. I applied pending patch 26206 and was able to successfully build 5.1.17-beta as follows: 1st build: --with-ssl=/opt/lampp --with-openssl-includes=/opt/lampp/include --with-openssl-libs=/opt/lampp/lib 2nd build: --with-ssl=/opt/lampp [no specific directives for openssl includes or libs] The only issue that I still see is one of consistency. If we are going to use the new --with-ssl directive then we should also be using --with-ssl-includes and --with-ssl-libs rather than the 'openssl' types. To mix these will be confusing for users.
[7 May 2007 14:40]
Gerry Reno
Still some problems. The build and install completed but when I try to start the server it will not start and I see this in the log: 070507 10:24:55 mysqld started /opt/lampp/sbin/mysqld: error while loading shared libraries: libssl.so.0.9.8: cannot open shared object file: No such file or directory 070507 10:24:55 mysqld ended Checking /opt/lampp/lib shows: ls /opt/lampp/lib/libssl* -l -rw-r--r-- 1 root root 355534 Apr 13 02:54 /opt/lampp/lib/libssl.a lrwxrwxrwx 1 root root 15 May 5 23:51 /opt/lampp/lib/libssl.so -> libssl.so.0.9.8 -r-xr-xr-x 1 root root 240516 Apr 17 12:13 /opt/lampp/lib/libssl.so.0.9.8 Checking /opt/lampp/lib/mysql shows: ls /opt/lampp/lib/mysql/libssl* -l lrwxrwxrwx 1 root root 18 Apr 12 10:19 /opt/lampp/lib/mysql/libssl.so.0.9.8 -> ../libssl.so.0.9.8 So this library is in place. And it's been working with the previous mysql installation (5.0.37). I do notice that now libcrypto has been removed. It was there previously.
[7 May 2007 15:05]
Gerry Reno
libcrypto is there. I mistyped the name while looking for it.
[7 May 2007 16:37]
Gerry Reno
The only way that I can get the server to start is by adding: export LD_LIBRARY_PATH=/opt/lampp/lib to my environment. Is this required? Shouldn't the server already know where to find the shared libs?
[7 May 2007 17:16]
Magnus Blåudd
>The only issue that I still see is one of consistency. If we are going to use >the new --with-ssl directive then we should also be using --with-ssl-includes >and --with-ssl-libs rather than the 'openssl' types. To mix these will be >confusing for users. There are no such options anymore. Did you find refernces in the manual?
[7 May 2007 17:52]
Gerry Reno
Sorry about that. I misunderstood what that meant about the --with-ssl. The build and install are now working fine. Should I open another bug about the shared lib error? Unless I specifically add /opt/lampp/lib to my LD_LIBRARY_PATH env variable the server will not start.
[8 May 2007 8:01]
Sveta Smirnova
>Shouldn't the server already know where to find the shared libs? No, server shouldn't know where to find the shared libs. This is expected behaviour.
[9 May 2007 19:15]
Magnus Blåudd
Gerry, it might be the case that the value of LD_RUN_PATH should somehow be compiled into the binary. You can experiment with that.
[9 May 2007 19:42]
Gerry Reno
I was thinking that the server should check for LD_LIBRARY_PATH and if found, prepend it to the default compiled-in shared library path.
[22 May 2007 17:01]
Bugs System
Pushed into 5.1.19-beta
[9 Jun 2007 17:59]
Paul DuBois
No changelog entry needed.