This is the mail archive of the crossgcc@sourceware.org mailing list for the crossgcc project.

See the CrossGCC FAQ for lots more information.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Cross Compiler question (the essence of a Canadian CrossCompiler)


Now this is weird .... I've tried hello world now with the compiler that
runs on the build machine to generate for the target and I'm getting messed
up const char * assignments.

The hello world is:

#include <stdio.h>

int main() {
    const char *foo = "armv5b-softfloat-linux-gnu";
    const char *foo1 = "armv5b-x-linux-gnu";
    fprintf(stderr,"foo =[%s]\n",foo);
    fprintf(stderr,"foo1=[%s]\n",foo1);
    }


And the output on the target machine is:

/opt/crosstool # ./a.out
foo =[armv5b-softfloat-linux-g]
foo1=[armv5b-x-linux-g]


The compile line is:

armv5b-softfloat-linux-gcc -DHAVE_CONFIG_H -I.
-I/home/jamwyatt/patton/crosstool-0.37/build/armv5b-softfloat-linux/gcc-3.4.
4-glibc-2.2.5/binutils-2.15/binutils -I. -D_GNU_SOURCE -I.
-I/home/jamwyatt/patton/crosstool-0.37/build/armv5b-softfloat-linux/gcc-3.4.
4-glibc-2.2.5/binutils-2.15/binutils -I../bfd
-I/home/jamwyatt/patton/crosstool-0.37/build/armv5b-softfloat-linux/gcc-3.4.
4-glibc-2.2.5/binutils-2.15/binutils/../bfd
-I/home/jamwyatt/patton/crosstool-0.37/build/armv5b-softfloat-linux/gcc-3.4.
4-glibc-2.2.5/binutils-2.15/binutils/../include
-I/home/jamwyatt/patton/crosstool-0.37/build/armv5b-softfloat-linux/gcc-3.4.
4-glibc-2.2.5/binutils-2.15/binutils/../intl -I../intl
-DLOCALEDIR="\"/opt/crosstool/native/gcc-3.4.4-glibc-2.2.5/armv5b-softfloat-
linux/share/locale\"" -Dbin_dummy_emulation=bin_vanilla_emulation   -W -Wall
-Wstrict-prototypes -Wmissing-prototypes -g -O2 hello.c --static

I've been trying to find out why none of the binutils commands will run (see
the bfd error below).

Does this error ring any bells? I noticed that the crosstool configu I've
grabbed doesn't use --disable-nls ... Could this be part of the issues?

R


On 8/5/05 5:43 AM, "J. Robert Wyatt" <jamwyatt@cisco.com> wrote:

> 
> 
> So, I have a little script that borrowed from Dan's link below that sets the
> variables ... Attached below. It is a healthy amount of Dan's code from his
> demo*.sh scripts an the variables that are needed for my choosen compiler
> package. As well, I found the two places in crosstool.sh where make all is
> called for final gcc and the binutils so that I can put LDFLAGS=--static on
> the make command line to generate static binaries.
> 
> The only problem left is bfd tools in binutils seem to be having a bad
> string day when I try to run them and get weird errors like:
> 
> /opt/crosstool # ./strings
> ./stri: can't set BFD default target to `armv5b-softfloat-linux-g': Invalid
> bfd targ
> 
> 
> As you can see, there is a lot wrong with this message ... It kinda makes me
> think the compiler's static init for strings was busted???
> 
> Robert
> 
> 
> #!/bin/sh
> 
> # For use building a cross compiler that runs on the same platform as
> # it generates code for. BUILD is the local machine, HOST = TARGET
> 
> 
> 
> set -ex
> TARBALLS_DIR=$HOME/downloads
> # RESULT_TOP=/opt/crosstool/native
> RESULT_TOP=/opt/crosstool/native
> export TARBALLS_DIR RESULT_TOP
> GCC_LANGUAGES="c,c++"
> export GCC_LANGUAGES
> 
> # Really, you should do the mkdir before running this,
> # and chown /opt/crosstool to yourself so you don't need to run as root.
> mkdir -p $RESULT_TOP
> 
> # Build the toolchain.  Takes a couple hours and a couple gigabytes.
> 
> # Path to find the tools mentioned below
> CRSNAME=armv5b-softfloat-linux
> PATH=/opt/crosstool/gcc-3.4.4-glibc-2.2.5/armv5b-softfloat-linux/bin:$PATH
> 
> export CC=${CRSNAME}-gcc
> export AR=${CRSNAME}-ar
> export CXX=${CRSNAME}-g++
> export LD=${CRSNAME}-ld
> export NM=${CRSNAME}-nm
> export AS=${CRSNAME}-as
> export RANIB=${CRSNAME}-ranlib
> 
> 
> # export AR_FOR_BUILD=ar
> # export CC_FOR_BUILD=gcc
> # export CXX_FOR_BUILD=g++
> 
> 
> # Statically linked executables only
> export LDFLAGS=--static
> 
> export GCC_HOST=${CRSNAME}
> 
> eval `cat armv5b-softfloat.dat gcc-3.4.4-glibc-2.2.5.dat` sh all.sh --notest
> # eval `cat armv5b-softfloat.dat gcc-3.3.6-glibc-2.3.5.dat` sh all.sh
> --notest
> 
> echo Done.
> 
> 
> 
> 
> On 8/4/05 11:40 AM, "Dan Kegel" <dank@kegel.com> wrote:
> 
>> J. Robert Wyatt wrote:
>>> The liberals, conservatives, and NDP were the party names when this term was
>>> likely coined ... Since I left, they renamed a few things ;-)
>>> 
>>> So, that being said, if I wanted to use crosstool for this second compiler,
>>> what is the "preferred" way to have crosstool do the work of generating the
>>> host=target compiler? Would that be setting an environment variable like
>>> "HOST" to be equal to the same as the target that was generated in the first
>>> build? As well, I guess that the "RESULT_TOP should be named different too
>>> to avoid overwritting the first build?
>> 
>> Well, most importantly, you have to set CC and friends to point to the
>> results
>> of the first crosstool run
>> before running crosstool for the second compiler;
>> otherwise the resulting compiler won't run on your host, right?
>> 
>> I've put a draft of an old script I used last
>> year to do canadian cross builds at
>> http://kegel.com/crosstool/canadian-foo.sh.txt
>> 
>> Have a look at the function setCanadianCrossVariables()
>> to see how I set variables when building the
>> final compiler.
>> 
>> Since you're not doing a full canadian cross, you might
>> not need quite all the foo that's in there, but
>> it might be a useful place to look to see which
>> environment variables need to be set.
>> - Dan
> 
> ------
> Want more information?  See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
> Want to unsubscribe? Send a note to crossgcc-unsubscribe@sources.redhat.com

------
Want more information?  See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sources.redhat.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]