OSDev.org

The Place to Start for Operating System Developers
It is currently Tue Apr 23, 2024 5:02 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 9 posts ] 
Author Message
 Post subject: Cross Compiler
PostPosted: Mon Mar 02, 2015 10:22 am 
Offline

Joined: Mon Mar 02, 2015 9:55 am
Posts: 4
Hello, I've been trying to build my own cross compiler (on xubuntu) but i'm getting an infintie series of errors... I tried everything: every tutorial on internet, automated script or pre-built packages, but nothing works... what can I do? thank in advance
PS he error I can't solve is that gcc doesn-t find zlib.h, even if it present in my system. it occures during the execution of "mak all-gcc"


Last edited by LoIulia on Mon Mar 02, 2015 10:51 am, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: Cross Compiler
PostPosted: Mon Mar 02, 2015 10:44 am 
Offline
Member
Member
User avatar

Joined: Wed Oct 18, 2006 3:45 am
Posts: 9301
Location: On the balcony, where I can actually keep 1½m distance
Here's the tutorial you should have tried: GCC Cross-Compiler. If that actually does give errors, you should post them along with the exact commands you used.

_________________
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]


Top
 Profile  
 
 Post subject: Re: Cross Compiler
PostPosted: Thu Mar 05, 2015 4:03 pm 
Offline

