LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Laptop and Netbook (https://www.linuxquestions.org/questions/linux-laptop-and-netbook-25/)
-   -   cross compiling a shared library (https://www.linuxquestions.org/questions/linux-laptop-and-netbook-25/cross-compiling-a-shared-library-300233/)

baba_gorakhnath 03-10-2005 11:02 PM

cross compiling a shared library
 
hi,

i have to port a shared library to a linux 2.4.18 based handheld which goes by the name of SIMPUTER.Simputer is a ARM based hadheld and the SDK came with a cross-compilation toolchain which contains arm-linux-gcc, arm-linux-gcc.I have to change the MAKEFILE to create a shared library for the ARM.Here is the MAKEFILE:

CC=arm-linux-gcc
LIBTOOL := ../../libtool
INCLUDE := ../../include/lufs
CFLAGS := -O2 -I ${INCLUDE} -c -o
LDFLAGS := -rpath /usr/local/lib -version-info 2:0:0 D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -o

O_TARGET := liblufs-localfs.o

obj-y := localfs.o client.o fh.o sfs_clnt.o sfs_xdr.o dircache.o

obj-h := fh.h sfs.h sfsclnt.h list.h


${O_TARGET}: ${obj-y}
../../libtool --tag=CC --mode=link ${CC} ${LDFLAGS} liblufs-localfs.la localfs.lo client.lo fh.lo sfs_clnt.lo sfs_xdr.lo dircache.lo

localfs.o: localfs.c ${obj-h}
${LIBTOOL} --tag=CC --mode=compile ${CC} ${CFLAGS} localfs.o localfs.c


dircache.o: dircache.c ${obj-h}
.........................


THE object are created fine , but when libtool goes on to create the shared library it is invoking "gcc" and hence failing.
THE ERROR:

../../libtool --tag=CC --mode=link arm-linux-gcc -rpath /usr/local/lib -version-info 2:0:0 D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -o liblufs-localfs.la localfs.lo client.lo fh.lo sfs_clnt.lo sfs_xdr.lo dircache.lo
rm -fr .libs/liblufs-localfs.la .libs/liblufs-localfs.lai .libs/liblufs-localfs.so .libs/liblufs-localfs.so.2 .libs/liblufs-localfs.so.2.0.0
gcc -shared .libs/localfs.o .libs/client.o .libs/fh.o .libs/sfs_clnt.o .libs/sfs_xdr.o .libs/dircache.o -Wl,-soname -Wl,liblufs-localfs.so.2 -o .libs/liblufs-localfs.so.2.0.0
/usr/bin/ld: .libs/localfs.o: Relocations in generic ELF (EM: 40)
.libs/localfs.o: could not read symbols: File in wrong format
collect2: ld returned 1 exit status
make: *** [liblufs-localfs.o] Error 1

How do i tell libtool to use "arm-linux-gcc" as the compiler?

Rahul.


All times are GMT -5. The time now is 03:00 PM.