LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux > Linux - Distributions > Gentoo
User Name
Password
Gentoo This forum is for the discussion of Gentoo Linux.

Notices

Reply
 
Thread Tools
Old 10-22-2009, 02:32 PM   #1
konqi
Member
 
Registered: Oct 2007
Location: Nieuwerkerk aan den IJssel (near Rotterdam, The Netherlands)
Distribution: Gentoo, Debian
Posts: 132
Thanked: 1
Distcc between i686 and i486 leads to 'illegal instruction'


[Log in to get rid of this advertisement]
I have a fileserver with an AMD k6-2 (350 MHz) processor. I use the gentoo i486 stage 3 install. To speed install up, I use distcc for compiling. The computer that compiles is my 3.0 GHz pentium 4 (i686 stage 3).

When i compile grub for the server, and run grub-install, I get these errors:
Code:
/sbin/grub-install: line 432: 16640 Illegal instruction 
$grub_shell --batch $no_floppy --device-map=$device_map  > $log_file <<EOF
dump ${root_drive}${tmp} ${img_file}
quit
EOF

/sbin/grub-install: line 432: 16645 Illegal instruction
 $grub_shell --batch $no_floppy --device-map=$device_map  > $log_file <<EOF
dump ${root_drive}${tmp} ${img_file}
quit
EOF

/sbin/grub-install: line 432: 16650 Illegal instruction
$grub_shell --batch $no_floppy --device-map=$device_map  > $log_file <<EOF
dump ${root_drive}${tmp} ${img_file}
quit
EOF

/sbin/grub-install: line 432: 16655 Illegal instruction
$grub_shell --batch $no_floppy --device-map=$device_map  > $log_file <<EOF
dump ${root_drive}${tmp} ${img_file}
quit
EOF

/sbin/grub-install: line 432: 16660 Illegal instruction
$grub_shell --batch $no_floppy --device-map=$device_map  > $log_file <<EOF
dump ${root_drive}${tmp} ${img_file}
quit
EOF

The file /boot/grub/stage1 not read correctly.
I know that these errors have something to do with code that can't be executed because they're compiled against a wrong architecture. In my case the code is probably i686, while I need i486 or i586.

My questions is, how can I make my pentium 4 make code for my server? Do I need Crossdev? What I understand is that Crossdev only makes an toolchain for another architecture, am I right?


EDIT:
Forgot to mention that on the server I use:
CFLAGS="-O2 -march=k6-2 -pipe -fomit-frame-pointer"
CXXFLAGS="${CFLAGS}"

And on my desktop:
CFLAGS="-O2 -mtune=pentium4 -march=pentium4 -pipe -fomit-frame-pointer"
CXXFLAGS="$CFLAGS"

Last edited by konqi; 10-22-2009 at 03:23 PM..
linuxgentoo konqi is offline     Reply With Quote
Old 10-23-2009, 07:53 AM   #2
AlucardZero
Senior Member
 
Registered: May 2006
Location: USA
Distribution: Debian
Posts: 1,551
Thanked: 76
Uh? If you're building for pentium4 then of course there's going to be sections that won't run on a k6. I don't know gentoo or distcc, but maybe change march/mtune on the P4 when you're compiling for the k6??
linux AlucardZero is offline     Reply With Quote
Thanked by:
Old 10-23-2009, 10:20 AM   #3
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 2,906
Thanked: 271
Quote:
Originally Posted by konqi View Post
I know that these errors have something to do with code that can't be executed because they're compiled against a wrong architecture. In my case the code is probably i686, while I need i486 or i586.
Yes. Unless your gcc is bugged. Please, check this guide about distcc and cross-compiling:

http://www.gentoo.org/doc/en/cross-compiling-distcc.xml

I've also requested this to be moved to teh Gentoo subforum. I know little about distcc and probably someone around there can give a better insight if the guide I linked is not enough help.
linuxgentoo i92guboj is offline     Reply With Quote
Old 10-23-2009, 02:01 PM   #4
konqi
Member
 
Registered: Oct 2007
Location: Nieuwerkerk aan den IJssel (near Rotterdam, The Netherlands)
Distribution: Gentoo, Debian
Posts: 132
Thanked: 1

