Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

cross compile with ./configure

1,590 views
Skip to first unread message

Atilla

unread,
Jun 2, 2009, 10:15:04 AM6/2/09
to
Dear c.o.l.embedded
I downloaded source of lrzsz and want to cross compile it. How do i make
gnu build system understand this?
./configure CROSS_COMPILE=arm-unknown-linux-gnu-
doesn't work.
Do i need to find a way to handle everything by hand? Source tree doesn't
seem complicated.

AZ Nomad

unread,
Jun 2, 2009, 12:48:50 PM6/2/09
to

did you try ./configure --help ?

f there was a CROSS_COMPILE option, it would be preceded with --, for example:
--host=HOST cross-compile to build programs to run on HOST [BUILD]


Typically you can use the following environmental variables
CC C compiler command
CFLAGS C compiler flags
LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a
nonstandard directory <lib dir>
LIBS libraries to pass to the linker, e.g. -l<library>
CPPFLAGS C/C++/Objective C preprocessor flags, e.g. -I<include dir> if
you have headers in a nonstandard directory <include dir>
CPP C preprocessor
CXX C++ compiler command
CXXFLAGS C++ compiler flags
CXXCPP C++ preprocessor

--host=HOST cross-compile to build programs to run on HOST [BUILD]

Michael Schnell

unread,
Jun 2, 2009, 5:21:22 PM6/2/09
to Atilla
did you install a toolchain for cross compiling (the appropriate gcc etc) ?

-Michael

Atilla

unread,
Jun 3, 2009, 5:23:28 AM6/3/09
to
On Tue, 02 Jun 2009 11:48:50 -0500, AZ Nomad wrote:


>
> Typically you can use the following environmental variables
> CC C compiler command
> CFLAGS C compiler flags
> LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a
> nonstandard directory <lib dir>
> LIBS libraries to pass to the linker, e.g. -l<library> CPPFLAGS
> C/C++/Objective C preprocessor flags, e.g. -I<include dir> if
> you have headers in a nonstandard directory <include dir>
> CPP C preprocessor
> CXX C++ compiler command
> CXXFLAGS C++ compiler flags
> CXXCPP C++ preprocessor
>
> --host=HOST cross-compile to build programs to run on HOST
> [BUILD]

$./configure CC=arm-unknown-linux-gnu-gcc
configure: warning: CC=arm-unknown-linux-gnu-gcc: invalid host type

$ CROSS_COMPILE=arm-unknown-linux-gnu-
$ ./configure --host=i686-linux --target=arm-linux
(script runs but make terminates with error)


$ CC=arm-unknown-linux-gnu-
$ ./configure

...
checking for gcc... (cached) gcc
checking whether the C compiler (gcc ) works... yes
checking whether the C compiler (gcc ) is a cross-compiler... no
...

So, each of these tries resulted in non working settings. My cross
toolchain is installed and in my PATH.

AZ Nomad

unread,
Jun 3, 2009, 9:24:42 AM6/3/09
to
On Wed, 3 Jun 2009 09:23:28 +0000 (UTC), Atilla <som...@somewhere.org> wrote:
>On Tue, 02 Jun 2009 11:48:50 -0500, AZ Nomad wrote:


>>
>> Typically you can use the following environmental variables
>> CC C compiler command
>> CFLAGS C compiler flags
>> LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a
>> nonstandard directory <lib dir>
>> LIBS libraries to pass to the linker, e.g. -l<library> CPPFLAGS
>> C/C++/Objective C preprocessor flags, e.g. -I<include dir> if
>> you have headers in a nonstandard directory <include dir>
>> CPP C preprocessor
>> CXX C++ compiler command
>> CXXFLAGS C++ compiler flags
>> CXXCPP C++ preprocessor
>>
>> --host=HOST cross-compile to build programs to run on HOST
>> [BUILD]
>$./configure CC=arm-unknown-linux-gnu-gcc
>configure: warning: CC=arm-unknown-linux-gnu-gcc: invalid host type

>$ CROSS_COMPILE=arm-unknown-linux-gnu-
>$ ./configure --host=i686-linux --target=arm-linux
>(script runs but make terminates with error)

You ought to post the error

>$ CC=arm-unknown-linux-gnu-
>$ ./configure

>...
>checking for gcc... (cached) gcc
>checking whether the C compiler (gcc ) works... yes
>checking whether the C compiler (gcc ) is a cross-compiler... no
>...

>So, each of these tries resulted in non working settings. My cross
>toolchain is installed and in my PATH.

It doesn't seem to work.

Configure is trying to tell you that your c compiler isn't capable
of cross compilation.

>checking whether the C compiler (gcc ) is a cross-compiler... no

Look into the configure script to see how it is performing it's
test.

Atilla

unread,
Jun 3, 2009, 10:02:33 AM6/3/09
to
On Wed, 03 Jun 2009 08:24:42 -0500, AZ Nomad wrote:

OK, I got it working. Instead of "apt-get source", I downloaded the
original source from freshmeat. Then issued:

$ CC=arm-unknown-linux-gnu-gcc ./configure --host=arm-unknown-linux-gnu

It configured and cross-compiled successfully.

Kristof Provost

unread,
Jun 3, 2009, 10:09:24 AM6/3/09
to
Try $ CC=arm-unknown-linux-gnu-gcc ./configure --host=arm-unknown-linux-gnu

Kristof

Phil Carmody

unread,
Jun 4, 2009, 3:51:45 AM6/4/09
to
Atilla <som...@somewhere.org> writes:
> $./configure CC=arm-unknown-linux-gnu-gcc
> configure: warning: CC=arm-unknown-linux-gnu-gcc: invalid host type
>
> $ CROSS_COMPILE=arm-unknown-linux-gnu-
> $ ./configure --host=i686-linux --target=arm-linux
> (script runs but make terminates with error)

That setting of a variable won't be seen by teh configure script.
Either export it as an environmental variable to be exported to
spawned processes, or include it in the ./configure line thus:

$ CROSS_COMPILE=arm-unknown-linux-gnu- ./configure --host=i686-linux --target=arm-linux

> $ CC=arm-unknown-linux-gnu-
> $ ./configure

Ditto. Look up 'export' in your bash manpage.

Phil
--
Marijuana is indeed a dangerous drug.
It causes governments to wage war against their own people.
-- Dave Seaman (sci.math, 19 Mar 2009)

0 new messages