WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: Can't Compile  (Read 6389 times)

Offline AllenKll

  • Newbie
  • *
  • Posts: 6
Can't Compile
« on: November 05, 2012, 12:14:19 PM »
Hello,
  I am unable to compile anything on a particular system, and I need some help to track this down.

I have a PC104 stack, (VDX104 from Tri-M).
I have a CF card with GRUB installed and two partitions.  A boot partitions, (sda1) and a partition for extensions (sda2)

I boot TinyCore version 4.7 with these boot options:
  kernel /boot/vmlinuz text libata.dma=0 tce=sda2

I did a "tce-load -iw compiletc"  It completed successfully.

I created a source code file: echo "int main(){return 0;}" > main.c
I try to compile it:  gcc main.c -o main

I get this error:
gcc: internal compiler error: Illegal instruction (program cc1)
Please submit a full bug... yada yada...

I tried a C++ program with the nearly same result (g++ main.cpp -o main):
gcc: internal compiler error: Illegal instruction (program cc1plus)
Please submit a full bug... yada yada...

I don't know how to begin to debug this.  I don't believe it to be an issue with GCC, as I have done the same steps on a desktop computer (with less ram) and have no issue compiling.

Anyone have an idea of where to start to try to fix this?

thanks,
-Allen

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 11044
Re: Can't Compile
« Reply #1 on: November 05, 2012, 02:31:23 PM »
That is a 486-class cpu, and our current gcc contains instructions for 586 or 686.

Doing a compiler update just for 486 users was deemed too risky for this cycle.


Please consider compiling on another computer and then deploy to the 486.
The only barriers that can stop you are the ones you create yourself.

Offline AllenKll

  • Newbie
  • *
  • Posts: 6
Re: Can't Compile
« Reply #2 on: November 05, 2012, 03:57:48 PM »
Curaga,
  Thank you for taking the time to reply.  I'm not convinced that this is a 486 class CPU.  From what I read on Wikipeida, the Vortex86DX is a i586 class device.  "Any i586 code will run on Vortex86DX and later."
Granted, Wikipedia isn't the best source of information, but that is all I can find regarding the CPU class.

  Assuming, that you are correct, in order to compile for a 486 I would go with:"gcc -march=i486" on my other box?  Also, it isn't just compiling that I am after, but debugging as well, so I would need to compile GDB with this same -march option?

Am I on the right track?

Offline gerald_clark

  • TinyCore Moderator
  • Hero Member
  • *****
  • Posts: 4254
Re: Can't Compile
« Reply #3 on: November 05, 2012, 03:59:53 PM »
No, it is an AMD based processor that lacks the cmov instruction.  Therefore it cannot be classified as a 586.

Offline AllenKll

  • Newbie
  • *
  • Posts: 6
Re: Can't Compile
« Reply #4 on: November 05, 2012, 04:17:12 PM »
All,
  I did a cat /proc/cpuinfo and got:
processor       : 0
vendor_id       : Vortex86 SoC
cpu family      : 5
model           : 2
model name      : 05/02

Again to wikipedia, (List_of_Intel_microprocessors)
Family 5 Model 2 equates to a 32 bit P5 Micro-architecture ..... a 586.

Also, Google informs me that the CMOV instruction is a P6 architecture instruction.

I'm not trying to be argumentative, it's just that my research is indicating something different than what you are presenting.

From what I see, it's a 586... and I need to compile for a 586.  Please help me understand where I'm wrong.

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11586
Re: Can't Compile
« Reply #5 on: November 05, 2012, 04:24:15 PM »
Hi AllenKll
The cmov instruction is for 686 and above. The problem is not whether you are trying to compile for 486 or 586, it's
that gcc itself was compiled to run on 686 and above, and will not run on a 586.

Offline AllenKll

  • Newbie
  • *
  • Posts: 6
Re: Can't Compile
« Reply #6 on: November 05, 2012, 05:18:16 PM »
Now I understand.  I don't have a working i586 system to compile on, and it seems that even if I did, that TC4.7 might not be stable on it?

