libtool
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Issue with libtool when cross-compiling


From: Thomas Petazzoni
Subject: Issue with libtool when cross-compiling
Date: Fri, 12 Feb 2010 16:34:02 +0100

Hello,

I'm a contributor to the Buildroot project (http://www.buildroot.org),
a build system for embedded Linux systems. We integrate many packages
in order to ease their cross-compilation.

I'm facing an issue with several packages where libtool wants to link
against libraries of the host (in /usr/lib), and I don't know what
is happening. It is very likely a problem in the environment variables
or the options we pass to the configure script, but I'm unable to find
where the problem is, and thought that libtool experts might have an
idea on what's going on.

Note that I'm building for ARM with the CodeSourcery toolchain. I'm
building in a Debian stable chroot, with a very minimal set of packages
installed (libtool is not installed on the host, for example).

The example I've taken is the cross-compilation of libglib 2.22.4. It
fails at the install step with the following error message :

make[7]: Leaving directory `/home/test/brtest-ext/build/libglib2-2.22.4/gmodule'
libtool: install: warning: relinking `libgmodule-2.0.la'
libtool: install: (cd /home/test/brtest-ext/build/libglib2-2.22.4/gmodule; 
/bin/sh /home/test/brtest-ext/build/libglib2-2.22.4/libtool  --tag CC 
--mode=relink /home/test/arm-2009q3//bin/arm-none-linux-gnueabi-gcc -Os -pipe 
-Os -mabi=aapcs-linux -msoft-float -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE 
-D_FILE_OFFSET_BITS=64 --sysroot /home/test/brtest-ext/staging/ -Os -pipe -Os 
-mabi=aapcs-linux -msoft-float -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE 
-D_FILE_OFFSET_BITS=64 --sysroot /home/test/brtest-ext/staging/ -Wall 
-Wl,--export-dynamic -version-info 2200:4:2200 -export-dynamic --sysroot 
/home/test/brtest-ext/staging/ -o libgmodule-2.0.la -rpath /usr/lib gmodule.lo 
-ldl ../glib/libglib-2.0.la -lintl -inst-prefix-dir 
/home/test/brtest-ext/target)
libtool: relink: /home/test/arm-2009q3//bin/arm-none-linux-gnueabi-gcc -Os 
-pipe -Os  -mabi=aapcs-linux -msoft-float -D_LARGEFILE_SOURCE 
-D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 --sysroot 
/home/test/brtest-ext/staging/ -shared  .libs/gmodule.o   -Wl,-rpath 
-Wl,/home/test/brtest-ext/staging/usr/lib -ldl 
-L/home/test/brtest-ext/target/usr/lib -L/usr/lib -lglib-2.0 
-L/home/test/brtest-ext/staging/usr/lib 
-L/home/test/brtest-ext/target/home/test/brtest-ext/staging/usr/lib -lintl -lc  
-mabi=aapcs-linux -msoft-float -mabi=aapcs-linux -msoft-float 
-Wl,--export-dynamic   -Wl,-soname -Wl,libgmodule-2.0.so.0 -o 
.libs/libgmodule-2.0.so.0.2200.4
/home/test/arm-2009q3/bin/../lib/gcc/arm-none-linux-gnueabi/4.4.1/../../../../arm-none-linux-gnueabi/bin/ld:
 warning: library search path "/usr/lib" is unsafe for cross-compilation
