← Back to team overview

maria-discuss team mailing list archive

Re: Cross compile issue

 

Dear Sergei,

You are right. My pcre version of cross compile is 8.30. Now I upgrade it to 8.37.
Then I meet the another issue about strerror prototype define because it's different with my Linux 3.1.4.27.
  [ 62%] Building CXX object storage/connect/CMakeFiles/connect.dir/filamvct.cpp.o
  /home/johnson/SanSoft/model/Phoenix_130313/Package/mariadb/mariadb-10.0.21/storage/connect/filamvct.cpp:70:23: error: declaration of ‘char* strerror(int)’ has a different exception specifier
     char *strerror(int num);
                       ^
  In file included from /home/johnson/SanSoft/model/Phoenix_130313/Package/mariadb/mariadb-10.0.21/storage/connect/global.h:9:0,
                 from /home/johnson/SanSoft/model/Phoenix_130313/Package/mariadb/mariadb-10.0.21/storage/connect/filamvct.cpp:51:
  /home/johnson/SanSoft/model/Phoenix_130313/build/sysroot/usr/include/string.h:413:14: error: from previous declaration ‘char* strerror(int) throw ()’
   extern char *strerror (int __errnum) __THROW;
              ^ 
  make[2]: *** [storage/connect/CMakeFiles/connect.dir/filamvct.cpp.o] Error 1 
  make[1]: *** [storage/connect/CMakeFiles/connect.dir/all] Error 2
  make: *** [all] Error 2

My solution is commend out strerror define in storage/connect/filamvct.cpp and storage/connect/tabvct.cpp files.
  #if defined(UNIX)
  // Add dummy strerror  (NGC)
  //char *strerror(int num);
  #endif   // UNIX

Is it right? Or have better solution?


Best Regards,
Johnson

-----Original Message-----
From: Sergei Golubchik [mailto:serg@xxxxxxxxxxx] 
Sent: Friday, August 28, 2015 4:48 PM
To: Johnson Cheng
Cc: maria-discuss@xxxxxxxxxxxxxxxxxxx
Subject: Re: [Maria-discuss] Cross compile issue

Hi, Johnson!

On Aug 28, Johnson Cheng wrote:
> 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?

pcre_stack_guard was our addition to pcre to fix stack overflow issues.
we have pcre in the source tree and it was patched to have pcre_stack_guard. We've also submitted the patch upstream and it got into pcre-8.34 (iirc). So our CMakeLists.txt tests whether pcre_stack_guard is present in the system pcre and if not - uses bundled pcre.

I suspect that your native system pcre is 8.34 or later and your cross-compilation pcre is older, so cmake thought that it can use system pcre and later that failed. You can fix it either by upgrading your cross-compilation pcre or by forcing bundled pcre.

Regards,
Sergei

References