LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Gentoo
User Name
Password
Gentoo This forum is for the discussion of Gentoo Linux.

Notices


Reply
  Search this Thread
Old 10-22-2009, 01:32 PM   #1
konqi
Member
 
Registered: Oct 2007
Distribution: Gentoo, Slackware
Posts: 162

Rep: Reputation: 16
Distcc between i686 and i486 leads to 'illegal instruction'


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 02:23 PM.
 
Old 10-23-2009, 06:53 AM   #2
AlucardZero
Senior Member
 
Registered: May 2006
Location: USA
Distribution: Debian
Posts: 4,824

Rep: Reputation: 615Reputation: 615Reputation: 615Reputation: 615Reputation: 615Reputation: 615
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??
 
Old 10-23-2009, 09:20 AM   #3
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,083

Rep: Reputation: 405Reputation: 405Reputation: 405Reputation: 405Reputation: 405
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.
 
Old 10-23-2009, 01:01 PM   #4
konqi
Member
 
Registered: Oct 2007
Distribution: Gentoo, Slackware
Posts: 162

Original Poster
Rep: Reputation: 16
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)?
 
Old 10-23-2009, 01:09 PM   #5
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,083

Rep: Reputation: 405Reputation: 405Reputation: 405Reputation: 405Reputation: 405
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.
 
Old 10-23-2009, 01:32 PM   #6
konqi
Member
 
Registered: Oct 2007
Distribution: Gentoo, Slackware
Posts: 162

Original Poster
Rep: Reputation: 16
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.
 
Old 10-23-2009, 01:45 PM   #7
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,083

Rep: Reputation: 405Reputation: 405Reputation: 405Reputation: 405Reputation: 405
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.
 
Old 10-23-2009, 01:58 PM   #8
konqi
Member
 
Registered: Oct 2007
Distribution: Gentoo, Slackware
Posts: 162

Original Poster
Rep: Reputation: 16
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.
 
Old 10-23-2009, 03:17 PM   #9
d2_racing
Gentoo support team
 
Registered: May 2009
Location: Ste-Foy,Québec,Canada
Distribution: Gentoo
Posts: 115

Rep: Reputation: 17
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.
 
Old 10-23-2009, 03:53 PM   #10
Elv13
Member
 
Registered: Apr 2006
Location: Montreal,Quebec
Distribution: Gentoo
Posts: 825

Rep: Reputation: 129Reputation: 129
Add -mtune=i486 to the P4 make.conf when you want to use it on the K6, it is what I did back then.
 
Old 10-24-2009, 08:18 AM   #11
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
Moved: This thread is more suitable in <Gentoo> and has been moved accordingly to help your thread/question get the exposure it deserves.
 
Old 10-26-2009, 09:18 AM   #12
konqi
Member
 
Registered: Oct 2007
Distribution: Gentoo, Slackware
Posts: 162

Original Poster
Rep: Reputation: 16
I changed march and mtune both to k6-2 on the pentium 4. Now it works! Thank you for your help.
 
  


Reply



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 Off
HTML code is Off



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

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Gentoo

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

Main Menu
Advertisement
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
Twitter: @linuxquestions
Open Source Consulting | Domain Registration