Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem trying to get 32-bit exe from 64 bit gfortran

Status
Not open for further replies.

fmolina

Technical User
Jul 28, 2010
3
AR
Hello all:

This is probably a silly question, but I cannot find the answer.
I am using the gcc 64 bits compiler package dwonloaded from equation.com, running on windows XP x64.
Consider the following short f90 program:
Code:
program test32
implicit none
real*8 a, b
a = 2.0
b = 3.0 + a
print *, b
end program
Compiling with:
gfortran test32.f90
Compiles and runs OK. But if I want to make a 32 bits executable, issuing:
gfortran -m32 test32.f90
it gives the following messages:
C:\Temp\ccIkytx5.s: Assembler messages:
C:\Temp\ccIkytx5.s:8: Error: invalid instruction suffix for `push'
C:\Temp\ccIkytx5.s:39: Error: invalid instruction suffix for `push'

I tried things like -march=k8 etc but none works with -m32. What am I doing wrong?

Thanks in advance

Fernando
 
Hey Fernando,

I think that should work, although I've never dealt with 64-bit systems; they seem to be more trouble than they're worth to me.

My personal thoughts on x64 aside, I have a sneaking suspicion that the problem is your gfortran binaries. I've also used the GCC build from equation.com in the past -- and it had problems. The one I encountered was that it wouldn't accept wildcards, so you couldn't say "gfortran *.f90 -o test", for example. I contacted the gfortran developers, who told me that that meant the gfortran binaries were incorrectly built; gfortran should support that. Indeed, here:


we read: "MinGW 32/64bit builds by (builds were announced at comp.lang.fortran and are said to work well - but is not affiliated with any MinGW or GCC developer. Use at your own risk)"

What I would suggest is scrapping the Equation.com installation, and trying another one. On the same page above, the MinGW for Win64 binaries are officially supported. Why don't you dig around on there; for example, this one might work:
I'm not sure if that'll solve your problem, but you can try it.

--------------------------------------
Background: Chemical engineer, familiar mostly with MATLAB, but now branching out into real programming.
 
Hi NickFort

Thanks for your answer. I will try with MinGW and tell you what happens.

Regards,

Fernando
 
Hi NickFort,

I tried with several builds from the mingw-64 project. When I issue:
gfortran -m32 test32.f90
Now compilation goes OK, but ld is having trouble; I got messages like these:
c:/mingw/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/4.4.5/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible c:/mingw/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/4.4.5/libgfortranbegin.a when searching for -lgfortranbegin
[... a couple of times again the same message ...]
c:/mingw/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/4.4.5../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lgfortranbegin

and similar for other libraries (gfortran, mingw32, gcc_s, etc.). I am pretty sure that ld does not find the 32 bits libraries, but I dont' know where they are. Should I get them from the mingw builds targeting 32 bits?

Regards,

Fernando
 
Fernando, I honestly have no idea. The only thing I can suggest is that you ask the gfortran developers themselves. They are generally very quick to respond and very helpful. You can contact them at the mailing list: fortran@gcc.gnu.org

--------------------------------------
Background: Chemical engineer, familiar mostly with MATLAB, but now branching out into real programming.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top