cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Re: CrossCompiling libcurl for ARM/snapgear/Intel IXDP425

From: Michael Graf <calgarycomputertech_at_gmail.com>
Date: Mon, 2 Mar 2009 10:21:53 -0700

Hi

On Fri, Feb 27, 2009 at 8:57 PM, Michael Graf
<calgarycomputertech_at_gmail.com> wrote:
> Hi all, sorry if this is noob.
>
> I have an Astra RFID reader and I'm trying to compile the libcurl libraries
> for use on the device. It uses the arm-linux-gcc compiler, snapgear-3.0.0
> files and has a Intel IXDP425 chip in it. I'm not sure which of those
> details are relevant.
>
> I made a configure script similar to the one found in
> /curl-7.19.3/docs/INSTALL . The script is as follows:
> #! /bin/sh
>
>    export PATH=$PATH:/usr/local/bin
> # export CPPFLAGS="-I/opt/hardhat/
> devkit/ppc/405/target/usr/include"
>    export AR=arm-linux-ar
>    export AS=arm-linux-as
>    export LD=arm-linux-ld
>    export RANLIB=arm-linux-ranlib
>    export CC=arm-linux-gcc
>    export NM=arm-linux-nm

Do you need to set all of those? Normally it's sufficient to run
configure with the right --host option. As far as I understand it
--target is only for things like compilers/assemblers that output
binaries. Not things like curl/libcurl. --build should be guessed
correctly.

So try unsetting all of these (except PATH) and then calling configure
with only --host, --prefix and --exec-prefix.

>    ./configure --target=arm-linux \
>     --host=arm-linux-linux \

Are you sure "arm-linux-linux" is right? I would have thought just
"arm-linux" based on the names of the binaries in your toolchain.

>     --build=i586-pc-linux-gnu \
>     --prefix=/usr/local/arm-linux/lib-independent \
>     --exec-prefix=/usr/local/

So try this (after making sure you have UNset CC, AS, NM, etc., etc.):

./configure --host=arm-linux --prefix=... --exec-prefix=...

> When I run the script the configure has an error as follows:
> $ ./make4ARM.sh checking whether to enable maintainer-specific portions of
[...]
> checking for C compiler default output file name...
> configure: error: C compiler cannot create executables
> See `config.log' for more details.
>
>
> finally the config.log is appended to the end of this mail.
>
> Please let me know if more info is required or if you know how to deal with
> this.
> TIA,
> -Mike Graf
>
> [config.log]
[snip]
> configure:2471: checking for arm-linux-linux-ar
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> configure:2505: result: no
> configure:2515: checking for ar
> configure:2534: found /usr/bin/ar
> configure:2546: result: /usr/bin/ar
                  ^^^^^^^^^^^^^^^^^^

I think this is a symptom of your "arm-linux-linux" and may be the
cause of your problem.

> configure:2560: WARNING: In the future, Autoconf will not detect cross-tools
> whose name does not start with the host triplet.  If you think this
> configuration is useful to you, please write to autoconf_at_gnu.org.

I'm not sure if this warning is relevant, but I think they would
prefer something like "arm-unknown-linux" or "arm-unknown-linux-gnu"
instead of "arm-linux". You might find that there are binaries called
"arm-unknown-linux-gcc" etc. while the "arm-linux-gcc" etc. are just
symlinks to them.

[snip]
> configure:2937: checking for arm-linux-linux-strip
> configure:2967: result: no
> configure:2977: checking for strip
> configure:2993: found /usr/bin/strip
> configure:3004: result: strip
                  ^^^^^^^^^^^^^
> configure:3045: checking curl version
> configure:3047: result: 7.19.3
> configure:3084: checking build system type
> configure:3102: result: i586-pc-linux-gnu
> configure:3124: checking host system type
> configure:3139: result: arm-linux-linux-gnu
> configure:3179: checking for style of include used by make
> configure:3207: result: GNU
> configure:3243: checking for arm-linux-linux-gcc
> configure:3270: result: arm-linux-gcc
> configure:3548: checking for C compiler version
> configure:3555: arm-linux-gcc --version >&5
> arm-linux-gcc (GCC) 3.2.1
[snip]

I'm not sure why configure finds your gcc, but not ar and strip.

> configure:3600: checking for C compiler default output file name
> configure:3627: arm-linux-gcc    conftest.c  >&5
> /usr/local/arm-linux/lib/libc.so.6: could not read symbols: Invalid
> operation  <----- Note: This file exists and I have read permissions

I don't know what "Invalid operation" means in this context, but I
suspect this is as a result of the wrong binaries being used when
trying to compile this code.

> collect2: ld returned 1 exit status
> configure:3630: $? = 1
> configure:3668: result:
> configure: failed program was:
> | /* confdefs.h.  */
> | #define PACKAGE_NAME "curl"
> | #define PACKAGE_TARNAME "curl"
> | #define PACKAGE_VERSION "-"
> | #define PACKAGE_STRING "curl -"
> | #define PACKAGE_BUGREPORT "a suitable curl mailing list =>
> http://curl.haxx.se/mail/"
> | #define PACKAGE "curl"
> | #define VERSION "7.19.3"
> | #define OS "arm-linux-linux-gnu"
> | /* end confdefs.h.  */
> |
> | int main (void)
> | {
> |
> |  ;
> |  return 0;
> | }
> configure:3675: error: C compiler cannot create executables
> See `config.log' for more details.

