← Back to team overview

maria-discuss team mailing list archive

Re: Cross compile issue

 

Hi, Johnson!

On Aug 27, Johnson Cheng wrote:
> Dear Sergei,
> 
> Thanks for your reply.
> I am sorry that I can NOT find any document about cross compile from knowledge base.
> https://mariadb.com/kb/en/mariadb/getting-installing-and-upgrading-mariadb/

Yes, that's why I suggested to search the mailing list too. I wasn't
sure there's something in the knowledge base :(

> My host machine is Debian5. (gcc version is 4.3.2)
> My target machine is Intel x86_64 with gcc version is 4.8.3
> My Cmake version is 3.2.2 on host machine
> Here is my cmake command to configure mariadb-10.0.21 for cross compile,
>   PATH=/home/johnson/x86_64_TCglibc-2.19-3/usr/bin/:/bin:/sbin:/usr/bin:/usr/sbin AR=/home/johnson/x86_64_TCglibc-2.19-3/usr/bin/x86_64-buildroot-linux-gnu-ar AS=/home/johnson/x86_64_TCglibc-2.19-3/usr/bin/x86_64-buildroot-linux-gnu-as   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 .
> 
> Unfortunately I meet the below error while typing "make VERBOSE=1",
> [ 15%] Generating ../include/mysqld_error.h.tmp
> cd /home/johnson/SanSoft/model/Phoenix_130313/Package/mariadb/mariadb-10.0.21/extra && ./comp_err --charset=/home/johnson/SanSoft/model/Phoenix_130313/Package/mariadb/mariadb-10.0.21/sql/share/charsets --out-dir=/home/johnson/SanSoft/model/Phoenix_130313/Package/mariadb/mariadb-10.0.21/sql/share/ --header_file=/home/johnson/SanSoft/model/Phoenix_130313/Package/mariadb/mariadb-10.0.21/include/mysqld_error.h.tmp --name_file=/home/johnson/SanSoft/model/Phoenix_130313/Package/mariadb/mariadb-10.0.21/include/mysqld_ername.h.tmp --state_file=/home/johnson/SanSoft/model/Phoenix_130313/Package/mariadb/mariadb-10.0.21/include/sql_state.h.tmp --in_file=/home/johnson/SanSoft/model/Phoenix_130313/Package/mariadb/mariadb-10.0.21/sql/share/errmsg-utf8.txt
> ./comp_err: /lib/libc.so.6: version `GLIBC_2.14' not found (required by ./comp_err)
> ./comp_err: /lib/libc.so.6: version `GLIBC_2.17' not found (required by ./comp_err)
> make[2]: *** [include/mysqld_error.h.tmp] Error 1
> 
> It tries to use my cross compiled extra/comp_err utility to do something at my host machine.

Right...
During the build few helper tools are compiled and used in the build.
See http://www.cmake.org/Wiki/CMake_Cross_Compiling
In particular, we implement the solution from
http://www.cmake.org/Wiki/CMake_Cross_Compiling#Using_executables_in_the_build_created_during_the_build

So, you need to build for the native platform first. Not everything, just
"import_executables" target:

  make import_executables

This will create import_executables.cmake file. When you cross-compile
you'll need to set IMPORT_EXECUTABLES to the path to that file.
 
Regards,
Sergei


Follow ups

References