I gave a few hours to attempting to build a 686->586 cross compiler with nothing close to success.

Am I to then abandon TinyCore, and try a different distro?  What could you suggest for my PC104 stack?

thanks,

Offline bmarkus

  • Administrator
  • Hero Member
  • *****
  • Posts: 7183
    • My Community Forum
Re: Can't Compile
« Reply #7 on: November 05, 2012, 05:49:05 PM »
In general TC and extensions must work on your system except few extensions. By accident there may be few which is not compiled for 486, these must be rebuilt with proper options.

There is a chance that the few programs not built from source but imported in binary like Skype, Thunderbird, Flash, etc. fails on this hardware but it is just few special.

GCC is a special case, as Curaga wrote. You have two options:

1) Compile programs on another machine with options to generate executable for your CPU (it is not cross compilation!)

2) Rebuild the GCC toolchain for your target machine

I would choose 1)
Béla
Ham Radio callsign: HA5DI

"Amateur Radio: The First Technology-Based Social Network."

aus9

  • Guest
Re: Can't Compile
« Reply #8 on: November 05, 2012, 06:31:04 PM »
curaga
Quote
That is a 486-class cpu, and our current gcc contains instructions for 586 or 686

Does that mean our wiki for creating instructions is now out-of-date for the 486 bit?

Quote
export CFLAGS="-march=i486 -mtune=i686 -Os -pipe"
export CXXFLAGS="-march=i486 -mtune=i686 -Os -pipe"
export LDFLAGS="-Wl,-O1"

if so I am happy to edit but not yet skilled enough to know the answer.

Offline bmarkus

  • Administrator
  • Hero Member
  • *****
  • Posts: 7183
    • My Community Forum
Re: Can't Compile
« Reply #9 on: November 05, 2012, 06:43:32 PM »
if so I am happy to edit but not yet skilled enough to know the answer.

Why do you want to edit something what you do not know?

 >:(
Béla
Ham Radio callsign: HA5DI

"Amateur Radio: The First Technology-Based Social Network."

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11586
Re: Can't Compile
« Reply #10 on: November 05, 2012, 08:13:00 PM »
Hi aus9
No, the Wiki is fine.
Quote
-march=i486
This tells the compiler to generate code that is compatible with a 486 processor.
Quote
-mtune=i686
When used with   -march=i486 , this tells the compiler to optimize the 486 code to run on the 686 architecture.

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 11044
Re: Can't Compile
« Reply #11 on: November 06, 2012, 03:21:13 AM »
  Assuming, that you are correct, in order to compile for a 486 I would go with:"gcc -march=i486" on my other box?  Also, it isn't just compiling that I am after, but debugging as well, so I would need to compile GDB with this same -march option?

Am I on the right track?

It's possible I remember wrong and it's a 586, and our GCC requires a 686. Doesn't change the situation though.

Yes, you'd use -march=i486 on another box, and the app should run on the 486 then.
The only barriers that can stop you are the ones you create yourself.

Offline AllenKll

  • Newbie
  • *
  • Posts: 6
Re: Can't Compile
« Reply #12 on: November 06, 2012, 08:42:52 AM »
Thank you all for the help.

I've decided to switch to Slackware.  I'll never get the same boot up speed, but at least I know it will work on my system.

thanks,
-Allen

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11586
Re: Can't Compile
« Reply #13 on: November 06, 2012, 10:27:11 AM »
Hi AllenKll
Tinycore 3.8.4 is another option. It's a solid release and should run fine on your hardware. That's what I use on my
laptop to compile and cross compile the stuff I write.

Offline AllenKll

  • Newbie
  • *
  • Posts: 6
Re: Can't Compile
« Reply #14 on: November 06, 2012, 02:49:23 PM »
Rich,
  3.8 won't work for me as it uses a Linux kernel that has the R6040 driver broken, and my board uses the r6040 for Ethernet.

thanks for the idea, though.

-Allen