cross-compile toolchain not recognized

I have installed a pre-built kernel and toolchain on my host system for cross-development. When I download existing source packages and try to cross-build for my target, the native toolchain is invoked.

My cross-toolchain is working, as I have rebuilt the target kernel thru its own makefile, and compiled individual files by directly invoking the cross version of gcc. What does not work is when I try to use a configure script or makefile that did not come with the target distro. It always finds the native tools regardless of where the source files are placed.

For instance, I downloaded the source package setserial which has a configure script. Running ./configure always creates a makefile for the native tools. Is it normal to have to edit the configure script or makefile for cross-compiling?

Reply to
tns1
Loading thread data ...

Try presetting the environment variable CC with the name of your cross compiler. You may also want to do some reading in "info autoconf", there are also some notes about cross compiling.

Alternatively, a prebuilt toolchain with target binary packages like the one found at

formatting link
might be helpful. I suggest that the time you have spent on this already could've afforded you it ;-)

Regards, Marius.

-- Marius Groeger SYSGO Real-Time Solutions GmbH

formatting link
Software Engineering Embedded and Real-Time Software
formatting link
mgroeger @ sysgo de Germany
formatting link

Reply to
Marius Groeger

-- So, there exists something that repeatedly prevents your files being found -- something that tells a script where to go.

Reply to
VictorVS

Sure, when I just want to call the compiler I can do "i586-linux-gcc myfile". The problem is all the utils have the "i586-linux-" prefix on them, so when I want to make, it is going to call the linker too, and who knows what else. There is also the problem of using the target libraries, and not the native ones.

There seem to be a few different configurations in the distributed packages. Some have everything in the makefile - 'make config','make dep','make','make install',etc. Others use an autoconf generated configure script which generates the makefile. In this case, everything has to be handled in configure. Configure has some options that can be passed to it like --host, --build, --prefix, but so far I have not figured out how to make them work for my situation.

I look at config.log, and expect to see CC (i586-linux-gcc), but it always shows CC( gcc).

This is pretty much what I have already, but there are certain packages that do not come with the distro, and need to be recompiled on the host. If I had room on the target for all the tools, I would be simple.

Reply to
tns1

You have to override CC, LD, AS, ... and all the other things the program uses before you run configure.

Not usually a problem, since gcc has compiled-in paths to the right target libraries.

Here's an example of how to build libnet-1.1:

TARGET=powerpc-unknown-linux-gnu CROSS_TOOL=${TARGET}- CC=${CROSS_TOOL}gcc AR=${CROSS_TOOL}ar RANLIB=${CROSS_TOOL}ranlib CFLAGS="$TARGET_CFLAGS" ac_libnet_have_packet_socket=yes ./configure --prefix=/

--host=$TARGET --build=pentium-unknown-linux --with-pf_packet=yes make

For programs, you might need to set --target instead of --host, I'm not sure.

- Dan

Reply to
Dan Kegel

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.