OpenWrt Forum Archive

Topic: Cross-compile problem in Backfire (mysqlclient)

The content of this topic has been archived on 28 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

I am trying to cross-compile a C code which inserts some data within a mysql database. Actually I want to generate an ipk package file to install it over OpenWrt backfire which is installed over a board. During the cross-compile, I got a problem with mysqlclient library:

#######################################################################
root@mypc# make V=99

make[4]: Entering directory `/home/dawood/openwrt_9Jan2011/backfire/build_dir/target-mips_r2_uClibc-0.9.30.1/OpenWrt-SDK-ar71xx-for-Linux-i686-gcc-4.3.3+cs_uClibc-0.9.30.1/build_dir/target-mips_r2_uClibc-0.9.30.1/ish'
mips-openwrt-linux-uclibc-gcc -O2 -Wall -o ish ish.c ish_main.c
ish.c:1: note: someone does not honour COPTS correctly, passed 0 times
ish_main.c:1: note: someone does not honour COPTS correctly, passed 0 times
mips-openwrt-linux-uclibc-gcc -O2 -Wall  -o ishd -I/usr/include/mysql  -DBIG_JOINS=1  -fno-strict-aliasing   -DUNIV_LINUX -DUNIV_LINUX ishd.c ish_main.c ish_open.c -Wl,-Bsymbolic-functions -rdynamic -L/usr/lib/mysql -lmysqlclient
cc1: warning: include location "/usr/include/mysql" is unsafe for cross-compilation
ishd.c:1: note: someone does not honour COPTS correctly, passed 0 times
cc1: warning: include location "/usr/include/mysql" is unsafe for cross-compilation
ish_main.c:1: note: someone does not honour COPTS correctly, passed 0 times
cc1: warning: include location "/usr/include/mysql" is unsafe for cross-compilation
ish_open.c:1: note: someone does not honour COPTS correctly, passed 0 times
/home/dawood/openwrt_9Jan2011/backfire/build_dir/target-mips_r2_uClibc-0.9.30.1/OpenWrt-SDK-ar71xx-for-Linux-i686-gcc-4.3.3+cs_uClibc-0.9.30.1/staging_dir/toolchain-mips_r2_gcc-4.3.3+cs_uClibc-0.9.30.1/usr/bin/../lib/gcc/mips-openwrt-linux-uclibc/4.3.3/../../../../mips-openwrt-linux-uclibc/bin/ld: skipping incompatible /home/dawood/openwrt_9Jan2011/backfire/build_dir/target-mips_r2_uClibc-0.9.30.1/OpenWrt-SDK-ar71xx-for-Linux-i686-gcc-4.3.3+cs_uClibc-0.9.30.1/staging_dir/toolchain-mips_r2_gcc-4.3.3+cs_uClibc-0.9.30.1/usr/bin/../lib/gcc/mips-openwrt-linux-uclibc/4.3.3/../../../../mips-openwrt-linux-uclibc/lib/libmysqlclient.so when searching for -lmysqlclient
/home/dawood/openwrt_9Jan2011/backfire/build_dir/target-mips_r2_uClibc-0.9.30.1/OpenWrt-SDK-ar71xx-for-Linux-i686-gcc-4.3.3+cs_uClibc-0.9.30.1/staging_dir/toolchain-mips_r2_gcc-4.3.3+cs_uClibc-0.9.30.1/usr/bin/../lib/gcc/mips-openwrt-linux-uclibc/4.3.3/../../../../mips-openwrt-linux-uclibc/bin/ld: cannot find -lmysqlclient
collect2: ld returned 1 exit status
make[4]: *** [cc1] Error 1
make[4]: Leaving directory `/home/dawood/openwrt_9Jan2011/backfire/build_dir/target-mips_r2_uClibc-0.9.30.1/OpenWrt-SDK-ar71xx-for-Linux-i686-gcc-4.3.3+cs_uClibc-0.9.30.1/build_dir/target-mips_r2_uClibc-0.9.30.1/ish'
make[3]: *** [/home/dawood/openwrt_9Jan2011/backfire/build_dir/target-mips_r2_uClibc-0.9.30.1/OpenWrt-SDK-ar71xx-for-Linux-i686-gcc-4.3.3+cs_uClibc-0.9.30.1/build_dir/target-mips_r2_uClibc-0.9.30.1/ish/.built] Error 2
make[3]: Leaving directory `/home/dawood/openwrt_9Jan2011/backfire/build_dir/target-mips_r2_uClibc-0.9.30.1/OpenWrt-SDK-ar71xx-for-Linux-i686-gcc-4.3.3+cs_uClibc-0.9.30.1/package/ish'
make[2]: *** [package/ish/compile] Error 2
make[2]: Leaving directory `/home/dawood/openwrt_9Jan2011/backfire/build_dir/target-mips_r2_uClibc-0.9.30.1/OpenWrt-SDK-ar71xx-for-Linux-i686-gcc-4.3.3+cs_uClibc-0.9.30.1'
make[1]: *** [/home/dawood/openwrt_9Jan2011/backfire/build_dir/target-mips_r2_uClibc-0.9.30.1/OpenWrt-SDK-ar71xx-for-Linux-i686-gcc-4.3.3+cs_uClibc-0.9.30.1/staging_dir/target-mips_r2_uClibc-0.9.30.1/stamp/.package_compile] Error 2
make[1]: Leaving directory `/home/dawood/openwrt_9Jan2011/backfire/build_dir/target-mips_r2_uClibc-0.9.30.1/OpenWrt-SDK-ar71xx-for-Linux-i686-gcc-4.3.3+cs_uClibc-0.9.30.1'
make: *** [world] Error 2
##########################################################################
It seems that gcc linker is not able to find mysqlclient libraries, but I made some soft links in lib directory of OpenWrt-SDK-..., but nothing changed!!!
If anyone has been encounter formerly with such kind of errors, please let me know your experience.
Thanks,

Regards,
Dawood

Dawood

Everytime I needed to cross compile with mysql It was a headache. The solution for me was to rebuild the mysql (and lot of time zlib also)Because sometime the library client are not the same version, or not the same level of build.
Download the full source of mysql, untar, unzip, blah blah and then configure

Then the trick is not to compile all the mysqlserver, just the library you need.
go then to zlib folder, then make
after go to libmysql then make

then copy the lib with the others and you sould be able to link.
If I remember correctly that is what I did.

Hope this help

(Last edited by Charly86 on 11 Jun 2012, 15:20)

Dear charly86
can you tell the steps with more detailed descripition

The discussion might have continued from here.