Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Help! can not compile package with f77

  1. May 22, 2009 #1
    I'm trying to compile a package on Ubuntu, errors:

    f77 -fast -c -o contour2.o contour2.f
    MAIN contour2:
    sum:
    ssort:
    cc1: error: unrecognized command line option "-fast"
    /usr/bin/f77: aborting compilation
    make[1]: *** [contour2.o] Error 25
    make[1]: Leaving directory `/home/wyf/Desktop/Package/Source'
    make: *** [everything] Error 2

    please help me, thanks
     
  2. jcsd
  3. May 22, 2009 #2

    D H

    User Avatar
    Staff Emeritus
    Science Advisor

    What part of the bolded text don't you understand?
     
  4. May 22, 2009 #3
    I don't know how to solve the problem, when I deleted -fast from the makefile, I got:


    make[1]: Entering directory `/home/wyf/Desktop/Package/Source'
    f77 -c -o contour2.o contour2.f
    MAIN contour2:
    sum:
    ssort:
    f77 -o ../Bin/contour2 contour2.o
    make[1]: Leaving directory `/home/wyf/Desktop/Package/Source'
    make contour3
    make[1]: Entering directory `/home/wyf/Desktop/Package/Source'
    f77 -c -o contour3.o contour3.f
    MAIN contour3:
    sum:
    ssort:
    erfcc:
    f77 -o ../Bin/contour3 contour3.o
    make[1]: Leaving directory `/home/wyf/Desktop/Package/Source'
    make contour6
    make[1]: Entering directory `/home/wyf/Desktop/Package/Source'
    f77 -c -o contour6.o contour6.f
    MAIN contour6:
    sum:
    ssort:
    erfcc:
    f77 -o ../Bin/contour6 contour6.o
    make[1]: Leaving directory `/home/wyf/Desktop/Package/Source'
    make gsmooth
    make[1]: Entering directory `/home/wyf/Desktop/Package/Source'
    f77 -c -o gsmooth.o gsmooth.f
    MAIN:
    f77 -c -o src3ft.o src3ft.f
    src3ft:
    realfft:
    cxfft3:
    Warning on line 216: inconsistent calling sequences for cxfft3,
    arg 1: here complex variable, previously real variable.
    arg 6: here complex variable, previously real variable.
    cfft99:
    Warning on line 513: inconsistent calling sequences for cfft99,
    arg 1: here real variable, previously complex variable.
    arg 2: here real variable, previously complex variable.
    cftfax:
    fact:
    cftrig:
    vpassm:
    /tmp/fort77-9102-1.c:353: error: conflicting types for ‘cxfft3_’
    /tmp/fort77-9102-1.c:173: error: previous declaration of ‘cxfft3_’ was here
    /tmp/fort77-9102-1.c:434: error: conflicting types for ‘cfft99_’
    /tmp/fort77-9102-1.c:370: error: previous declaration of ‘cfft99_’ was here
    /usr/bin/f77: aborting compilation
    make[1]: *** [src3ft.o] Error 25
    make[1]: Leaving directory `/home/wyf/Desktop/Package/Source'
    make: *** [everything] Error 2


    my makefile is:
    BINDIR=../Bin
    FC= f77
    FLINK=f77
    FFLAGS=
    CC=cc
    CLINK=cc
    CFLAGS=-O
    FLIB=
    CLIB=

    everything: Makefile
    make contour2
    make contour3
    make contour6
    make gsmooth
    make cicden
    make delrho
    make multi
    make divide
    make rhostats
    make mrhostats
    make rmask
    make poisson_den
    make scalar

    thebasics: Makefile
    make contour3
    make gsmooth
    make multi
    make divide
    make scalar

    OBJS1= contour2.o
    contour2: $(OBJS1) Makefile
    $(FLINK) $(FFLAGS) -o $(BINDIR)/contour2 $(OBJS1) $(FLIB)

    OBJS2= contour3.o
    contour3: $(OBJS2) Makefile
    $(FLINK) $(FFLAGS) -o $(BINDIR)/contour3 $(OBJS2) $(FLIB)

    OBJS3= gsmooth.o src3ft.o
    gsmooth: $(OBJS3) Makefile
    $(FLINK) $(FFLAGS) -o $(BINDIR)/gsmooth $(OBJS3) $(FLIB)

    OBJS4= cicden.o
    cicden: $(OBJS4) Makefile
    $(FLINK) $(FFLAGS) -o $(BINDIR)/cicden $(OBJS4) $(FLIB)

    OBJS5= delrho.o ftread.o ftwrite.o ssumc.o
    delrho: $(OBJS5) Makefile
    $(CLINK) $(CFLAGS) -o $(BINDIR)/delrho $(OBJS5) $(CLIB)

    OBJS6= multi.o ftread.o ftwrite.o alloc.o
    multi: $(OBJS6) Makefile
    $(CLINK) $(CFLAGS) -o $(BINDIR)/multi $(OBJS6) $(CLIB)

    OBJS7= divide.o ftread.o ftwrite.o alloc.o
    divide: $(OBJS7) Makefile
    $(CLINK) $(CFLAGS) -o $(BINDIR)/divide $(OBJS7) $(CLIB)

    OBJS8= rhostats.o ftread.o ftwrite.o alloc.o
    rhostats: $(OBJS8) Makefile
    $(CLINK) $(CFLAGS) -o $(BINDIR)/rhostats $(OBJS8) $(CLIB)

    OBJS9= mrhostats.o ftread.o ftwrite.o alloc.o
    mrhostats: $(OBJS9) Makefile
    $(CLINK) $(CFLAGS) -o $(BINDIR)/mrhostats $(OBJS9) $(CLIB)

    OBJS10= rmask.o ftread.o ftwrite.o alloc.o
    rmask: $(OBJS10) Makefile
    $(CLINK) $(CFLAGS) -o $(BINDIR)/rmask $(OBJS10) $(CLIB)

    OBJS11= poisson_den.o ranc.o alloc.o ftwrite.o
    poisson_den: $(OBJS11) Makefile
    $(CLINK) $(CFLAGS) -o $(BINDIR)/poisson_den $(OBJS11) $(CLIB)

    OBJS12= scalar.o alloc.o ftread.o ftwrite.o
    scalar: $(OBJS12) Makefile
    $(CLINK) $(CFLAGS) -o $(BINDIR)/scalar $(OBJS12) $(CLIB)

    OBJS13= contour6.o
    contour6: $(OBJS13) Makefile
    $(FLINK) $(FFLAGS) -o $(BINDIR)/contour6 $(OBJS13) $(FLIB)

    I just don't know how to fix it! any help will be appreciated!

     
  5. May 22, 2009 #4
    There are compilation errors which seem to indicate that your compiler accepts 6-character variable names (F77 standard) while the source code expects some other compilers that accept an extension (sometimes up to 32 characters).

    It's time to check the source code package for the compatible operating systems and compilers, and see if your system or compiler is one of them. If not, expect to do some hands-on programming/modifications.
     
  6. May 23, 2009 #5
    Thanks for your reply, but if you can tell me how to "check the source code package for the compatible operating systems and compilers", that will be awesome.
    1,Does that mean I have to find other machines with different system?
    2,I do not know how to select "complier", looks makefile has defined everything, so I should edit makefile?

     
  7. May 23, 2009 #6
    The source code package normally come with installation or compiling/linking instructions.
    These instructions typically indicate the required machines, operating system, language and compiler. The internal settings are generally taken care of by the Makefile.

    Very often, these instructions also indicate on which systems the source code has been successfully compiled, that doesn't mean that it will not compile correctly under other environments. It is possible that there are just minor adjustments to the code to be made, but that usually require understanding of the problem and the adjustments required, i.e. a little programming.

    The fact that your Makefile contains a -fast parameter which your compiler does not understand seems to tell me that you may not be using a correct compiler.

    My suggestion is to go back to the installation/compiling/linking instructions and find out what the acceptable environments are, and see if you can comply, within your limits of resources.

    Another option is to search on the Internet to see if there are binary/executable versions of the code that runs on your platform... unless you need to modify the code for your own purposes.
     
  8. May 25, 2009 #7
    thanks for your reply, I can not find information in my source package, I attached my package here, if anyone can look at it, that will be awesome, this package comes from david weinberg, who is one of the famousest astronomy scentists in the world now.


     

    Attached Files:

  9. May 25, 2009 #8

    D H

    User Avatar
    Staff Emeritus
    Science Advisor

    The code is broken. Look at the offending file. In the calls to cxfft3 in subroutine src3ft, the first and last arguments passed to cxfft3 are real*4 arrays. The function cxfft3 declares those arguments as complex arrays. How to fix it: Talk to the author.
     
  10. May 25, 2009 #9
    I agree with DH to discuss with the author. However, I believe the problem can be fixed by modifying the source code.

    In my opinion, the author wanted to manipulate the real and complex components as real values in the calling program, while the called subroutine treats the same array as a complex array. Lines 89-98 give it away.
    Code (Text):

    c---  Output : DATA contains Fourier components at grid points
    c---                (n1/2,n2,n3); i.e. DATA(1,1,1) and DATA(2,1,1)
    c---                are the real and complex components of the 1st
    c---                (kx=ky=kz=0) Fourier component and so on.
    c---                This means we use only the half plane kx >= 0
    c---                for FFTs of a real array to save time and memory.
    c---           SPEQ contains the Nyquist frequency values of kx
    c---                frequency component; i.e. SPEQ(1,1,1) and SPEQ(2,1,1)
    c---                are the real and complex components of the component
    c---                with kx=n1/2, ky=kz=0 and so on.
     
    In the old days, this practice was very common, and compilers blindly linked them together, so the source code package WAS correct. With modern linkers(*), more checking is done, and so this practice was disallowed.

    How do we fix it? ...By using EQUIVALENCE. Fortran allows users to share memory by calling the same location by different names, in much the same way as "union" in the C-language.

    Here is a very simple example of how equivalence is used:

    Code (Text):

          REAL*4 A(2,4)
          COMPLEX*8 C(4)
          EQUIVALENCE(A,C)
          A(1,3)=2.0
          A(2,3)=1.0
          PRINT *,REAL(C(3)),AIMAG(C(3))
          STOP
          END
     
    You can apply the idea to the calling program by declaring COMPLEX arrays with the first dimension half of that of the equivalent REAL array. Do not forget to declare EQUIVALENCE between the REAL and COMPLEX arrays, otherwise they will be simply two independent ones. The subroutine call will be modified to use the complex arrays instead of the real arrays. This way, the linker(*) will realize that the sharing of memory is intended.

    Whether you are successful with this attempt or not, I suggest you still inform the author of what you have done. If this is done correctly, other users will benefit from your changes. If not, perhaps he will already have a fix for you.

    His e-mail address is:
    dhw@astronomy.ohio-state.edu

    * edited 09:33 PM (UT)
     
    Last edited: May 25, 2009
  11. May 25, 2009 #10
    thanks for your reply, Actually David Weinberg gave me this package a few weeks ago, and when I told him I have problem to install, he told me he can not help me for this "compiler" issue, so I came to this forum to seek help...

    I really do not want to bother him again for this "off-research" issue. I will try to use your "EQUIVALENCE" even I never use fortran..


    Thanks again


     
  12. May 25, 2009 #11
    Actually, I have written to him about the -fast option, and he replied to me that it probably was run on the SGI unix system.
    I followed up with the question of equivalence, and hope he will give me a reply soon. On the other hand, you can go ahead and give it a try.
    Unfortunately my F77 compiler cannot accept the large size of memory requested in the program, so I cannot check if it works. If you'd like, I can make a suggestion and you can run the Makefile to see if it works.
    Will get back to you soon.
     
  13. May 25, 2009 #12
    Here are my proposed changes:

    As of line 114, make the changes in bold, the old call to cxfft has to be commented as shown:
    Code (Text):

    c---  memory than the array size, which is crucial to n-body work.

          double precision wr,wi,wpr,wtemp,theta
          real*4 data(n1,n2,n3),speq(2,n2,n3)
          COMPLEX*8 CDATA(n1/2,n2,n3),CSPEQ(1,n2,n3)
          EQUIVALENCE (data, CDATA), (speq, CSPEQ)
          ip1= 1
          im1= 1
          c1 = 0.5
          c2 = -0.5*isign
          theta = 6.28318530717959d0/dble(isign*n1)
          wpr = -2.d0*dsin(0.5d0*theta)**2
          wpi = dsin(theta)
    c---  Forward Transform
          if(isign.eq.1)then
    C      call cxfft3(data,n1/2,n2,n3,isign,speq)
          call cxfft3(CDATA,n1/2,n2,n3,isign,CSPEQ)
          do 12 i3=1,n3
          do 11 i2=1,n2
     
    Make the same change to line 201, call cxfft3(CDATA...) as the lines above.
    Good luck.
     
  14. May 26, 2009 #13
    thanks for your help!
    this is the result, looks I still have problem.

    make contour2
    make[1]: Entering directory `/home/wyf/Desktop/Package/Source'
    f77 -o ../Bin/contour2 contour2.o
    make[1]: Leaving directory `/home/wyf/Desktop/Package/Source'
    make contour3
    make[1]: Entering directory `/home/wyf/Desktop/Package/Source'
    f77 -o ../Bin/contour3 contour3.o
    make[1]: Leaving directory `/home/wyf/Desktop/Package/Source'
    make contour6
    make[1]: Entering directory `/home/wyf/Desktop/Package/Source'
    f77 -o ../Bin/contour6 contour6.o
    make[1]: Leaving directory `/home/wyf/Desktop/Package/Source'
    make gsmooth
    make[1]: Entering directory `/home/wyf/Desktop/Package/Source'
    f77 -c -o src3ft.o src3ft.f
    src3ft:
    realfft:

    Error processing equivalences before line 121: Declaration error for data: adjustable in equivalence
    Error processing equivalences before line 121: Declaration error for speq: adjustable in equivalence
    Error on line 207: nondigit in statement label field " end"
    Error on line 207: unclassifiable statement (starts "if")
    Error on line 209: DO loop or BLOCK IF not closed
    cxfft3:
    Warning on line 221: inconsistent calling sequences for cxfft3,
    arg 1: here complex variable, previously real variable.
    arg 6: here complex variable, previously real variable.
    cfft99:
    Warning on line 518: inconsistent calling sequences for cfft99,
    arg 1: here real variable, previously complex variable.
    arg 2: here real variable, previously complex variable.

    cftfax:
    fact:
    cftrig:
    vpassm:
    /usr/bin/f77: aborting compilation
    make[1]: *** [src3ft.o] Error 25
    make[1]: Leaving directory `/home/wyf/Desktop/Package/Source'
    make: *** [everything] Error 2

     
    Last edited: May 26, 2009
  15. May 26, 2009 #14
    Could you post the source program that you have changed? It seems that there are unexpected errors.

    By the way, I have a reply from Professor Weinberg that encourages us to try the EQUIVALENCE fix. He added that the part where we have a problem is in one of the supplementary programs which was not writtem by himself. He has included a different version of src3ft2.f that is "is less flexible but may compile more easily".

    I believe the best bet for now is to fix the problem using equivalence. We'll see what to do if we encounter problems.

    Hope to hear from you soon.

    P.S. I enclose herewith the version of src3ft2.f from Professor Weinberg.
     

    Attached Files:

  16. May 26, 2009 #15
    I am very glad to see Prof Weinberg joined in this issue...

    1,
    from line 116,
    was:
    double precision wr,wi,wpr,wtemp,theta
    real*4 data(n1,n2,n3),speq(2,n2,n3)
    now:
    double precision wr,wi,wpr,wtemp,theta
    real*4 data(n1,n2,n3),speq(2,n2,n3)
    COMPLEX*8 CDATA(n1/2,n2,n3),CSPEQ(1,n2,n3)
    EQUIVALENCE (data, CDATA), (speq, CSPEQ)


    from line 130,
    was:
    call cxfft3(data,n1/2,n2,n3,isign,speq)
    now:
    call cxfft3(CDATA,n1/2,n2,n3,isign,CSPEQ)

    from line 205,
    was:
    call cxfft3(data,n1/2,n2,n3,isign,speq)
    now:
    call cxfft3(CDATA,n1/2,n2,n3,isign,CSPEQ)

    I tried the new src3ft2.f, changed its name to src3ft.f, then I got the following error message:
    make contour2
    make[1]: Entering directory `/home/wyf/Desktop/backup/Package/Source'
    f77 -o ../Bin/contour2 contour2.o
    make[1]: Leaving directory `/home/wyf/Desktop/backup/Package/Source'
    make contour3
    make[1]: Entering directory `/home/wyf/Desktop/backup/Package/Source'
    f77 -o ../Bin/contour3 contour3.o
    make[1]: Leaving directory `/home/wyf/Desktop/backup/Package/Source'
    make contour6
    make[1]: Entering directory `/home/wyf/Desktop/backup/Package/Source'
    f77 -o ../Bin/contour6 contour6.o
    make[1]: Leaving directory `/home/wyf/Desktop/backup/Package/Source'
    make gsmooth
    make[1]: Entering directory `/home/wyf/Desktop/backup/Package/Source'
    f77 -o ../Bin/gsmooth gsmooth.o src3ft.o
    gsmooth.o: In function `MAIN__':
    fort77-23718-1.c:(.text+0x3b2): undefined reference to `src3ft_'
    fort77-23718-1.c:(.text+0x640): undefined reference to `src3ft_'
    collect2: ld returned 1 exit status

    make[1]: Leaving directory `/home/wyf/Desktop/backup/Package/Source'
    make cicden
    make[1]: Entering directory `/home/wyf/Desktop/backup/Package/Source'
    f77 -o ../Bin/cicden cicden.o
    make[1]: Leaving directory `/home/wyf/Desktop/backup/Package/Source'
    make delrho
    make[1]: Entering directory `/home/wyf/Desktop/backup/Package/Source'
    cc -O -o ../Bin/delrho delrho.o ftread.o ftwrite.o ssumc.o
    make[1]: Leaving directory `/home/wyf/Desktop/backup/Package/Source'
    make multi
    make[1]: Entering directory `/home/wyf/Desktop/backup/Package/Source'
    cc -O -o ../Bin/multi multi.o ftread.o ftwrite.o alloc.o
    make[1]: Leaving directory `/home/wyf/Desktop/backup/Package/Source'
    make divide
    make[1]: Entering directory `/home/wyf/Desktop/backup/Package/Source'
    cc -O -o ../Bin/divide divide.o ftread.o ftwrite.o alloc.o
    make[1]: Leaving directory `/home/wyf/Desktop/backup/Package/Source'
    make rhostats
    make[1]: Entering directory `/home/wyf/Desktop/backup/Package/Source'
    cc -O -o ../Bin/rhostats rhostats.o ftread.o ftwrite.o alloc.o
    rhostats.o: In function `main':
    rhostats.c:(.text+0x1d1): undefined reference to `sqrtf'
    collect2: ld returned 1 exit status
    make[1]: *** [rhostats] Error 1
    make[1]: Leaving directory `/home/wyf/Desktop/backup/Package/Source'
    make: *** [everything] Error 2




     
    Last edited: May 26, 2009
  17. May 26, 2009 #16
    Code (Text):

    double precision wr,wi,wpr,wtemp,theta
    real*4 data(n1,n2,n3),speq(2,n2,n3)
    COMPLEX*8 CDATA(n1/2,n2,n3),CSPEQ(1,n2,n3)
    EQUIVALENCE (data, CDATA), (speq, CSPEQ)

    from line 130,
    was:
    call cxfft3(data,n1/2,n2,n3,isign,speq)
    now:
    call cxfft3(CDATA,n1/2,n2,n3,isign,CSPEQ)

    from line 205,
    was:
    call cxfft3(data,n1/2,n2,n3,isign,speq)
    now:
    call cxfft3(CDATA,n1/2,n2,n3,isign,CSPEQ)
     
    Does the above code still give the following error messages. If not, could you send me the new error messages, if any?
    I have taken a closer look at the calling sequence. Unfortunately x and speq have been passed on as formal parameters with variable dimensioning, it may be possible to require other minor modifications that relate to x(*). It may work out on your compiler though, that is why I need the latest messages that correspond to the code in order to find the next step.

    I would hold off the trial on the new version of scrfft3.f for now. The sqrtf() not found error can easily be solved by replacing sqrtf() by sqrt(). There used to be a time when the library functions were all suffixed with the letter f. It was subsequently removed.
     
  18. May 26, 2009 #17
    with the corrected src3ft.f, I got the following error message:
    make contour2
    make[1]: Entering directory `/home/wyf/Desktop/Package/Source'
    f77 -o ../Bin/contour2 contour2.o
    make[1]: Leaving directory `/home/wyf/Desktop/Package/Source'
    make contour3
    make[1]: Entering directory `/home/wyf/Desktop/Package/Source'
    f77 -o ../Bin/contour3 contour3.o
    make[1]: Leaving directory `/home/wyf/Desktop/Package/Source'
    make contour6
    make[1]: Entering directory `/home/wyf/Desktop/Package/Source'
    f77 -o ../Bin/contour6 contour6.o
    make[1]: Leaving directory `/home/wyf/Desktop/Package/Source'
    make gsmooth
    make[1]: Entering directory `/home/wyf/Desktop/Package/Source'
    f77 -c -o src3ft.o src3ft.f
    src3ft:
    realfft:
    Error processing equivalences before line 121: Declaration error for data: adjustable in equivalence
    Error processing equivalences before line 121: Declaration error for speq: adjustable in equivalence
    Error on line 207: nondigit in statement label field " end"
    Error on line 207: unclassifiable statement (starts "if")
    Error on line 209: DO loop or BLOCK IF not closed

    cxfft3:
    Warning on line 221: inconsistent calling sequences for cxfft3,
    arg 1: here complex variable, previously real variable.
    arg 6: here complex variable, previously real variable.
    cfft99:
    Warning on line 518: inconsistent calling sequences for cfft99,
    arg 1: here real variable, previously complex variable.
    arg 2: here real variable, previously complex variable.
    cftfax:
    fact:
    cftrig:
    vpassm:
    /usr/bin/f77: aborting compilation
    make[1]: *** [src3ft.o] Error 25
    make[1]: Leaving directory `/home/wyf/Desktop/Package/Source'
    make: *** [everything] Error 2




     
  19. May 27, 2009 #18
    It may be simpler for me if you could send me the "corrected" version of the src3ft.f, the version that contains the equivalence modifications. It will have to be zipped because I don't think .f extension will be allowed here. I can then read the line numbers with the error messages, and attempt modifications as required. Since I do not yet have the Linux compiler, it will take a couple of attempts.
     
  20. May 27, 2009 #19
    please see attachment, I did not compress, and just changed the name( src3ft.f to src3ft.zip), you need to change the name back, thank you very much
     

    Attached Files:

  21. May 29, 2009 #20
    Sorry that it took a while to get back to you.
    I finally installed g77 on my computer, but it confirms that it does not like the equivalence statement as I have suggested. On the other hand, it compiles the original file as is without any hitch.
    I was wondering, on the Linux system that you use, do you have g77 available?
    Could you try to modify the first few lines of the Makefile to change f77 to g77, or whichever command required to run g77 on your computer?
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: Help! can not compile package with f77
  1. Compiler help (Replies: 1)

  2. Fortran compiling Help (Replies: 4)

Loading...