autoconf
[Top][All Lists]
Advanced

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

Re: ARM Cross Compilation Problem with Shared Libraries


From: Ralf Wildenhues
Subject: Re: ARM Cross Compilation Problem with Shared Libraries
Date: Wed, 14 Sep 2005 15:21:57 +0200
User-agent: Mutt/1.4.1i

Hi Andrés,

* Andrés Moré wrote on Wed, Sep 14, 2005 at 02:19:58PM CEST:
> 
> I'm using autoconf/automake/libtool to manage a command line tool that
> has a shared library and a linux kernel module.

This is most likely a Libtool problem, and would as such fit better on
the Libtool mailing list.  But it's not easy to know before.  :)

> In order to install the module, I have to use DATA definitions and a
> separate Makefile.  Anyway, my main problem its that a need to cross
> compile this tool to ARM, and I have troubles when linking the shared
> objects.

> ./configure CFLAGS="-mbig-endian -txscale"--host=arm-wrs-linux-gnueabi 

(I assume the missing space before `--host' is a typo in the mail rather
than in your setup.)
 
> And the library Makefile.am is:
> 
> lib_LTLIBRARIES = libxld_lib.la
> libxld_lib_la_SOURCES = xld_lib.c
> 
> So, after configuring, when I type "make":
> 
> arm-linux-gnueabi-gcc -shared  .libs/xld_lib.o   -mbig-endian
> -Wl,-soname -Wl,libxld_lib.so.0 -o .libs/libxld_lib.so.0.0.0
> /home/linux/toolchain/xscale_be/bin/../lib/gcc/arm-linux-gnueabi/3.4.4/../../../../arm-linux-gnueabi/lib/libgcc_s.so:
> could not read symbols: File in wrong format

Libtool removes some flags from the link line it doesn't understand
(to some extent, it has to).  You are using a recent Libtool version, by
the way (1.5.20 is current)?

You may be able to work around this by using
  LDFLAGS=-Wl,-txscale
either during the configure or the make step.

Please also note that you configured with
  --host=arm-wrs-linux-gnueabi
but you should be using
  --host=arm-linux-gnueabi
according to the name of the cross-compiler:

> I'm able of compiling successfully without autoconf:
> 
> arm-linux-gnueabi-gcc -mbig-endian -txscale -Wall -O -ggdb -c xld_lib.c
> arm-linux-gnueabi-gcc -mbig-endian -txscale -fPIC -shared xld_lib.o -o
> libxld_lib.so

You should be adding `-fPIC' during compilation rather than during
linking.

> So, I think that maybe the tool is missing some flags (-m flag) at
> link time when cross compiling shared objects.

Well, I can only see the -txflags missing.  Maybe it needs -fPIC as well
during linking (that would really surprise me, though, I only know
non-GCC compilers that need this)?

I guess we should add all of
-t4, -t4be, -t4t, -t4tbe, -t5, -t5be, -t5t, -t5tbe, -txscale, -txscalebe
to the list of allowed flags for linking, to libtool?  Can somebody
confirm this?

> The workaround that I have at the moment is using static libraries
> instead of shared libraries, but I think its not _elegant_.

Nope, I agree.  :)

Cheers,
Ralf




reply via email to

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