Bug #20373 compile fail in mysql_tzinfo_to_sql
Submitted: 10 Jun 2006 7:47 Modified: 13 Jul 2006 14:31
Reporter: Jesus Lara Email Updates:
Status: No Feedback Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:5.1.11-beta OS:Linux (Linux Fedora Core 5)
Assigned to: CPU Architecture:Any

[10 Jun 2006 7:47] Jesus Lara
Description:
When i try compile mysql 5.1.11-beta with this sentence:

CC="gcc" CFLAGS="-O4" CXX="g++" CXXFLAGS="-O4 -fPIC -mtune=pentium-m -march=pentium-m -pipe -msse3 -fno-exceptions -felide-constructors" \
LDFLAGS="-L/usr/local/lib" MYSQL_EXTRA_LDFLAGS="-L/usr/local/zlib/lib -lz -L/usr/local/ssl/lib -lssl" \
CPPFLAGS="-I/usr/local/ssl/include/openssl -I/usr/local/zlib/include" \
./configure --prefix=/usr/local/mysql -with-zlib=/usr/local/zlib --with-ssl=/usr/local/ssl \
--enable-assembler --enable-shared --enable-static --with-gnu-ld

fail creating mysql_tzinfo_to_sql.o:
/usr/lib/gcc/i386-redhat-linux/4.1.0/../../../crt1.o: In function `_start': undefined reference to `main'
mysql_tzinfo_to_sql.o: In function `Time_zone_utc::gmt_sec_to_TIME(st_mysql_time*, long) const':mysql_tzinfo_to_sql.cc:(.text+0x7bd): undefined reference to `localtime_to_TIME(st_mysql_time*, tm*)'
mysql_tzinfo_to_sql.o: In function `Time_zone_system::gmt_sec_to_TIME(st_mysql_time*, long) const':mysql_tzinfo_to_sql.cc:(.text+0x81d): undefined reference to `localtime_to_TIME(st_mysql_time*, tm*)'mysql_tzinfo_to_sql.o: In function `Time_zone_system::TIME_to_gmt_sec(st_mysql_time const*, char*) const':mysql_tzinfo_to_sql.cc:(.text+0x867): undefined reference to `my_system_gmt_sec'
mysql_tzinfo_to_sql.o: In function `my_tz_find(String const*, st_table_list*)':mysql_tzinfo_to_sql.cc:(.text+0xfbd): undefined reference to `sql_print_error(char const*, ...)'
:mysql_tzinfo_to_sql.cc:(.text+0x1034): undefined reference to `sql_print_error(char const*, ...)'
:mysql_tzinfo_to_sql.cc:(.text+0x11e5): undefined reference to `sql_print_error(char const*, ...)'
:mysql_tzinfo_to_sql.cc:(.text+0x11fa): undefined reference to `sql_print_error(char const*, ...)'
:mysql_tzinfo_to_sql.cc:(.text+0x1214): undefined reference to `sql_print_error(char const*, ...)'
mysql_tzinfo_to_sql.o:mysql_tzinfo_to_sql.cc:(.text+0x13a8): more undefined references to `sql_print_error(char const*, ...)' follow
mysql_tzinfo_to_sql.o: In function `my_tz_init(THD*, char const*, char)':mysql_tzinfo_to_sql.cc:(.text+0x1bc1): undefined reference to `THD::THD()'
:mysql_tzinfo_to_sql.cc:(.text+0x1be2): undefined reference to `THD::store_globals()'
:mysql_tzinfo_to_sql.cc:(.text+0x1c32): undefined reference to `sql_print_error(char const*, ...)'
:mysql_tzinfo_to_sql.cc:(.text+0x1c57): undefined reference to `THD::store_globals()'
:mysql_tzinfo_to_sql.cc:(.text+0x1dc7): undefined reference to `global_system_variables'
:mysql_tzinfo_to_sql.cc:(.text+0x1e05): undefined reference to `close_thread_tables(THD*, bool, bool)'
:mysql_tzinfo_to_sql.cc:(.text+0x1e36): undefined reference to `sql_print_error(char const*, ...)'
:mysql_tzinfo_to_sql.cc:(.text+0x1e4f): undefined reference to `THR_THD'
:mysql_tzinfo_to_sql.cc:(.text+0x1e65): undefined reference to `THR_MALLOC'
:mysql_tzinfo_to_sql.cc:(.text+0x1e8a): undefined reference to `sql_print_error(char const*, ...)'
:mysql_tzinfo_to_sql.cc:(.text+0x202c): undefined reference to `simple_open_n_lock_tables(THD*, st_table_list*)'
:mysql_tzinfo_to_sql.cc:(.text+0x204a): undefined reference to `sql_print_warning(char const*, ...)':mysql_tzinfo_to_sql.cc:(.text+0x213b): undefined reference to `sql_print_error(char const*, ...)'
:mysql_tzinfo_to_sql.cc:(.text+0x2183): undefined reference to `sql_print_error(char const*, ...)'
:mysql_tzinfo_to_sql.cc:(.text+0x21a4): undefined reference to `sql_print_error(char const*, ...)'
:mysql_tzinfo_to_sql.cc:(.text+0x21c9): undefined reference to `sql_print_error(char const*, ...)'
mysql_tzinfo_to_sql.o: In function `my_tz_find_with_opening_tz_tables(THD*, String const*)':mysql_tzinfo_to_sql.cc:(.text+0x273d): undefined reference to `simple_open_n_lock_tables(THD*, st_table_list*)'
:mysql_tzinfo_to_sql.cc:(.text+0x2770): undefined reference to `close_thread_tables(THD*, bool, bool)'
collect2: ld returned 1 exit status
make[4]: *** [mysql_tzinfo_to_sql] Error 1
make[4]: Leaving directory `/usr/local/src/mysql-5.1.11-beta/sql'
make[3]: *** [all-recursive] Error 1
make[3]: Leaving directory `/usr/local/src/mysql-5.1.11-beta/sql'
make[2]: *** [all] Error 2
make[2]: Leaving directory `/usr/local/src/mysql-5.1.11-beta/sql'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/usr/local/src/mysql-5.1.11-beta'
make: *** [all] Error 2

