← Back to team overview

maria-discuss team mailing list archive

Re: Cross compile issue


Dear Sergei,

My tool chain support atomic oops, but HAVE_IB_GCC_ATOMIC_BUILTINS will not set because I use cross-compiling. (from storage/xtradb/CMakeLists.txt rule)
Yes. I use "-DHAVE_IB_GCC_ATOMIC_BUILTINS=1" instead of "-DXTRADB_OK=1" to work around this issue because my tool chain really support atomic opps.
As you said, I will meet the cross compile issue. It failed at the below message,
  [ 47%] Building CXX object sql/CMakeFiles/sql.dir/mysqld.cc.o
  cd /home/johnson/SanSoft/model/Phoenix_130313/Package/mariadb/mariadb-10.0.21/sql && /home/johnson/x86_64_TCglibc-2.19-3/usr/bin/x86_64-buildroot-linux-gnu-g++   -DHAVE_CONFIG_H -DHAVE_EVENT_SCHEDULER -DHAVE_OPENSSL -DHAVE_POOL_OF_THREADS -DMYSQL_SERVER -I/home/johnson/SanSoft/model/Phoenix_130313/build/sysroot/usr/include -I/home/johnson/SanSoft/model/Phoenix_130313/build/sysroot/include  -fno-exceptions -fno-rtti -O2 -g -DNDEBUG -DDBUG_OFF -I/home/johnson/SanSoft/model/Phoenix_130313/Package/mariadb/mariadb-10.0.21/include -I/home/johnson/SanSoft/model/Phoenix_130313/Package/mariadb/mariadb-10.0.21/sql -I/home/johnson/SanSoft/model/Phoenix_130313/Package/mariadb/mariadb-10.0.21/pcre -I/home/johnson/SanSoft/model/Phoenix_130313/build/sysroot/usr/include    -o CMakeFiles/sql.dir/mysqld.cc.o -c /home/johnson/SanSoft/model/Phoenix_130313/Package/mariadb/mariadb-10.0.21/sql/mysqld.cc
/home/johnson/SanSoft/model/Phoenix_130313/Package/mariadb/mariadb-10.0.21/sql/mysqld.cc: In function ‘void init_pcre()’:
/home/johnson/SanSoft/model/Phoenix_130313/Package/mariadb/mariadb-10.0.21/sql/mysqld.cc:3585:3: error: ‘pcre_stack_guard’ was not declared in this scope
   pcre_stack_guard= check_enough_stack_size_slow;
  make[2]: *** [sql/CMakeFiles/sql.dir/mysqld.cc.o] Error 1

Could you give me some advice?

Best Regards,

-----Original Message-----
From: Sergei Golubchik [mailto:serg@xxxxxxxxxxx] 
Sent: Thursday, August 27, 2015 10:07 PM
To: Johnson Cheng
Cc: maria-discuss@xxxxxxxxxxxxxxxxxxx
Subject: Re: [Maria-discuss] Cross compile issue

Hi, Johnson!

On Aug 27, Johnson Cheng wrote:
> Dear Sergei,
> Sorry to update again. (I am a newer on cmake) I did some 
> modifications on my configure command as below, 
> LD=/home/johnson/x86_64_TCglibc-2.19-3/usr/bin/x86_64-buildroot-linux-gnu-ld NM=/home/johnson/x86_64_TCglibc-2.19-3/usr/bin/x86_64-buildroot-linux-gnu-nm CC=/home/johnson/x86_64_TCglibc-2.19-3/usr/bin/x86_64-buildroot-linux-gnu-gcc GCC=/home/johnson/x86_64_TCglibc-2.19-3/usr/bin/x86_64-buildroot-linux-gnu-gcc CXX=/home/johnson/x86_64_TCglibc-2.19-3/usr/bin/x86_64-buildroot-linux-gnu-g++ RANLIB=/home/johnson/x86_64_TCglibc-2.19-3/usr/bin/x86_64-buildroot-linux-gnu-ranlib \
>                 CFLAGS="-I/home/johnson/cross_prj/sysroot/usr/include -I/home/johnson/cross_prj/sysroot/include" \
>                 CXXFLAGS="-I/home/johnson/cross_prj/sysroot/usr/include -I/home/johnson/cross_prj/sysroot/include" \
>                 LDFLAGS="-L/home/johnson/cross_prj/sysroot/lib -L/home/johnson/cross_prj/sysroot/usr/lib -lm -lz -ldl -lcrypt -pthread" \
>                 CXXLDFLAGS="-L/home/johnson/cross_prj/sysroot/lib -L/home/johnson/cross_prj/sysroot/usr/lib -lm -lz -ldl -lcrypt -pthread" \
>                 ../../cmake/HOST-cmake/bin/cmake . \
>                 -DCMAKE_TOOLCHAIN_FILE=../cross.cmake \
>                 -DIMPORT_EXECUTABLES=/home/johnson/SanSoft/model/Phoenix_130313/Package/mariadb/native/import_executables.cmake \
>                 -DXTRADB_OK=1

This is not a good idea. I mean -DXTRADB_OK=1. XTRADB_OK is set internally if HAVE_IB_GCC_ATOMIC_BUILTINS or HAVE_IB_SOLARIS_ATOMICS or MSVC is defined. Depending on what exactly is defined, different parts of the code are enabled. When you force XTRADB_OK=1 without enabling any of the other defines, XtraDB will not enable any of these parts of the code. Most probably it won't compile at all.

Instead of forcing -DXTRADB_OK=1, you need to do -DHAVE_IB_GCC_ATOMIC_BUILTINS=1.
Then XtraDB will compile as if gcc atomic builtins were available.
They probably are anyway, but cross-compilation caused the test to fail.

> It can success to configure, but it still has DB warning message. I am 
> not sure if I can ignore it??
>   CMake Warning at storage/tokudb/CMakeLists.txt:17 (MESSAGE):
>     TokuDB is enabled, but jemalloc is not.  This configuration is not 
> supported

If you intend to use tokudb, then you probably should not ignore it.
if you don't intend to use tokudb, you can as well specify -DWITHOUT_TOKUDB=1 and it won't be compiled at all.

> Now I type "make" to do cross compiling, It seems it's not easy...
>  [ 17%] Building CXX object 
> storage/xtradb/CMakeFiles/xtradb.dir/buf/buf0buddy.cc.o
>  [ 17%] Building CXX object 
> storage/xtradb/CMakeFiles/xtradb.dir/buf/buf0buf.cc.o
>  /home/johnson/SanSoft/model/Phoenix_130313/Package/mariadb/mariadb-10.0.21/storage/xtradb/buf/buf0buf.cc: In function �buf_block_t* buf_page_get_gen(ulint, ulint, ulint, ulint, buf_block_t*, ulint, const char*, ulint, mtr_t*)’:
>  /home/johnson/SanSoft/model/Phoenix_130313/Package/mariadb/mariadb-10.0.21/storage/xtradb/buf/buf0buf.cc:3021:55: error: �os_atomic_increment_ulint’ was not declared in this scope
>    os_atomic_increment_ulint(&buf_pool->n_pend_unzip, 1);
>                                                  ^

That's exactly what I meant above. This error happens because you've defined TOKUDB_OK=1


Follow ups