error when making cross compiler

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.
crasher
Posts: 21
Joined: Mon Jan 21, 2008 4:02 am

error when making cross compiler

Post by crasher »

I followed the wiki cross compiler tutorial to build my cross compiler in cygwin, but I got error (with no surprise) after I execute 'make all'. The error is as follows

Code: Select all

arlex.o: In function 'main':
/usr/src/build-binutils/binutils/arlex.c:1: multiple definition of '_main'
arparse.o:/usr/src/build-binutils/binutils/arparse.c:1: first defined here
ar.o: In function 'main':
/usr/src/build-binutils/binutils/../../binutils-20060817-1/binutils/ar.c:337:mu
ltiple definition of "main'
arparse.o:/usr/src/build-binutils/binutils/arparse.c:1: first defined here
ar.o: In function 'mri_emul':
/usr/src/build-binutils/binutils/../../binutils-20060817-1/binutils/ar.c:141: un
defined reference to '_yyparse'
collect2: ld returned 1 exit status
make[4]: *** [ar.exe] Error 1
make[3]: *** [all-recursive] Error 1
make[2]: *** [all] Error 2
make[1]: *** [all-binutils] Error 2
make: *** [all] Error 2
The excerpt of configure result is as follows

Code: Select all

configure:2306: checking for correct version of gmp.h   no
configure:2319: gcc -c -g -O2   conftest.c 1>&5
configure:2309:17: gmp.h: No such file or directory
configure: In function `main':
configure:2313: error: `choke' undeclared (first use in this function)
configure:2313: error: (Each undeclared identifier is reported only once
configure:2313: error: for each function it appears in.)
configure:2313: error: parse error before "me"
configure: failed program was:
#line 2308 "configure"
#include "confdefs.h"
#include "gmp.h"
int main() {

#if __GNU_MP_VERSION < 3
choke me
#endif

; return 0; }
configure:3451: checking for bison
configure:3451: checking for byacc
configure:3451: checking for yacc
configure:3491: checking for bison
pcmattman
Member
Member
Posts: 2566
Joined: Sun Jan 14, 2007 9:15 pm
Libera.chat IRC: miselin
Location: Sydney, Australia (I come from a land down under!)
Contact:

Post by pcmattman »

The cross-compiler tutorial has the correct instructions (it worked for me and many others) but you will need to make sure that you have all sorts of support software.

EDIT: Verify that you do actually have Bison (run Cygwin's setup.exe) and if you do, check for yacc and then lex. You're missing at least one of the three, it would appear.
crasher
Posts: 21
Joined: Mon Jan 21, 2008 4:02 am

Post by crasher »

I used Cygwin 2.573.2.2
my ld and ar versions are both 2.17.50.

I used cygwin setup.exe to download bison and byacc, and tried again, getting the same result.

the attached is the configure log and make log.

Have you installed all the packages in the setup.exe?
Attachments
configlog_new.txt
(3.66 KiB) Downloaded 25 times
crasher
Posts: 21
Joined: Mon Jan 21, 2008 4:02 am

Post by crasher »

Here is the make log file.
pcmattman
Member
Member
Posts: 2566
Joined: Sun Jan 14, 2007 9:15 pm
Libera.chat IRC: miselin
Location: Sydney, Australia (I come from a land down under!)
Contact:

Post by pcmattman »

It seems to me you are missing a _lot_ of programs - are you sure that your binutils version in Cygwin is correct (or that it even exists)? I notice that the configure script can't find objdump, for instance.

Also, try getting yacc (as well as byacc) and lex.
crasher
Posts: 21
Joined: Mon Jan 21, 2008 4:02 am

Post by crasher »

Here is the make log
Attachments
makelog_new.zip
(8.47 KiB) Downloaded 22 times
pcmattman
Member
Member
Posts: 2566
Joined: Sun Jan 14, 2007 9:15 pm
Libera.chat IRC: miselin
Location: Sydney, Australia (I come from a land down under!)
Contact:

Post by pcmattman »

That log shows me that it succeeded - typically now you'd run "make install" and it'd all be installed into your Cygwin environment (or wherever you set --prefix to).

Then you compile GCC.
User avatar
Solar
Member
Member
Posts: 7615
Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:

Post by Solar »

pcmattman wrote:The cross-compiler tutorial has the correct instructions (it worked for me and many others) but you will need to make sure that you have all sorts of support software.
Actually, it suffices to run Cygwin's setup.exe, without altering its default choice of packages except for to include devel/gcc and devel/make. No additional "support software" is required - or at least, was required last time I checked. I will check again next week (I'm without a suitable test machine ATM.)
Every good solution is obvious once you've found it.
Tyler
Member
Member
Posts: 514
Joined: Tue Nov 07, 2006 7:37 am
Location: York, England

