Author Topic: Changes To Compiler On 64bit System?  (Read 5136 times)

vanstrien

  • Jr. Member
  • **
  • Posts: 58
    • View Profile
    • http://www.vanstrien.net
Changes To Compiler On 64bit System?
« on: June 27, 2005, 01:10:06 pm »
I'm having a problem compiling on my box.  I think I have found the source of my problem, but have got no idea about a solution.

I'm running FC3 on an amd 64bit cpu.  I installed the cross compilation rpms, the same as I did on my old 32bit cpu.  When I try to compile anything for x86 I get errors during assembly, such as:

"{standard input}: 35: Error: suffix or operands invalid for 'push'"

If I do a cross compilation to ARM everything works just fine.  Therefore my suspicion is that the problem is due to the change in my chipset, but I have no idea what kind of compiler options to change, or if I need to install updated binaries of some kind.

Any ideas?
C860 Cacko ROM | 5500 tkcROM
256MB SD | 128MB SD
512MB CF | 256MB CF
D-Link DWL 660 WiFi| Linksys WCF12 WiFi
Socket Bluetooth | Socket Ethernet

melee

  • Jr. Member
  • **
  • Posts: 69
    • View Profile
    • http://
Changes To Compiler On 64bit System?
« Reply #1 on: June 28, 2005, 03:15:21 am »
Quote
I'm running FC3 on an amd 64bit cpu.  I installed the cross compilation rpms, the same as I did on my old 32bit cpu.  When I try to compile anything for x86 I get errors during assembly, such as:

"{standard input}: 35: Error: suffix or operands invalid for 'push'"

[div align=\"right\"][a href=\"index.php?act=findpost&pid=86061\"][{POST_SNAPBACK}][/a][/div]
Hi,

I run an AMD 64bit processor with the Qtopia and Embedix development packages and don't have a problem with them.
I also compile from source a lot for linux and that works fine.

What I don't do however is run a 64bit version of Linux.  I tried an earlier build of MDK 10 for AMD64 but didn't find it noticeably faster and had some problems with it.
A lot of the libraries were optimised for 64 bit and I think gcc was 64 bit.

So, if you are running a 64 bit optimised OS, I would look at that first.

I now run the standard 32 bit MDK 10.2 and can recommend that.
(with a modified 2.6.10 kernel to get around the problems with Zaurus USB i/O breaking in the 2.6.11 and 2.6.12 kernels - but thats another long story! )

regards

Melee
C860 - with Sharp ROM
1GB SD and 2 GB & 256MB CF
WiFi, Bluetooth and Sharp CF camera cards
Ubuntu 6.06
(WinXP if I really have to)

vanstrien

  • Jr. Member
  • **
  • Posts: 58
    • View Profile
    • http://www.vanstrien.net
Changes To Compiler On 64bit System?
« Reply #2 on: June 28, 2005, 04:43:48 pm »
Melee,

Yes, the fact that I am running a 64 bit OS is my problem, although that is what I alluded to in my first post. Running a 64bit version of fedora means that all compilers, programs, libraries, etc make use of 64 bit code, with the exception of any programs I've installed that use 32 bit compatibility libs - this lets me run 32 bit code too or run programs installed from 32 bit rpms.  (I have a bunch of libraries where I have installed 32bit and 64 bit versions, and the OS takes care of knowing which one it wants for a particular app)

The main issue is that all my memory pointers, for example, use 64 bit addresses.  The cascade effect on any code I'm compiling is that it is looking for 64 bit object code.    

This is where I'm getting a little confused.  When I installed the compiler for the Z it is expecting to create for a 32 bit target.  Now that I have a 64 bit target I was hoping that I could install some kind of compatibility lib to make it work, but I'm not even sure if that is even the solution.

And I don't want to install a 32 bit OS because that was the whole point of buying a 64 bit box.  I've got a good stable system right now except when using the compiler needed for the Z.  I might instead install a virtual machine or something and go that route.

Michael
C860 Cacko ROM | 5500 tkcROM
256MB SD | 128MB SD
512MB CF | 256MB CF
D-Link DWL 660 WiFi| Linksys WCF12 WiFi
Socket Bluetooth | Socket Ethernet

melee

  • Jr. Member
  • **
  • Posts: 69
    • View Profile
    • http://
Changes To Compiler On 64bit System?
« Reply #3 on: June 29, 2005, 12:21:38 pm »
Quote
I don't want to install a 32 bit OS because that was the whole point of buying a 64 bit box.  I've got a good stable system right now except when using the compiler needed for the Z.  I might instead install a virtual machine or something and go that route.
[div align=\"right\"][a href=\"index.php?act=findpost&pid=86221\"][{POST_SNAPBACK}][/a][/div]

Hi Michael,

As I see it you have several options, but the first one has to be trying to compile with gcc forced to compile 32 bit for x86

A quick look through man gcc shows 2 particular switches relevant to AMD processors.

The first is -march=i386 which notifies machine architecture as i386 and builds code which will run on that.

The second (which should be implied by the first, but no harm in making sure) is specific to AMD and is -m32, which forces the compiler to set int, long and pointers to 32 bit that will run on i386 architecture.
It looks like gcc will default to -m64t if it detects 64 bit processor.

I don't have anything set up to test this, so dont know if all the FC3 libraries are backwardly compatible with 32 bit instruction set,  once gcc is compiling 32 bit.

The other option of course is to replicate why your ARM compilation works.  
It uses a different compiler and specifies it.

You could do this by putting gcc 32 bit and relevant libs into a dir next to Qtopia and Embedix, write an script to set the environment to the relevant paths and write a modified tmake.conf to generate the appropriate Makefile.

This might be the most involved, but long term possibly the best solution.
I'll be interested to hear how you get on

regards

Melee
C860 - with Sharp ROM
1GB SD and 2 GB & 256MB CF
WiFi, Bluetooth and Sharp CF camera cards
Ubuntu 6.06
(WinXP if I really have to)

vanstrien

  • Jr. Member
  • **
  • Posts: 58
    • View Profile
    • http://www.vanstrien.net
Changes To Compiler On 64bit System?
« Reply #4 on: July 03, 2005, 10:11:27 pm »
Thanks for your advice Melee, but unfortunately that doesn't work.  I think I would need to recompile gcc296 to work on 64bit or to find a library that would allow for the 32bit compiling to work correctly.

I setup an FC4 virtual image and that is working just fine.  Not as nice as compiling in my normal environment but perhaps I'll want to move it to another server some day...

Michael
C860 Cacko ROM | 5500 tkcROM
256MB SD | 128MB SD
512MB CF | 256MB CF
D-Link DWL 660 WiFi| Linksys WCF12 WiFi
Socket Bluetooth | Socket Ethernet