Why does 'make' complain about a missing rule when I try to build a program from source?

6,861

The error message No rule to make target dl_params.inc, needed by angfrc.o. means, that the Makefile specifies the file dl_params.inc as a dependency for the building of the file angfrc.o. So you have to somehow find or create the dl_params.inc file.

Searching the documentation indicates, that this file should contain FORTRAN parameters required by DL_POLY. The user manual in section 7.1.1 explains, that there should be a utility sub-folder containing the program PARSET which can be used to generate such a parameter file (called new_params.inc by default). You probably just have to rename the new_params.inc file to dl_params.inc and place it in the main source-folder.

If the error persists then the Makefile obviously expects the dl_params.inc file somewhere else and you would have to have a closer look at the Makefile.

Share:
6,861

Related videos on Youtube

eikonal
Author by

eikonal

Updated on September 18, 2022

Comments

  • eikonal
    eikonal over 1 year

    I am a Linux novice, and I am attempting to compile scientific software called DL_POLY_Classic. I downloaded the zip file dl_class_1.6.tar.gz and unzipped it using the command tar xvzf dl_class_1.6.tar.gz. It gives me a series of folders containing various files for the program operation, which are described in the program manual. One of these directories, called source contains many .f files, among other things. The manual says that to compile the code, one needs to take one of the sample/template Makefiles and modify the paths therein to direct the make program to the appropriate directory containing the compiler. (This DL_POLY_Classic program is written in, and must be compiled with, Fortran [Fortran 90, I believe].)

    Based on the recommendation of a colleague, I am attempting to compile this code using an Intel Fortran compiler (ifort) that we have on our cluster. I have modified one of the targets in the template Makefile; this target now has the following text in the Makefile:

    #========== mpich-c2
    mpich-c2: dpp
        cp /opt/mpich/ch-p4/include/mpif.h mpif.h
        $(MAKE) LD="/opt/mpich_intel/ch-p4/bin/mpif90 -O3 -o" \
        LDFLAGS="-L/opt/mpich_intel/ch-p4/lib64 -lmpich" \
        TIMER="" \
        FC=/opt/intel_fc_80/bin/ifort \
        FFLAGS="-c " \
        MPICH_F90="/opt/mpich_intel/ch-p4/bin/mpif90" \
        CPFLAGS="-D$(STRESS) -DMPI -P -D'pointer=integer'\
        -I/opt/mpich_intel/ch-p4/include" \
        EX=$(EX) BINROOT=$(BINROOT) $(TYPE)
    

    I place the Makefile in the source directory, as the manual directs. Then while in the source directory, I type the command:

    make mpich-c2
    

    However, I get the following error message:

    cp /opt/mpich/ch-p4/include/mpif.h mpif.h
    make LD="/opt/mpich_intel/ch-p4/bin/mpif90 -O3 -o" \
            LDFLAGS="-L/opt/mpich_intel/ch-p4/lib64 -lmpich" \
            TIMER="" \
            FC=/opt/intel_fc_80/bin/ifort \
            FFLAGS="-c " \
            MPICH_F90="/opt/mpich_intel/ch-p4/bin/mpif90" \
            CPFLAGS="-DSTRESS -DMPI -P -D'pointer=integer'\
            -I/opt/mpich_intel/ch-p4/include" \
            EX=D.X BINROOT=./ 3pt
    make[1]: Entering directory `/export/home/myusername/dlc1_16/dl_class_1.6/source'
    make[1]: *** No rule to make target `dl_params.inc', needed by `angfrc.o'.  Stop.
    make[1]: Leaving directory `/export/home/myusername/dlc1_16/dl_class_1.6/source'
    make: *** [mpich-c2] Error 2
    

    So, the make program is telling me that there is No rule to make target dl_params.inc, needed by angfrc.o.

    My question is, what is the software telling me? Is it likely saying that it cannot find a file dl_params.inc, or is it likely that it is saying that it cannot find a file angfrc.o? Or, is it saying that I should have some sort of command in my Makefile to create a new file called dl_params.inc?

    When I search in my Makefile (which, as I mentioned, is essentially exactly the template provided by the authors, but just with the directories in the mpich-c2 target entries modified for the particular Fortran compiler to which I have access), I see only these mentions of dl_params.inc:

    # Declare dependency on parameters file
    
    $(OBJ_ALL): dl_params.inc
    $(OBJ_RRR): dl_params.inc
    $(OBJ_4PT): dl_params.inc
    $(OBJ_RSQ): dl_params.inc
    $(OBJ_NEU): dl_params.inc
    $(OBJ_RIG): dl_params.inc
    $(OBJ_EXT): dl_params.inc
    $(OBJ_SPME): dl_params.inc
    $(OBJ_HKE): dl_params.inc
    

    I am not sure what this means.

    On the other hand, when I search in my Makefile for angfrc.o, I see only one mention, in the first line of the following (after OBJ_ALL):

    # Define object files
    
    #=====================================================================
    
    OBJ_ALL = angfrc.o bndfrc.o cfgscan.o corshl.o coul0.o coul4.o \
        coul2.o coul3.o conscan.o dblstr.o dcell.o diffsn0.o \
        diffsn1.o dlpoly.o duni.o error.o ewald1.o ewald3.o \
        exclude.o exclude_atom.o fldscan.o exclude_link.o forces.o\
        exitcomms.o extnfld.o fbpfrc.o fcap.o freeze.o gauss.o \
        gdsum.o getrec.o gimax.o gisum.o gstate.o images.o initcomms.o \
        intlist.o intstr.o invert.o invfrc.o jacobi.o lowcase.o lrcmetal.o \
        lrcorrect.o machine.o merge.o merge1.o merge4.o \
        npt_b1.o npt_b3.o parset.o npt_h1.o npt_h3.o nve_1.o \
        nvt_b1.o nvt_e1.o nvt_h1.o parlst_nsq.o parlink.o parlst.o passcon.o \
        passpmf.o pmf_1.o pmf_shake.o primlst.o quench.o rdf0.o rdf1.o \
        rdshake_1.o result.o revive.o scdens.o shellsort.o shlfrc.o \
        shlmerge.o shlqnch.o shmove.o simdef.o splice.o static.o strip.o \
        strucopt.o sysdef.o sysgen.o systemp.o sysbook.o sysinit.o \
        tethfrc.o thbfrc.o timchk.o traject.o vertest.o vscaleg.o \
        warning.o xscale.o zden0.o zden1.o \
    

    I am not sure what this means, either.

    Interestingly, when I use the find command to search by name--for example, find -name angfrc.o, find -name *.o, and find -name dl_params.inc--I can find nothing anywhere in the program directories with these names. When I try find -name *.inc, I do find that a file comms.inc exists in the source directory. This particular file says in its header that it is the "dl_poly include file for MPI, PVM and SHMEM." It is a relatively short file (only 42 lines long), and it appears that it contains both "parameters for message tags" and "MPI tagsizes"--although, I do not really have a clue as to what I should be looking for in there.

    If you have time, can you please give me advise as to what I should try next? I am not so sure what the error message No rule to make target dl_params.inc, needed by angfrc.o. is telling me; do you have any ideas? Thank you very much for your time.

  • Noah
    Noah over 12 years
    The error message does not indicate that the file should be created by another rule - the build process might just as well expect it to be provided from somewhere else! If the Makefile does not have a rule for it then you have to either create the file manually (as specified in the documentation) or add the necessary steps to do so as a new rule to the Makefile. Since it is a somewhat niche program I would not be surprised that the build process requires some manual intervention (like creating a parameter file for your Fortran environment).
  • Noah
    Noah over 12 years
    One more thing: it might of course also be that the file is specified by a rule in some other Makefile - maybe you should check with a recursive grep over the whole package tree if you find other (include) Makefiles that have a rule for dl_params.inc.
  • vonbrand
    vonbrand over 11 years
    Another possibility is that the edited Makefile is broken (commands have to start with a TAB, not spaces; some editors "helpfully" expand TABs to spaces, or the user added a line starting with spaces that should have been a TAB).