Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

reeka

macrumors newbie
Original poster
May 13, 2010
3
0
Hi all,

First off I'm new both to the forum and using gcc and gfortran, so I excuse for the newbie questions...

I'm trying to compile a UNIX program, specifically PEST (http://www.pesthomepage.org/Downloads.php for those interested), for OS X 10.6.3 using gfortran from gcc 4.3. I've been trying and failing now for a couple of days and I'm completely stuck at a problem related to the archtecture of files. I'm first using a c preprocessor, which is included in the source code, and then trying to compile the source. It returns the following error:

ld: warning: in pest.o, file is not of required architecture
ld: warning: in pestsub1.o, file is not of required architecture
ld: warning: in pestsub2.o, file is not of required architecture
... ...

I've tried to add -m32 flags to the gfortran command but it still returns the same errors as well as:
ld: warning: in /opt/local/lib/gcc43/gcc/x86_64-apple-darwin10/4.3.4/libgfortranbegin.a, file is not of required architecture
ld: warning: in /opt/local/lib/gcc43/libgfortran.dylib, file is not of required architecture
ld: warning: in /opt/local/lib/gcc43/libgcc_s.10.5.dylib, missing required architecture i386 in file
ld: warning: in /opt/local/lib/gcc43/gcc/x86_64-apple-darwin10/4.3.4/libgcc.a, file is not of required architecture

From what I understand gfortran 4.3 is unable to work with 32 bit given the missing arch in the lib files, is that right? But why does the error of the .o files having bad arch appear both with flag -m32 and -m64? Is it possible at all to compile this source on OS X?

The flags used for the preprocessor is: -DUNIX -DFLUSHFILE -DSLEEP
and:
FFLAGS=-m64/32 -c -O0 -static
LDFLAGS=-m64/32

Any tips are welcome and appreciated!
Thanks
reeka
 
did the package you downloaded contain some .o files? If so, is there a "clean" target, etc. to get rid of them and have them re-built? Nothing should be built on your own machine that's the wrong architecture (unless you're purposely cross-compiling).

-Lee
 
did the package you downloaded contain some .o files? If so, is there a "clean" target, etc. to get rid of them and have them re-built? Nothing should be built on your own machine that's the wrong architecture (unless you're purposely cross-compiling).

-Lee

Thanks for the reply Lee.
The package does not contain any .o files. I "made" them using a c preprocessor (cppp) included in the package from .F fortran files. The cppp command in the makefile did not appear to work however (gave errors of invalid preprocessor directives if I remember right), so I made them manually executing cppp:
cppp -DUNIX -DFLUSHFILE -DSLEEP file.F file.o.
Since I'm a complete beginner the problem might be caused by this...
Is there a way to use another pre processor than the one included? And what would be the appropriate flags for such a preprocessor?

Edit:
the preprocessor call in the included makefile that does not work for me looks like this:
all : pest predvar1 predvar1a predvar2 predvar3 predvar4 predvar5 \
predunc1 predunc4 predunc5 infstat wtsenout pnulpar muljcosen \
identpar supcalc simcase predunc6

.F.f :
cppp $(DEFINES) $< $*.f



cgsolve.o: cgsolve.f
$(F90) $(FFLAGS) cgsolve.f

etc ...

definitions:
DEFINES= -DUNIX -DFLUSHFILE -DSLEEP
F90=gfortran (from macports)
FFLAGS=-m64 -c -O0 -static

Question: what does the "$<" refer to? cppp asks for two files (input output), but i cannot see how that command makes an output file?
 
Ok, problem is partially solved. I realised I did not know exactly what the preprocessors work was how how the compiling worked with which files. But I found out I was totally wrong and managed to compile the programs. At least I learned something :)

However, I have series of these makefiles where the cppp command (see above) does not seem to work and the .F files remain unchanged. I can call it manually and make it write the new .F files in another directory and then copy them back but it would be great to avoid this. Any ideas?
 
Your method?

Reeka,

It is good to see that you got PEST to compile on Mac 10.6. Would you mind posting some notes about your method? Specifically, which compiler and flags you set in the makefiles? Also, what were your LD_LIBRARY_PATH and DYLD_LIBRARY_PATH variables set for?

thanks!
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.