Joined: Mon Mar 02, 2015 9:55 am
Posts: 4
sorry, if I reply you so late, but I had a lot of problem, so I couldnt use my pc :( .
this is the first :( strange thing I have noticed during configuration:
Code:
checking for windres... no
checking for windmc... no
checking for objcopy... objcopy
checking for objdump... objdump
checking for readelf... readelf
checking for i686-elf-cc... no
checking for i686-elf-gcc... no
checking for i686-elf-c++... no
checking for i686-elf-g++... no
checking for i686-elf-cxx... no
checking for i686-elf-gxx... no
checking for i686-elf-gcc... no
checking for i686-elf-gcj... no
checking for i686-elf-gfortran... no
checking for i686-elf-gccgo... no
checking for ar... no
checking for i686-elf-ar... no
checking for as... no
checking for i686-elf-as... no
checking for dlltool... no
checking for i686-elf-dlltool... no
checking for ld... no
checking for i686-elf-ld... no
checking for lipo... no
checking for i686-elf-lipo... no
checking for nm... no
checking for i686-elf-nm... no
checking for objdump... no
checking for i686-elf-objdump... no
checking for ranlib... no
checking for i686-elf-ranlib... no
checking for readelf... no
checking for i686-elf-readelf... no
checking for strip... no
checking for i686-elf-strip... no
checking for windres... no
checking for i686-elf-windres... no
checking for windmc... no
checking for i686-elf-windmc... no

and, after some minute after I typed make all-gcc it stops with this text:
Code:
checking command to parse nm output from gcc  -m32 object... failed
checking how to run the C preprocessor... /lib/cpp
checking for ANSI C header files... no
checking for sys/types.h... no
checking for sys/stat.h... no
checking for stdlib.h... no
checking for string.h... no
checking for memory.h... no
checking for strings.h... no
checking for inttypes.h... no
checking for stdint.h... no
checking for unistd.h... no
checking for dlfcn.h... no
checking for objdir... .libs
checking if gcc  -m32 supports -fno-rtti -fno-exceptions... no
checking for gcc  -m32 option to produce PIC... -fPIC -DPIC
checking if gcc  -m32 PIC flag -fPIC -DPIC works... yes
checking if gcc  -m32 static flag -static works... no
checking if gcc  -m32 supports -c -o file.o... yes
checking if gcc  -m32 supports -c -o file.o... (cached) yes
checking whether the gcc  -m32 linker (ld -m elf_x86_64 -m elf_i386) supports shared libraries... yes
checking whether -lc should be explicitly linked in... nochecking command to parse nm output from gcc  -m32 object... failed
checking how to run the C preprocessor... /lib/cpp
checking for ANSI C header files... no
checking for sys/types.h... no
checking for sys/stat.h... no
checking for stdlib.h... no
checking for string.h... no
checking for memory.h... no
checking for strings.h... no
checking for inttypes.h... no
checking for stdint.h... no
checking for unistd.h... no
checking for dlfcn.h... no
checking for objdir... .libs
checking if gcc  -m32 supports -fno-rtti -fno-exceptions... no
checking for gcc  -m32 option to produce PIC... -fPIC -DPIC
checking if gcc  -m32 PIC flag -fPIC -DPIC works... yes
checking if gcc  -m32 static flag -static works... no
checking if gcc  -m32 supports -c -o file.o... yes
checking if gcc  -m32 supports -c -o file.o... (cached) yes
checking whether the gcc  -m32 linker (ld -m elf_x86_64 -m elf_i386) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... configure: error: Link tests are not allowed after GCC_NO_EXECUTABLES.
Makefile:9745: recipe for target 'configure-zlib' failed
make: *** [configure-zlib] Error 1

I think the error could be related to this fantomatic m32... I googled it but I didn-t find nothing.
thanks in advance


Top
 Profile  
 
 Post subject: Re: Cross Compiler
PostPosted: Thu Mar 05, 2015 6:44 pm 
Offline
Member
Member

Joined: Wed Jan 11, 2012 6:10 pm
Posts: 193
Looks to me like you weren't following directions and skipped the part where you add '$PREFIX/bin' to your PATH before compiling.


Top
 Profile  
 
 Post subject: Re: Cross Compiler
PostPosted: Fri Mar 06, 2015 1:15 am 
Offline
Member
Member
User avatar

Joined: Sat Mar 31, 2012 3:07 am
Posts: 4594
Location: Chichester, UK
As Combuster says, you need to post the exact commands that you use; otherwise the logs are useless. Also, more details of your host environment would help: version of Ubuntu, versions of gcc and bin utils, is your host 64-bit and, if so, do you have the 32-bit compatibility libraries installed.

More information please!


Top
 Profile  
 
 Post subject: Re: Cross Compiler
PostPosted: Fri Mar 06, 2015 9:42 am 
Offline

Joined: Mon Mar 02, 2015 9:55 am
Posts: 4
I'm running xubuntu 14.04 64 bit my gcc version is 4.9.1 and I-m trying to build the same version with binutils 2.24, in folder $HOME/src/gcc. about 32 bit libraries, I don't now how to check if they're installed. can you tell me how to do_
I did what the tutorial said; I typed:
Code:
export PREFIX="$HOME/opt/cross"
export TARGET=i686-elf
export PATH="$PREFIX/bin:$PATH"

than:
Code:
mkdir build-gcc
cd build-gcc
../configure --target=$TARGET --prefix="$PREFIX" --disable-nls --enable-languages=c,c++ --without-headers --enable-multilib
make all-gcc


Top
 Profile  
 
 Post subject: Re: Cross Compiler
PostPosted: Fri Mar 06, 2015 9:54 am 
Offline
Member
Member
User avatar

Joined: Sat Mar 31, 2012 3:07 am
Posts: 4594
Location: Chichester, UK
OK. So you are trying to build a 32-bit compiler. Can we assume that you have already built the corresponding binutils? The question about 32-bit libraries is probably a red herring, so you can ignore that for now. Originally you had a problem with zlib; it may be that you need to install zlib-devel (no idea if that's what it's called on Ubuntu, but there should be some package like that).

Also, I'm not sure that the "--enable-multilib" switch is correct; where did that come from?


Top
 Profile  
 
 Post subject: Re: Cross Compiler
PostPosted: Fri Mar 06, 2015 1:10 pm 
Offline

Joined: Mon Mar 02, 2015 9:55 am
Posts: 4
zlib is correctly updated to the last version, I tried to update every related package (zlib-bin, zlib1g, zlib1g-dev, zlibc)
--enable-multilib flag should be on by default, but during configuration it told me that there was a problem and that this flag were probabily disabled.
Do you have any idea?


Top
 Profile  
 
 Post subject: Re: Cross Compiler
PostPosted: Fri Mar 06, 2015 3:25 pm 
Offline
Member
Member

Joined: Mon Apr 09, 2007 12:10 pm
Posts: 775
Location: London, UK
1) You should probably build in a location completely outside the gcc source tree e.g. ~/src/build-gcc where the source is in ~/src/gcc-4.x.x (rather than a subdirectory of the source tree).

2) Can we assume that the cross binutils is correctly built and works (i.e. you can execute i686-elf-ld from any directory and it works as expected)?

3) You need all the appropriate dependencies (for ubuntu: apt-get install libgmp3-dev libmpfr-dev libisl-dev libcloog-isl-dev libmpc-dev texinfo)

4) If the above are all resolved, you should delete the source and build directories, re-extract the source and compile again with the exact commands as per the wiki page.

Regards,
John.

_________________
Tysos | rpi-boot


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 9 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 52 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group