/usr/lib/libdl.so: file not recognized: File format not recognized
collect2: ld returned 1 exit status
libtool: install: error: relink `libgmodule-2.0.la' with the above command 
before installing it
make[6]: *** [install-libLTLIBRARIES] Error 1

So it fails because -L/usr/lib was passed to the linker. However, I
haven't passed -L/usr/lib to the configure script. See the ./configure
line below (split on several lines for readability)

PATH="/home/test/brtest-ext/host/bin:/home/test/brtest-ext/host/usr/bin:/home/test/brtest-ext/host/usr/sbin/:/home/test/brtest-ext/toolchain/bin:/home/test/arm-2009q3//bin:/usr/local/bin:/usr/bin:/bin:/usr/games"
AR="/home/test/arm-2009q3//bin/arm-none-linux-gnueabi-ar"
AS="/home/test/arm-2009q3//bin/arm-none-linux-gnueabi-as"
LD="/home/test/arm-2009q3//bin/arm-none-linux-gnueabi-ld"
NM="/home/test/arm-2009q3//bin/arm-none-linux-gnueabi-nm"
CC="/home/test/arm-2009q3//bin/arm-none-linux-gnueabi-gcc -Os -pipe -Os  
-mabi=aapcs-linux -msoft-float -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE 
-D_FILE_OFFSET_BITS=64 --sysroot /home/test/brtest-ext/staging/"
GCC="/home/test/arm-2009q3//bin/arm-none-linux-gnueabi-gcc -Os -pipe -Os  
-mabi=aapcs-linux -msoft-float -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE 
-D_FILE_OFFSET_BITS=64 --sysroot /home/test/brtest-ext/staging/"
CPP="/home/test/arm-2009q3//bin/arm-none-linux-gnueabi-cpp -Os -pipe -Os  
-mabi=aapcs-linux -msoft-float -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE 
-D_FILE_OFFSET_BITS=64 --sysroot /home/test/brtest-ext/staging/"
CXX="/home/test/arm-2009q3//bin/arm-none-linux-gnueabi-g++ -Os -pipe -Os  
-mabi=aapcs-linux -msoft-float -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE 
-D_FILE_OFFSET_BITS=64 --sysroot /home/test/brtest-ext/staging/"
FC="/home/test/arm-2009q3//bin/arm-none-linux-gnueabi-gfortran "
RANLIB="/home/test/arm-2009q3//bin/arm-none-linux-gnueabi-ranlib"
STRIP="/home/test/arm-2009q3//bin/arm-none-linux-gnueabi-strip"
OBJCOPY="/home/test/arm-2009q3//bin/arm-none-linux-gnueabi-objcopy"
AR_FOR_BUILD="/usr/bin/ar"
AS_FOR_BUILD="/usr/bin/as"
CC_FOR_BUILD="/usr/bin/gcc"
GCC_FOR_BUILD="/usr/bin/gcc"
CXX_FOR_BUILD="/usr/bin/g++"
FC_FOR_BUILD="/usr/bin/ld"
LD_FOR_BUILD="/usr/bin/ld"
CFLAGS_FOR_BUILD="-I/home/test/brtest-ext/host/include 
-I/home/test/brtest-ext/host/usr/include"
CXXFLAGS_FOR_BUILD="-I/home/test/brtest-ext/host/include 
-I/home/test/brtest-ext/host/usr/include"
LDFLAGS_FOR_BUILD="-L/home/test/brtest-ext/host/lib 
-L/home/test/brtest-ext/host/usr/lib"
FCFLAGS_FOR_BUILD=""
AR_FOR_TARGET="/home/test/arm-2009q3//bin/arm-none-linux-gnueabi-ar"
AS_FOR_TARGET="/home/test/arm-2009q3//bin/arm-none-linux-gnueabi-as"
CC_FOR_TARGET="/home/test/arm-2009q3//bin/arm-none-linux-gnueabi-gcc"
LD_FOR_TARGET="/home/test/arm-2009q3//bin/arm-none-linux-gnueabi-ld"
NM_FOR_TARGET="/home/test/arm-2009q3//bin/arm-none-linux-gnueabi-nm"
DEFAULT_ASSEMBLER="/home/test/arm-2009q3//bin/arm-none-linux-gnueabi-as"
DEFAULT_LINKER="/home/test/arm-2009q3//bin/arm-none-linux-gnueabi-ld"
PKG_CONFIG_SYSROOT_DIR="/home/test/brtest-ext/staging"
PKG_CONFIG="/home/test/brtest-ext/host/usr/bin/pkg-config"
PKG_CONFIG_PATH="/home/test/brtest-ext/staging/usr/lib/pkgconfig:"
STAGING_DIR="/home/test/brtest-ext/staging"
CXX=false
ac_cv_lbl_unaligned_fail=yes
ac_cv_func_mmap_fixed_mapped=yes
ac_cv_func_memcmp_working=yes
ac_cv_have_decl_malloc=yes
gl_cv_func_malloc_0_nonnull=yes
ac_cv_func_malloc_0_nonnull=yes
ac_cv_func_calloc_0_nonnull=yes
ac_cv_func_realloc_0_nonnull=yes
ac_cv_c_bigendian=no
CFLAGS="-Os -pipe -Os -mabi=aapcs-linux -msoft-float -D_LARGEFILE_SOURCE 
-D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 --sysroot 
/home/test/brtest-ext/staging/"
CXXFLAGS="-Os -pipe -Os -mabi=aapcs-linux -msoft-float -D_LARGEFILE_SOURCE 
-D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 --sysroot 
/home/test/brtest-ext/staging/"
LDFLAGS="--sysroot /home/test/brtest-ext/staging/"
FCFLAGS=""
ac_cv_func_posix_getpwuid_r=yes
glib_cv_stack_grows=no
glib_cv_uscore=no
ac_cv_func_strtod=yes
ac_fsusage_space=yes
fu_cv_sys_stat_statfs2_bsize=yes
ac_cv_func_closedir_void=no
ac_cv_func_getloadavg=no
ac_cv_lib_util_getloadavg=no
ac_cv_lib_getloadavg_getloadavg=no
ac_cv_func_getgroups=yes
ac_cv_func_getgroups_works=yes
ac_cv_func_chown_works=yes
ac_cv_have_decl_euidaccess=no
ac_cv_func_euidaccess=no
ac_cv_have_decl_strnlen=yes
ac_cv_func_strnlen_working=yes
ac_cv_func_lstat_dereferences_slashed_symlink=yes
ac_cv_func_lstat_empty_string_bug=no
ac_cv_func_stat_empty_string_bug=no
vb_cv_func_rename_trailing_slash_bug=no
ac_cv_have_decl_nanosleep=yes
jm_cv_func_nanosleep_works=yes
gl_cv_func_working_utimes=yes
ac_cv_func_utime_null=yes
ac_cv_have_decl_strerror_r=yes
ac_cv_func_strerror_r_char_p=no
jm_cv_func_svid_putenv=yes
ac_cv_func_getcwd_null=yes
ac_cv_func_getdelim=yes
ac_cv_func_mkstemp=yes
utils_cv_func_mkstemp_limitations=no
utils_cv_func_mkdir_trailing_slash_bug=no
jm_cv_func_gettimeofday_clobber=no
gl_cv_func_working_readdir=yes
jm_ac_cv_func_link_follows_symlink=no
utils_cv_localtime_cache=no
ac_cv_struct_st_mtim_nsec=no
gl_cv_func_tzset_clobber=no
gl_cv_func_getcwd_null=yes
gl_cv_func_getcwd_path_max=yes
ac_cv_func_fnmatch_gnu=yes
am_getline_needs_run_time_check=no
am_cv_func_working_getline=yes
gl_cv_func_mkdir_trailing_slash_bug=no
gl_cv_func_mkstemp_limitations=no
ac_cv_func_working_mktime=yes
jm_cv_func_working_re_compile_pattern=yes
ac_use_included_regex=no
gl_cv_c_restrict=no
ac_cv_path_GLIB_GENMARSHAL=/home/test/brtest-ext/host/usr/bin/glib-genmarshal
ac_cv_prog_F77=no
ac_cv_func_posix_getgrgid_r=no
gt_cv_c_wchar_t=yes
./configure
--target=arm-none-linux-gnueabi
--host=arm-none-linux-gnueabi
--build=x86_64-pc-linux-gnu
--prefix=/usr
--exec-prefix=/usr
--sysconfdir=/etc
--disable-gtk-doc
--enable-shared
--enable-static

I've extracted the libglib build log at
  http://free-electrons.com/~thomas/buildroot/libglib-build.log

The upstream tarball is available at
  http://ftp.gnome.org/pub/gnome/sources/glib/2.22/glib-2.22.4.tar.bz2

Do you have an idea of what's going on ?

Thank you very much,

Thomas Petazzoni
-- 
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com




reply via email to

[Prev in Thread] Current Thread [Next in Thread]