Original Poster
I read the guide (http://www.gentoo.org/doc/en/cross-compiling-distcc.xml), but there's one big downside. You have to build your own toolchain, this does take a lot of compilation time, doesn't it?

Therefore I thought of unpacking an i486 stage3 from Gentoo, then chroot to it and use this as the distcc client. But there is a problem that you got 2 Gentoo installations (well, 1 real and a chroot) on one IP-address. Therefore the server don't know about the chroot.

Quote:
Uh? If you're building for pentium4 then of course there's going to be sections that won't run on a k6. I don't know gentoo or distcc, but maybe change march/mtune on the P4 when you're compiling for the k6??
Is it possible to change march/mtune? I think it will still not work, because CHOST is still set at i686-pc-linux-gnu, or is it safe to temporary change that to i486-pc-linux-gnu (and don't install software on the pentium4)?
linuxgentoo konqi is offline     Reply With Quote
Old 10-23-2009, 02:09 PM   #5
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 2,906
Thanked: 271
Quote:
Originally Posted by konqi View Post
I read the guide (http://www.gentoo.org/doc/en/cross-compiling-distcc.xml), but there's one big downside. You have to build your own toolchain, this does take a lot of compilation time, doesn't it?
Yes, it takes time. But in first place I don't quite understand the question. The stage3 file has everything a basic Gentoo system needs to work, including a proper compiler (unlike stage1, which needed -note the past tense, it's not supported nowadays- to be bootstrapped).

So, you already have a toolchain if you uncompressed the stage3 file.

Quote:
Is it possible to change march/mtune? I think it will still not work, because CHOST is still set at i686-pc-linux-gnu, or is it safe to temporary change that to i486-pc-linux-gnu (and don't install software on the pentium4)?
You don't need to change anything in the make.conf file of your distcc satellites as far as I know. But again, I am not a master in distcc as said above. In any case, changing the CHOST is not trivial, you shouldn't be doing that.
linuxgentoo i92guboj is offline     Reply With Quote
Old 10-23-2009, 02:32 PM   #6
konqi
Member
 
Registered: Oct 2007
Location: Nieuwerkerk aan den IJssel (near Rotterdam, The Netherlands)
Distribution: Gentoo, Debian
Posts: 132
Thanked: 1

Original Poster
I think you don't understand my problem. For clarification:

I have a server (amd k6-2, build from i486 stage 3). For compilation i have my destkop (pentium 4, build from i686 stage 3). The problem is that I can't use my desktop for distcc compiling, because it generates i686 code, which will not work on the server (because it's i486).
As far as I understand, I need to make an i486 toolchain on my desktop. But this takes probably a lot of time. Therefore I thought of using an unpacked i486 stage 3, chroot to it and use this for compiling. But this gives problems, because the server can't connect with distcc to the chroot.

When the server is ready compiling it's kernel, I will give changing march/mtune on my desktop a try.
linuxgentoo konqi is offline     Reply With Quote
Old 10-23-2009, 02:45 PM   #7
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 2,906
Thanked: 271
Quote:
Originally Posted by konqi View Post
I think you don't understand my problem. For clarification:

I have a server (amd k6-2, build from i486 stage 3). For compilation i have my destkop (pentium 4, build from i686 stage 3). The problem is that I can't use my desktop for distcc compiling, because it generates i686 code, which will not work on the server (because it's i486).
As far as I understand, I need to make an i486 toolchain on my desktop. But this takes probably a lot of time. Therefore I thought of using an unpacked i486 stage 3, chroot to it and use this for compiling. But this gives problems, because the server can't connect with distcc to the chroot.

When the server is ready compiling it's kernel, I will give changing march/mtune on my desktop a try.
I see. I misunderstood one point.

I don't think that your p4 is gonna take an eternity to build a toolchain for 486, it could take at most several hours depending on many factors.

However, i686 and i468 are very close, and I am not sure you truly need this. This is over the top of my knowledge though, so I won't continue because I could be misleading you. I hope this thread is moved soon to the Gentoo subforum where you can probably get better help about the issue from my Gentoo comrades. I'll poke a couple of them and see if they can give better help.
linuxgentoo i92guboj is offline     Reply With Quote
Thanked by:
Old 10-23-2009, 02:58 PM   #8
konqi
Member
 
Registered: Oct 2007
Location: Nieuwerkerk aan den IJssel (near Rotterdam, The Netherlands)
Distribution: Gentoo, Debian
Posts: 132
Thanked: 1

Original Poster
OK, thanks for all your help.

At least the compiled code won't work right now. When I compiled grub only from the server, it worked without errors.
linuxgentoo konqi is offline     Reply With Quote
Old 10-23-2009, 04:17 PM   #9
d2_racing
Gentoo support team
 
Registered: May 2009
Location: Ste-Foy,Québec,Canada
Distribution: Gentoo
Posts: 101
Thanked: 3
I have no idea on this one, because I never used distcc. If we don't find the answer here, I suggest that you repost your problem inside the Gentoo forum.
linuxgentoo d2_racing is offline     Reply With Quote
Old 10-23-2009, 04:53 PM   #10
Elv13
Member
 
Registered: Apr 2006
Distribution: Gentoo
Posts: 195
Thanked: 24
Add -mtune=i486 to the P4 make.conf when you want to use it on the K6, it is what I did back then.
linuxgentoo Elv13 is offline     Reply With Quote
Thanked by:
Old 10-24-2009, 09:18 AM   #11
pixellany
Moderator
 
Registered: Nov 2005
Location: Pasadena, CA
Distribution: Arch
Posts: 13,170
Thanked: 285
Moved: This thread is more suitable in <Gentoo> and has been moved accordingly to help your thread/question get the exposure it deserves.
linux pixellany is offline     Reply With Quote
Old 10-26-2009, 10:18 AM   #12
konqi
Member
 
Registered: Oct 2007
Location: Nieuwerkerk aan den IJssel (near Rotterdam, The Netherlands)
Distribution: Gentoo, Debian
Posts: 132
Thanked: 1

Original Poster
I changed march and mtune both to k6-2 on the pentium 4. Now it works! Thank you for your help.
linuxgentoo konqi is offline     Reply With Quote

Reply

Bookmarks


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Illegal instruction (core dumped) giancarlo76 Linux - Desktop 0 12-26-2006 10:06 AM
aticonfig illegal instruction tamtam Slackware 14 09-22-2006 09:27 PM
MPlex - Illegal Instruction RySk8er30 Linux - Software 1 01-22-2006 01:50 PM
Mplayer Illegal Instruction error visualnoise Linux - Software 4 02-28-2005 04:49 PM
Illegal instruction madsjakob Linux - Software 0 10-28-2003 08:25 AM


All times are GMT -5. The time now is 01:01 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
RSS2  LQ Podcast
RSS2  LQ Radio
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration