GCC and LD problem

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
supagu
Member
Member
Posts: 46
Joined: Sat Apr 07, 2007 1:24 am

Post by supagu »

okay i removed all underscore prefixes, this fixed a few problems, i also had to change nasm to use elf instead of coff, this fixed the rest
INF1n1t
Member
Member
Posts: 60
Joined: Fri Dec 22, 2006 5:32 pm
Location: Somewhere Down...

Post by INF1n1t »

Yes, I also had several problems (ld couldn't find kernel_main). I thought as they said on the tutorials, but when I looked at the KERNEL.O file, which gcc had produced, I saw that gcc did not put any underscores at all. So I learned my lesson!

But dude, check it out: ld give me something very funny. I have defined a symbol in the linkerscript, called phys. And when I try to use it, ld says that phys is not defined! It's very strange. What do you think about that?

And the last thing, the toolchain didn't worked, but the cross-compiler tutorial on the wiki works very well!
I think, I have problems with Bochs. The biggest one: Bochs hates me!
supagu
Member
Member
Posts: 46
Joined: Sat Apr 07, 2007 1:24 am

Post by supagu »

yeah i followed that tut, had some troubles with it, but managed to get it to work.

How ever i want to be able to compile c++ as well, which the wiki didnt cover enough.
I've downloaded the g++ tar file from the site (http://ftp.gnu.org/gnu/gcc/gcc-4.0.2/) extracted it over the top of the extracted core files.

Now i try to run "make all-gcc" which fails with the following:

checking build system type... i686-pc-cygwin
checking host system type... i686-pc-cygwin
checking target system type... Invalid configuration `i585-elf': machine `i585'
not recognized
configure: error: /bin/sh ../../gcc-4.0.2/gcc/../config.sub i585-elf failed
make: *** [configure-gcc] Error 1

so once again im stuck
ehird
Member
Member
Posts: 214
Joined: Thu Mar 15, 2007 8:48 am

Post by ehird »

i586 not i585
INF1n1t
Member
Member
Posts: 60
Joined: Fri Dec 22, 2006 5:32 pm
Location: Somewhere Down...

Post by INF1n1t »

supagu wrote:yeah i followed that tut, had some troubles with it, but managed to get it to work.

How ever i want to be able to compile c++ as well, which the wiki didnt cover enough.
I've downloaded the g++ tar file from the site (http://ftp.gnu.org/gnu/gcc/gcc-4.0.2/) extracted it over the top of the extracted core files.

Now i try to run "make all-gcc" which fails with the following:

checking build system type... i686-pc-cygwin
checking host system type... i686-pc-cygwin
checking target system type... Invalid configuration `i585-elf': machine `i585'
not recognized
configure: error: /bin/sh ../../gcc-4.0.2/gcc/../config.sub i585-elf failed
make: *** [configure-gcc] Error 1

so once again im stuck
Well, I can tell you that it is not i585 but i586...you have a wrong $TARGET. You should type i586-elf...

I've also created a makefile to compile my project and now I'm very happy. 10x to all of you, guys!

Edit: I just see now that ehird was faster then me! But I didn't see the post yesterday!
Last edited by INF1n1t on Mon Apr 09, 2007 2:57 am, edited 1 time in total.
I think, I have problems with Bochs. The biggest one: Bochs hates me!
supagu
Member
Member
Posts: 46
Joined: Sat Apr 07, 2007 1:24 am

Post by supagu »

okay a rebuild of gcc fixes it :)
evilhamburger
Posts: 6
Joined: Thu Mar 05, 2009 2:42 am

Re: GCC and LD problem

Post by evilhamburger »

Yes, I'm bumping an old post.


I'm having trouble setting up my cross compiler.

I have versions of bin utils and GCC that the wiki says works, and I have cygwin.

it chokes on the
"make all-gcc"
line.

I have tried different targets, different versions of GCC and Binutils too.

I am trying to compile from 32bit Windows 7, targeting ELF on the x64 arch.

Does anyone have an existing cross compiler I can borrow?
skyking
Member
Member
Posts: 174
Joined: Sun Jan 06, 2008 8:41 am

Re: GCC and LD problem

Post by skyking »

evilhamburger wrote: I have versions of bin utils and GCC that the wiki says works, and I have cygwin.

it chokes on the
"make all-gcc"
line.
That's not a very distinctive description of the problem. What kind of diagnostics do the make/compiler output?
evilhamburger
Posts: 6
Joined: Thu Mar 05, 2009 2:42 am

Re: GCC and LD problem

Post by evilhamburger »

oh it's something wrong with the makefile (I don't use make at all... so I'm not good with these errors)

../../gcc-4.4.2/gcc/cp/make-lang.in:190: *** target pattern contains no '%'. Stop.
make[1]: Leaving directory 'cygdrive/e/build-gcc/gcc'
make: *** [all-gcc] Error 2
User avatar
Solar
Member
Member
Posts: 7615
Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:

Re: GCC and LD problem

Post by Solar »

  • Did you follow the tutorial exactly?
  • What is the version of binutils you're using?
  • Did you follow the tutorial exactly?
  • What is the version of GCC you're using? (Well, it appears to be v4.4.2, I just want to be a pain at this point. ;-) )
  • Did you follow the tutorial exactly?
  • What is the version of make you're using ('make -v')?
  • What is the exact command sequence you've been using (i.e., did you follow the tutorial exactly)?
  • Is that really the error message? (It is very important to post everything from the topmost, i.e., first error message.)
Every good solution is obvious once you've found it.
evilhamburger
Posts: 6
Joined: Thu Mar 05, 2009 2:42 am

Re: GCC and LD problem

Post by evilhamburger »

Sorry, was on camp.

- Tutorial followed to the letter
- That is the first error message I get
- Bin utils V= 2.20 (Version I am building and version I am building with, but targeting a different platorm)
- GCC V = 4.4.2 (As above)
- GNU Make 3.81
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: GCC and LD problem

Post by Combuster »

make[1]: Leaving directory 'cygdrive/e/build-gcc/gcc'
- Tutorial followed to the letter
I hate to ruin your dreams, but you didn't.
"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 ]
evilhamburger
Posts: 6
Joined: Thu Mar 05, 2009 2:42 am

Re: GCC and LD problem

Post by evilhamburger »

I changed a folder. Hardly a tutorial breaker.
evilhamburger
Posts: 6
Joined: Thu Mar 05, 2009 2:42 am

Re: GCC and LD problem

Post by evilhamburger »

Make that...

I changed the root folder.
The structure after that is the same.
User avatar
AJ
Member
Member
Posts: 2646
Joined: Sun Oct 22, 2006 7:01 am
Location: Devon, UK
Contact:

Re: GCC and LD problem

Post by AJ »

evilhamburger wrote:I changed a folder. Hardly a tutorial breaker.
How many other things have been changed too?

Follow the tutorial to the letter and then when it works, try again with any changes you want to make.

Having said that, some things to consider:
* If you are running Windows 7, did you install and run Cygwin as an administrator? I believe this has made a difference to me in the past and could be worth a shot. I don't know how much difference this currently makes, because I run with UAC disabled.
* Are you able to build the basic i[5/6]86 version, or does it just fail with x64?
* What version of Cygwin are you using? TBH, I have never used the cross-compiler tutorial on 1.7 - I just transferred my version build on 1.5, but have just downloaded all the latest versions of GMP, MPFR, GCC and Binutils and am running through the tutorial on Cygwin 1.7 now. I'll post back any anomalies, but if (when ;) ) it works, will add a note on the wiki page.

I originally had problems with making the cross compiler, and never figured out what the problem was - probably not following something properly. Since that time, I've never since had an issue. In the meantime, I used someone else's precompiled versions, but it was never as satisfying!

Cheers,
Adam
Post Reply