problem with compling program by makefile

Discussion in 'Mac Programming' started by Apfik, Mar 24, 2011.

  1. Apfik macrumors newbie

    Joined:
    Oct 18, 2009
    Location:
    Copenhagen
    #1
    Hello all,
    I am very new in using terminal and I have got problem with compiling a program evalglare for glare analysis. I am sure I am doing so beginner mistake, but I can not figure it out. I am installing it on mac OSX 10.5.8.

    what I have done is I unpacked evalglare-v0.9f.tar.gz which contains files

    Makefile
    evalglare.c
    pictool.c
    platform.h
    buglist
    documentation_v0.9f.pdf
    pictool.h

    and folders

    geometry
    common

    The file "documentation_v0.9f.pdf" does not contains any instructions how ti install, it is documentation of the program functionality.

    What I did I have run from the package
    David:evalglare Dave$ make

    getting those lines
    gcc -c -g -DMSDOS -DPICT_GLARE -DFLOAT=double -O3 -Wall -o common/color.o common/color.c -I. -Igeometry
    gcc -c -g -DMSDOS -DPICT_GLARE -DFLOAT=double -O3 -Wall -o common/resolu.o common/resolu.c -I. -Igeometry
    common/resolu.c: In function 'str2resolu':
    common/resolu.c:98: warning: implicit declaration of function 'atoi'
    gcc -c -g -DMSDOS -DPICT_GLARE -DFLOAT=double -O3 -Wall -o common/header.o common/header.c -I. -Igeometry
    gcc -c -g -DMSDOS -DPICT_GLARE -DFLOAT=double -O3 -Wall -o common/image.o common/image.c -I. -Igeometry
    gcc -c -g -DMSDOS -DPICT_GLARE -DFLOAT=double -O3 -Wall -o common/fvect.o common/fvect.c -I. -Igeometry
    gcc -c -g -DMSDOS -DPICT_GLARE -DFLOAT=double -O3 -Wall -o common/badarg.o common/badarg.c -I. -Igeometry
    gcc -c -g -DMSDOS -DPICT_GLARE -DFLOAT=double -O3 -Wall -o common/words.o common/words.c -I. -Igeometry
    gcc -c -g -DMSDOS -DPICT_GLARE -DFLOAT=double -O3 -Wall -o common/fputword.o common/fputword.c -I. -Igeometry
    gcc -c -g -DMSDOS -DPICT_GLARE -DFLOAT=double -O3 -Wall -o common/expandarg.o common/expandarg.c -I. -Igeometry
    gcc -c -g -DMSDOS -DPICT_GLARE -DFLOAT=double -O3 -Wall -o common/wordfile.o common/wordfile.c -I. -Igeometry
    gcc -c -g -DMSDOS -DPICT_GLARE -DFLOAT=double -O3 -Wall -o common/bmalloc.o common/bmalloc.c -I. -Igeometry
    gcc -c -g -DMSDOS -DPICT_GLARE -DFLOAT=double -O3 -Wall -o common/mat4.o common/mat4.c -I. -Igeometry
    gcc -c -g -DMSDOS -DPICT_GLARE -DFLOAT=double -O3 -Wall -o pictool.o pictool.c -I. -Igeometry
    In file included from pictool.h:12,
    from pictool.c:1:
    geometry/g3affine.h:14:19: error: GL/gl.h: No such file or directory
    In file included from pictool.h:12,
    from pictool.c:1:
    geometry/g3affine.h:26: error: syntax error before 'GLdouble'
    geometry/g3affine.h:27: error: syntax error before 'GLdouble'
    pictool.c: In function 'read_exposure':
    pictool.c:89: error: nested functions are disabled, use -fnested-functions to re-enable
    pictool.c: In function 'pict_read_fp':
    pictool.c:228: warning: unused variable 'ex'
    pictool.c: In function 'pict_write_fp':
    pictool.c:519: warning: unused variable 'argv'
    pictool.c:518: warning: unused variable 'argc'
    make: *** [pictool.o] Error 1

    and when I tried to run

    David:evalglare Dave$ make install

    I have got this error and the program was not install.
    make: *** No rule to make target `install'. Stop.

    Thank you for any advices
    David
     
  2. Bill McEnaney, Mar 24, 2011
    Last edited: Mar 24, 2011

    Bill McEnaney macrumors 6502

    Joined:
    Apr 29, 2010
    #2
    David, problem seems to be that your computer can't find a header file called "gl.h". It expects to see that file in a directory named "GL." Is the GL directory inside the directory your computer created when it untarred the file the C programs were in? Did any instructions tell you to add a path to your system path, to the value of the environment variable named "PATH"? I doubt you'll need to add one.
     
  3. Apfik thread starter macrumors newbie

    Joined:
    Oct 18, 2009
    Location:
    Copenhagen
    #3
    Hi the missing "gl.h" is probably not only problem. I have got this file form Mesa 3-D graphics package and copy whole directory "GL" to the directory, however I am still getting following error which is still same. It is same also when I copy the "GL" directory to /usr/include


    David:evalglare Dave$ make
    gcc -c -g -DMSDOS -DPICT_GLARE -DFLOAT=double -O3 -Wall -o pictool.o pictool.c -I. -Igeometry
    pictool.c: In function 'read_exposure':
    pictool.c:89: error: nested functions are disabled, use -fnested-functions to re-enable
    pictool.c: In function 'pict_read_fp':
    pictool.c:228: warning: unused variable 'ex'
    pictool.c: In function 'pict_write_fp':
    pictool.c:519: warning: unused variable 'argv'
    pictool.c:518: warning: unused variable 'argc'
    make: *** [pictool.o] Error 1
     
  4. Bill McEnaney, Mar 24, 2011
    Last edited: Mar 24, 2011

    Bill McEnaney macrumors 6502

    Joined:
    Apr 29, 2010
    #4
    Hi David,

    The list of error messages mentions a compiler directive that tells the computer to compile nested functions. So you may need to add that directive to the "CFLAGS" line in your makefile. Nested functions in a C programs? Hmm, that idea is new to me.

    I've downloaded the tar file evalglare is in, so I'll try to compile the program Friday March 25. I'm too tired now.

    Bill
     
  5. Apfik thread starter macrumors newbie

    Joined:
    Oct 18, 2009
    Location:
    Copenhagen
    #5
    Thank you, I will let you know if I figure it out, too save your time.
    I am not sure if the program will work on its own, since it should works together with program Radiance. Radiance is working fine on my mac.
    David
     
  6. Sander macrumors 6502

    Joined:
    Apr 24, 2008
  7. Apfik thread starter macrumors newbie

    Joined:
    Oct 18, 2009
    Location:
    Copenhagen
    #7
    I have just figure out how run the program. I found compiled version for mac and just copied it to /usr/local/bin
    However I still don't know what I did wrong with compiling.
    I guess that MSDOS does not have to be defined, I thing there is version for windows and mac (unix).
    Thank you very much for you time and help.
    David
     
  8. Bill McEnaney macrumors 6502

    Joined:
    Apr 29, 2010
    #8
    David, what happens after you replace your makefile's CFLAGS line with this one?
    Code:
    CFLAGS 	= -g -fnested-functions -DPICT_GLARE -DFLOAT=double -O3 $(DEBOPT) -Wall
    I'm suggesting the change because I found the nested function on about line 87 in pictools.c.
     
  9. Apfik thread starter macrumors newbie

    Joined:
    Oct 18, 2009
    Location:
    Copenhagen
    #9
    Hello again,
    I think that this worked and compiled the program.
    Thank you
     
  10. Bill McEnaney macrumors 6502

    Joined:
    Apr 29, 2010
    #10
    Congratulations, David. You solved your problem.
     

Share This Page