← Back to team overview

maria-developers team mailing list archive

Re: crosscompiling in buildroot: cannot find -laio and other link error

 

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi

I don't have a solution to these problems yet, but a workaround for #1
and a dirty hack for #2. While these aren't satisfactory, I thought
I'd share as they might trigger some ideas for a proper fix.

On 25/09/2015 16:36, Sylvain Raybaud wrote:
> 1: Linking CXX shared module ha_connect.so 
> /home/sylvain/git/br/output/host/usr/arm-buildroot-linux-uclibcgnueabi
/sysroot/usr/lib/libxml2.so:
>
> 
error adding symbols: File in wrong format
> 
> --> for host variant ha_connect.so should be linked against 
> /home/sylvain/git/br/output/host/usr/lib/libxml2.so

I passed -DCONNECT_WITH_LIBXML2=0 to cmake

> 
> 2: Linking CXX shared module ha_innodb.so /usr/bin/ld: cannot find
> -laio
> 
> 

I applied the following patch to toplevel CMakeLists.txt;

- --- a/CMakeLists.txt.orig	2015-09-30 14:02:36.018951019 +0200
+++ b/CMakeLists.txt	2015-09-30 14:05:36.690950130 +0200
@@ -40,6 +40,10 @@

 SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/cmake)

+# Linker fails to find libraries in $(HOST_DIR)/usr/lib. Add this path
+# explicitely:
+link_directories(${EXPLICIT_LINK_DIR})
+
 # Distinguish between community and non-community builds, with the
 # default being a community build. This does not impact the feature
 # set that will be compiled in; it's merely provided as a hint to

and passed -DEXPLICIT_LINK_DIR=$(HOST_DIR)/usr/lib to cmake

Now -L$(HOST_DIR)/usr/lib is present in link commands and the build
goes smoothly.

I think the build rules could be improved in a better way but right
now I don't know how.

Cheers,

Sylvain

> The thing is, libaio and libxml2 are both present in 
> /home/sylvain/git/br/output/host/usr/lib/.
> 
> The link command present in 
> storage/connect/CMakeFiles/connect.dir/link.txt 
> (http://pastebin.com/Qn1ZCw2X) contains: 
> /home/sylvain/git/br/output/host/usr/arm-buildroot-linux-uclibcgnueabi
/sysroot/usr/lib/libxml2.so
>
> 
which is incorrect, should be:
> /home/sylvain/git/br/output/host/usr/lib/libxml2.so
> 
> The link command present in 
> storage/innobase/CMakeFiles/innobase.dir/link.txt 
> (http://pastebin.com/it6W9WVs) does not contain 
> -L/home/sylvain/git/br/output/host/usr/lib/. I think it should. At 
> least, when I manually run this command adding 
> -L/home/sylvain/git/br/output/host/usr/lib, it works.
> 
> I'm really not sure how these link.txt are generated. I checked 
> connect/CMakeLists.txt and innobase/CMakeLists.txt and could not
> find anything obvious problem. Beside, toplevel CMakeCache.txt does
> contain: 
> CMAKE_EXE_LINKER_FLAGS:STRING=-L/home/sylvain/git/br/output/host/lib
>
> 
- -L/home/sylvain/git/br/output/host/usr/lib
> -Wl,-rpath,/home/sylvain/git/br/output/host/usr/lib which seems
> correct. I don't know why this setting does not reach 
> storage/innobase and I'm also not sure why ha_connect.so tries to
> link against target variant of libxml2.
> 
> It basically comes down to have cmake look for shared libraries in
> the right place, but I don't seem to be able to determine which
> lever to pull. Any hint as to how to achieve that is therefore
> welcome.
> 
> Cheers,
> 

- -- 
Sylvain Raybaud
www.green-communications.fr
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.22 (GNU/Linux)

iQIcBAEBAgAGBQJWC/xcAAoJEEkkwl4JtJ9yvnYP/0Yk3AEZRtMurmPJ9fAX3JnR
lybMrZ5bsBks7GrTA5fP4FNoa4bh+EZgkdjx3VE9aNu1yejHQOLuZYAl0iryJKHZ
2xMr98GbohUZafS3nP2oPaRKi3DdSeUdC/7IcubGOkH7RkaoK2SLKyi6m32l/jz7
LRuwCcmM3TeiRi7YjjZ2sxykc/AAu4ePewU4KHrqwGypokTvroSWTOw3yGgvbpHD
TBPWLAGE5fqtaY4gfCOzq6grD/pdhOiI1NYMA8JyEvQV+CkZh2D1wV9J2XYDxBzP
nAdZfNc5NJWBQAuYLJPlK+IhAyQTUytgF+zCbkm2IwyGlbtyYxGjgQId21A9MfDW
AmJ9cfHuGGkYsX1leqg4FJjDWVuMspVawLxQrUabBLtu8djE6cK5jdLWfT6l+2v3
Gi0rAqG2BTfLMfwBKU5PFEfPTjd5Gve+p0YYI646w5BAExv7pQfodzjuuePvW3Nd
hU03LVzSlaT68emcMCdByMegZ21dPgAcnSNtOQuBNOthIY7p7x0d8H7V20zNRg+G
mqozzQgo+1GTcPELTcoGmsOZYbJRhn27l8GcjdV1b3MiQehHJoEyEsPNw+w2KDbj
41eh8eFbSaAjSCuNK4rreZrt1mjJpUiWxke+VHppc6vyiDIkpGiyI6/SLs6R/GWL
4K4zLlNrcIIDgiVeQ1it
=10zE
-----END PGP SIGNATURE-----


References