I have installed all dependencies:
i have installed:
gcc (GCC) 4.1.0 20060304
autoconf (GNU Autoconf) 2.59
automake (GNU automake) 1.9.6
zlib 1.2.3 (compiled from myself).
OpenSSL 0.9.8a 11 Oct 2005
glibc-2.4-8

How to repeat:
Compile with any pre-compiled flag, using:

./configure --prefix=/usr/local/mysql -with-zlib=/usr/local/zlib --with-ssl=/usr/local/ssl \
--enable-assembler --enable-shared --enable-static --with-gnu-ld

Suggested fix:
 ldd /usr/local/mysql/bin/mysql_tzinfo_to_sql in a old installation return:
        linux-gate.so.1 =>  (0xffffe000)
        libz.so.1 => /usr/lib/libz.so.1 (0x0025d000)
        libpthread.so.0 => /lib/libpthread.so.0 (0xb7f53000)
        libcrypt.so.1 => /lib/libcrypt.so.1 (0xb7f25000)
        libnsl.so.1 => /lib/libnsl.so.1 (0xb7f0f000)
        libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x05d1c000)
        libm.so.6 => /lib/libm.so.6 (0xb7ee9000)
        libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x004e5000)
        libc.so.6 => /lib/libc.so.6 (0xb7db6000)
        /lib/ld-linux.so.2 (0xb7f87000)
compiled using a system zlib fail too.

erasing the presence of the zlib library (--with-zlib), obtain it the same result.

using a "minimal" sentence:
./configure --prefix=/usr/local/mysql  \
--enable-assembler --enable-shared --enable-static --with-gnu-ld

compile well but fail in this test:
create                         [ fail ]

Errors are (from /usr/local/src/mysql-5.1.11-beta/mysql-test/var/log/mysqltest-time) :
mysqltest: Result length mismatch
(the last lines may be the most important ones)
Below are the diffs between actual and expected results:
-------------------------------------------------------
*** r/create.result     2006-06-02 21:18:38.000000000 +0300
--- r/create.reject     2006-06-10 10:49:56.000000000 +0300
***************
*** 775,780 ****
  create table t1(f1 varchar(800) binary not null, key(f1)) engine = innodb
  character set utf8 collate utf8_general_ci;
  Warnings:
! Warning       1071    Specified key was too long; max key length is 765 bytes
  insert into t1 values('aaa');
  drop table t1;
--- 775,781 ----
  create table t1(f1 varchar(800) binary not null, key(f1)) engine = innodb
  character set utf8 collate utf8_general_ci;
  Warnings:
! Warning       1266    Using storage engine MyISAM for table 't1'
! Warning       1071    Specified key was too long; max key length is 999 bytes
  insert into t1 values('aaa');
  drop table t1;
-------------------------------------------------------

although mysql works well.
[11 Jun 2006 7:11] Valeriy Kravchuk
Thank you for the problem report. Failure of "create" test in your second comment is understandable: you have to explicitely add --with-innodb and so on for ALL storage engines (except MyISAM) in 5.1.x. So, it does not indicate any problem.

Coming back to your original configure:

./configure --prefix=/usr/local/mysql -with-zlib=/usr/local/zlib
--with-ssl=/usr/local/ssl \
--enable-assembler --enable-shared --enable-static --with-gnu-ld

-with-zlib=/usr/local/zlib is wrong - you have to provide two dashes:

--with-zlib=/usr/local/zlib

I have two questions: 

Did you really installed your OpenSSL into /usr/local/ssl?
Did you really installed your zlib into /usr/local/zlib?

Please, check again.
[12 Jun 2006 20:11] Jesus Lara
Yes! ... i have installed both libraries in /usr/local, apache2 with mod_ssl (--with-openssl=/usr/local/ssl) and php with openssl, bind 9.32 and others apps working, they are using these libraries  ...
i have static and shared versions of zlib (libz.so and libz.a).

Well, i edited Makefile, change ZLIB_INCLUDES=/usr/local/zlib/include and ZLIB_LIBS to include -lz (instead of a version bundled of zlib) (option --with-zlib=/usr/local/zlib it seems not to be working correctly), MySQL compile fine and work well (and php-mysql and php-mysqli extensions work too).

NOTE:
MYSQLD_EXTRA_LDFLAGS are ignored by ./configure?.

if i use the "minimal" sentence, mysql compile with a "bundled" version of zlib (check ZLIB_INCLUDES and ZLIB_LIBS) instead of using the system version.

about a "Create" test, it's not a problem, I mention the 2 answers emitted by the test only.
[13 Jun 2006 14:31] Valeriy Kravchuk
Please, clarify what is a bug here, from your point of view. Using bundled libz by default?
[13 Jul 2006 23: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".