Bug #61625 Compiling with -DWITHOUT_PARTITION_STORAGE_ENGINE=1 and without -O fails!
Submitted: 24 Jun 2011 11:34 Modified: 22 Jul 2011 18:39
Reporter: Frank Gum Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Compiling Severity:S3 (Non-critical)
Version:5.5.15, 5.5.13 OS:Any
Assigned to: CPU Architecture:Any

[24 Jun 2011 11:34] Frank Gum
Description:
Compiling mysql 5.5.13 fails if you use gcc without -O or using a compiler which does not remove function calls which are non-existant (caused by optimisation)!

How to repeat:

tar xf src/mysql-5.5.13.tar.gz 
cd mysql-5.5.13
mkdir bld
cd bld

CFLAGS="-g" CPPFLAGS="-g" CXXFLAGS="-g" cmake .. -DWITHOUT_PARTITION_STORAGE_ENGINE=1
make

will give the error at the end:
[100%] Building CXX object sql/CMakeFiles/mysqld.dir/main.cc.o
Linking CXX executable mysqld
libsql.a(sql_update.cc.o): In function `unsafe_key_update':
/home/xxx/Downloads/mysql-5.5.13/sql/sql_update.cc:1061: undefined reference to `partition_key_modified(TABLE*, st_bitmap const*)'
/home/xxx/Downloads/mysql-5.5.13/sql/sql_update.cc:1061: undefined reference to `partition_key_modified(TABLE*, st_bitmap const*)'
collect2: ld returned 1 exit status
make[2]: *** [sql/mysqld] Error 1
make[1]: *** [sql/CMakeFiles/mysqld.dir/all] Error 2
make: *** [all] Error 2

Suggested fix:

There is a missed
#ifdef WITH_PARTITION_STORAGE_ENGINE
in sql/sql_update.cc around the code using the function 'partition_key_modified' which is only needed/used when PARTITION_STORAGE_ENGINE is available.
[24 Jun 2011 13:43] Valeriy Kravchuk
Verified with current mysql-5.5 from bzr on Mac OS X:

...
[ 64%] Building CXX object sql/CMakeFiles/mysqld.dir/main.cc.o
Linking CXX executable mysqld
ld warning: ___cxa_pure_virtual has different visibility (hidden) in ../extra/yassl/taocrypt/libtaocrypt.a(misc.cpp.o) and (default) in ../mysys/libmysys.a(my_new.cc.o)
ld warning: TaoCrypt::virtual_base::operator delete(void*)has different visibility (default) in libsql.a(sha2.cc.o) and (hidden) in ../extra/yassl/libyassl.a(crypto_wrapper.cpp.o)
ld warning: TaoCrypt::HASH::~HASH()has different visibility (default) in libsql.a(sha2.cc.o) and (hidden) in ../extra/yassl/libyassl.a(crypto_wrapper.cpp.o)
ld warning: TaoCrypt::HASHwithTransform::~HASHwithTransform()has different visibility (default) in libsql.a(sha2.cc.o) and (hidden) in ../extra/yassl/libyassl.a(crypto_wrapper.cpp.o)
ld warning: TaoCrypt::SHA224::~SHA224()has different visibility (default) in libsql.a(sha2.cc.o) and (hidden) in ../extra/yassl/taocrypt/libtaocrypt.a(sha.cpp.o)
ld warning: TaoCrypt::HASH::~HASH()has different visibility (default) in libsql.a(sha2.cc.o) and (hidden) in ../extra/yassl/libyassl.a(crypto_wrapper.cpp.o)
ld warning: TaoCrypt::HASH::~HASH()has different visibility (default) in libsql.a(sha2.cc.o) and (hidden) in ../extra/yassl/libyassl.a(crypto_wrapper.cpp.o)
ld warning: TaoCrypt::SHA256::~SHA256()has different visibility (default) in libsql.a(sha2.cc.o) and (hidden) in ../extra/yassl/taocrypt/libtaocrypt.a(sha.cpp.o)
ld warning: TaoCrypt::HASH64withTransform::~HASH64withTransform()has different visibility (default) in libsql.a(sha2.cc.o) and (hidden) in ../extra/yassl/taocrypt/libtaocrypt.a(sha.cpp.o)
ld warning: TaoCrypt::SHA384::~SHA384()has different visibility (default) in libsql.a(sha2.cc.o) and (hidden) in ../extra/yassl/taocrypt/libtaocrypt.a(sha.cpp.o)
ld warning: TaoCrypt::SHA512::~SHA512()has different visibility (default) in libsql.a(sha2.cc.o) and (hidden) in ../extra/yassl/taocrypt/libtaocrypt.a(sha.cpp.o)
ld warning: vtable for TaoCrypt::HASHhas different visibility (default) in libsql.a(sha2.cc.o) and (hidden) in ../extra/yassl/libyassl.a(crypto_wrapper.cpp.o)
Undefined symbols:
  "ha_partition::ha_partition(handlerton*, partition_info*)", referenced from:
      get_ha_partition(partition_info*)      in libsql.a(handler.cc.o)
  "ha_partition::initialize_partition(st_mem_root*)", referenced from:
      get_ha_partition(partition_info*)      in libsql.a(handler.cc.o)
  "ha_partition::truncate_partition(Alter_info*, bool*)", referenced from:
      Alter_table_truncate_partition_statement::execute(THD*)      in libsql.a(sql_partition_admin.cc.o)
ld: symbol(s) not found
collect2: ld returned 1 exit status
make[2]: *** [sql/mysqld] Error 1
make[1]: *** [sql/CMakeFiles/mysqld.dir/all] Error 2
make: *** [all] Error 2
macbook-pro:mysql-5.5-work openxs$ fc -l
...
990	 cd ../mysql-5.5-work/
991	 bzr pull
992	 CFLAGS="-g" CPPFLAGS="-g" CXXFLAGS="-g" cmake .. -DWITHOUT_PARTITION_STORAGE_ENGINE=1
993	 CFLAGS="-g" CPPFLAGS="-g" CXXFLAGS="-g" cmake . -DWITHOUT_PARTITION_STORAGE_ENGINE=1
994	 make
[22 Jul 2011 18:39] Paul Dubois
Noted in 5.6.3 changelog.

The server failed to compile if partitioning support was disabled.