Hi all,

I tried commenting out the exports ( AR,AS,LD, CC etc) and I was able
to get it to compile and install, however it seems to me that
compiling without using the compilers for the platform I want to end
up on means that we'll end up with libcurl libraries for my PC not for
the RFID reader.

Here is somemore info that may help get us to a solution:
when I compile a program using libcurl, I get the following error
many times :
 " File in wrong format: failed to merge target specific data of file
/usr/lib/libcurl.a(parsedate.o)
/usr/local/lib/gcc-lib/arm-linux/3.2.1/../../../../arm-linux/bin/ld:
/usr/lib/libcurl.a(tftp.o): compiled for a little endian system and
target is big endian "

here is the makefile I need to use for the RFID reader, it might be
modifiable to make the curl libraries?

[Makefile]
ifeq ($(PLATFORM), PC)

        PLATFORM_CODE := x86

        CC := gcc

        OBJDUMP := objdump

        STRIP=strip

        AR := ar

        CFLAGS += -DPC -g

else

        PLATFORM_CODE := arm

        TOOLCHAIN_BIN := /usr/local/bin

        CC := $(TOOLCHAIN_BIN)/arm-linux-gcc

        OBJDUMP := $(TOOLCHAIN_BIN)/arm-linux-objdump

        STRIP := $(TOOLCHAIN_BIN)/arm-linux-strip

        AR := $(TOOLCHAIN_BIN)/arm-linux-ar

        CFLAGS += -O2

        IXP425_FLAGS := -mcpu=strongarm -mbig-endian -mtune=xscale

        CFLAGS += $(IXP425_FLAGS)

        LDFLAGS += $(IXP425_FLAGS)

        ifndef LINUX_INC_DIR

# CFLAGS += -I/usr/local/snapgear/linux-2.4.x/include -I/usr/include/
                CFLAGS += -I/usr/local/snapgear/linux-2.4.x/include
-I/usr/local/arm-linux/lib-independent/include

        else

                CFLAGS += -I$(LINUX_INC_DIR) -I/usr/include/

        endif

endif

LIB=./lib/$(PLATFORM_CODE)-libm4api.a
CURLLIB=/usr/lib/libcurl.a

CFLAGS += -I../lib

#OTHER=-L/usr/local/lib -lcurl -lidn -lssl -lcrypto -lldap -lrt -lssl
-lcrypto -lz

all:firmware_update simple_gpio_input simple_gpio_output simple_search
detailed_search stop_searches conveyor_search detailed_synch_test
aggregator twiddle_gpio

postit:postit2.c $(LIB) $(CURLLIB)

        $(CC) $(CFLAGS) -o $@.Astra $^

clean:

        rm -f postit.Astra
        rm -f *.o
[/Makefile]

Thanks for any help, its muchly appreciated!
-Mike
Received on 2009-03-02