Post by Tyler »

Solar wrote:
pcmattman wrote:The cross-compiler tutorial has the correct instructions (it worked for me and many others) but you will need to make sure that you have all sorts of support software.
Actually, it suffices to run Cygwin's setup.exe, without altering its default choice of packages except for to include devel/gcc and devel/make. No additional "support software" is required - or at least, was required last time I checked. I will check again next week (I'm without a suitable test machine ATM.)
Do me a favour (on the one thing that seems to break it for me every time) and see if texinfo is installed by default, and if not, does the compile fail. I have the problem on Cygwin and Lnux and it always bugs me that no one else seems to.
User avatar
JamesM
Member
Member
Posts: 2935
Joined: Tue Jul 10, 2007 5:27 am
Location: York, United Kingdom
Contact:

Post by JamesM »

Tyler wrote:
Solar wrote:
pcmattman wrote:The cross-compiler tutorial has the correct instructions (it worked for me and many others) but you will need to make sure that you have all sorts of support software.
Actually, it suffices to run Cygwin's setup.exe, without altering its default choice of packages except for to include devel/gcc and devel/make. No additional "support software" is required - or at least, was required last time I checked. I will check again next week (I'm without a suitable test machine ATM.)
Do me a favour (on the one thing that seems to break it for me every time) and see if texinfo is installed by default, and if not, does the compile fail. I have the problem on Cygwin and Lnux and it always bugs me that no one else seems to.
It happens to me too, but a simple apt-get install usually fixes it.
pcmattman
Member
Member
Posts: 2566
Joined: Sun Jan 14, 2007 9:15 pm
Libera.chat IRC: miselin
Location: Sydney, Australia (I come from a land down under!)
Contact:

Post by pcmattman »

Solar wrote:Actually, it suffices to run Cygwin's setup.exe, without altering its default choice of packages except for to include devel/gcc and devel/make. No additional "support software" is required - or at least, was required last time I checked. I will check again next week (I'm without a suitable test machine ATM.)
If it isn't installed you need bison, byacc, yacc, and lex. These may be installed by default but it can't hurt to check. Also, GCC (at least for me) binaries were not in the default installation.
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:

Post by Combuster »

Solar wrote:Actually, it suffices to run Cygwin's setup.exe, without altering its default choice of packages except for to include devel/gcc and devel/make. No additional "support software" is required - or at least, was required last time I checked. I will check again next week (I'm without a suitable test machine ATM.)
You'll need flex and bison for GCC 3 builds.
"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 ]
User avatar
Solar
Member
Member
Posts: 7615
Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:

Post by Solar »

That might be, but why would you want to use GCC 3? (Not a rethorical question here, I fail to see the benefit over using the stable 4.x line.)

PS: Will do the promised testing this evening, and adjust the tutorial accordingly.
Every good solution is obvious once you've found it.
User avatar
Brynet-Inc
Member
Member
Posts: 2426
Joined: Tue Oct 17, 2006 9:29 pm
Libera.chat IRC: brynet
Location: Canada
Contact:

Post by Brynet-Inc »

Solar wrote:That might be, but why would you want to use GCC 3? (Not a rethorical question here, I fail to see the benefit over using the stable 4.x line.)
As mentioned in a previous thread, GCC continues to get more "bloat" but at the same time.. drop several historical architectures.

OpenBSD uses it's own custom GCC 3.3.5 port... but as like other pieces of software distributed with OpenBSD.. It's just the version number it had when it went into the tree.

It contains several local modifications.. support for additional architectures.. and other optimizations they put in that unfortunately never went "upstream".

Still.. people go cross-eyed when they see the old version number.. in reality, they just never "upped" the version variables . :roll:
Image
Twitter: @canadianbryan. Award by smcerm, I stole it. Original was larger.
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:

Post by Combuster »

Solar wrote:That might be, but why would you want to use GCC 3? (Not a rethorical question here, I fail to see the benefit over using the stable 4.x line.)
So I don't need to specify the (possibly different) version when invoking a crosscompiler through the default one. And yes, I'm lazy. :wink:

Basically, its the idea that if something is (not) good enough to get bundled, it should be (not) good enough to osdev.
"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 ]
Post Reply