Loading ...
Sorry, an error occurred while loading the content.

Re: Setting the INCLUDE environment variable

Expand Messages
  • ipscone
    Bear with me on these laborous questions (below) ... to use ... variable, ... Thanks, I was wondering if that method was a DOS/Windows thing. I m a windows
    Message 1 of 7 , May 1, 2008
    • 0 Attachment
      Bear with me on these laborous questions (below)

      --- In gnu-m68hc11@yahoogroups.com, Triffid Hunter
      <triffid_hunter@...> wrote:
      >
      > On Wed, 30 Apr 2008, ipscone wrote:
      >
      > So, my problem is in setting the INCLUDE environment varialbe.
      > > I have tried many different ways of doing this and non allow me
      to use
      > > the include as "#include <sys/sio.h>" location.
      >
      > Last time I checked, includes weren't set with an environment
      variable,
      > instead being passed something like this:
      > m68hc1x-gcc -I/path/to/include -Wall -o output source.c
      >

      Thanks, I was wondering if that method was a DOS/Windows thing. I'm
      a windows user with very little experience in the *nix world. Even
      the make files thing is new to me. I'm used to an IDE with one
      install that sets up everything for me. Yeah spoiled. :)

      I have Cygwin installed from another dev. system and am trying to
      use that installation. I assume I can use it with more than one
      dev system, as long as all the programs and environment variables
      are kept seperate. So far it seems to be working ok.

      I am trying to use the make files to build the GEL examples, to test
      and see if my setup is correct. So let me elaborate on what I have
      done and ask some additional questions along the way. Might get
      windy. ;)

      I installed the gnu-68hc1x-3.1.exe, for the 68HC11/12. There wasn't
      really much direction on doing this so I made some assumptions. The
      install used c:\usr for a default and I just left it at that. So my
      compiler went here:
      c:\usr
      c:\usr\bin
      c:\usr\lib
      c:\usr\lib\gcc-lib
      c:\usr\lib\gcc-lib\m6811-elf
      c:\usr\lib\gcc-lib\m6811-elf\3.3.6-m68hc1x-20060122
      c:\usr\lib\gcc-lib\m6811-elf\3.3.6-m68hc1x-20060122\cc1.exe
      c:\usr\lib\gcc-lib\m6811-elf\3.3.6-m68hc1x-20060122\cc1plus.exe
      c:\usr\lib\gcc-lib\m6811-elf\3.3.6-m68hc1x-20060122\collect2.exe
      c:\usr\lib\gcc-lib\m6811-elf\3.3.6-m68hc1x-20060122\crt1.o
      c:\usr\lib\gcc-lib\m6811-elf\3.3.6-m68hc1x-20060122\fshort-double
      c:\usr\lib\gcc-lib\m6811-elf\3.3.6-m68hc1x-20060122\include
      c:\usr\lib\gcc-lib\m6811-elf\3.3.6-m68hc1x-20060122\libgcc.a
      c:\usr\lib\gcc-lib\m6811-elf\3.3.6-m68hc1x-20060122\m68hc12
      c:\usr\lib\gcc-lib\m6811-elf\3.3.6-m68hc1x-20060122\mlong-calls
      c:\usr\lib\gcc-lib\m6811-elf\3.3.6-m68hc1x-20060122\mshort
      ** there were some other files in subdirectories but you get the
      picture
      c:\usr\m6811-elf
      c:\usr\m6811-elf\bin
      c:\usr\m6811-elf\lib
      c:\usr\m6811-elf\include\
      c:\usr\m6811-elf\include\stdio.h
      c:\usr\m6811-elf\include\sys\stdio.h
      c:\usr\man

      Some of the questions I am going to ask, might be slightly
      different, considering the second installation of the Gel files so
      it might help to read everything here, before answering. Thanks,

      Questions:
      1) I assumed this location would be acceptable. I wondered if it
      might be expected to be somewhere in the Cygwin path but not having
      any instructions to place it, I just took the default of c:\usr.
      Is that an acceptable place for the compiler?

      2) Like I said, I'm using a Windows XP system with Cygwin as my *nix
      shell to execute the make files, in the Gel examples.

      So, with that in mind, how does one set the pointers, pathes and/or
      environment varialbles to make sure that the compiler can find all
      the includes and executables it needs? Is this done in DOS batch
      files (I ask this because my cygwin installation uses a batch files
      for some variables). I did set the path to make sure the c:\usr\bin
      folder was in the path and that allowed the compiler to work, using
      the make file. Or should some of these pointers be set in the
      Makefile?

      3) I also noticed there is a cc1.exe file deep down in the lib
      path. I ask this question because one of the other errors I was
      getting was that "cc1 could not be found", when I was trying to
      compile some of the gel libraries (got a bit ahead of myself there).
      How are these files located by the compiler?

      4) I also noticed there is no include folder nor any header files.
      Perhaps this is normal. And there are some in the example files.
      But I would have thought there would have been some standard header
      files included with the compiler. Should there be include folder at
      the same level as the bin folder?

      However, there is an include folder under the m6811-elf sub-folder.
      It has include, lib and bin also, with the prefix stripped. So, it
      would seem these would be ok to use over the other bin files,
      however, the GEL examples below seem to prefer the top level bins.
      Problem with that is there are no includes at that level.

      -------------

      After I got the compiler installed, I installed the GEL examples.
      Again, no real direction on where they should go, so I put them in
      their own directory:
      c:\gel-hc1x-1.6.1
      c:\gel-hc1x-1.6.1\config
      c:\gel-hc1x-1.6.1\doc
      c:\gel-hc1x-1.6.1\examples
      c:\gel-hc1x-1.6.1\hello
      c:\gel-hc1x-1.6.1\include
      c:\gel-hc1x-1.6.1\include\imath.h
      c:\gel-hc1x-1.6.1\include\inttypes.h
      c:\gel-hc1x-1.6.1\include\iso646.h
      c:\gel-hc1x-1.6.1\include\lcd.h
      c:\gel-hc1x-1.6.1\include\limits.h
      c:\gel-hc1x-1.6.1\include\stdio.h
      c:\gel-hc1x-1.6.1\include\stdlib.h
      c:\gel-hc1x-1.6.1\include\time.h
      * there were additional files in include but you get the structure
      c:\gel-hc1x-1.6.1\include\asm-m68hc11
      c:\gel-hc1x-1.6.1\include\asm-m68hc12
      c:\gel-hc1x-1.6.1\include\bot
      c:\gel-hc1x-1.6.1\include\gdm
      c:\gel-hc1x-1.6.1\include\gel
      c:\gel-hc1x-1.6.1\include\sys
      c:\gel-hc1x-1.6.1\include\sys\ports.h
      c:\gel-hc1x-1.6.1\include\sys\ctype.h
      c:\gel-hc1x-1.6.1\include\sys\sio.h
      * there were additional header files in sys but you get the structure
      c:\gel-hc1x-1.6.1\src
      c:\gel-hc1x-1.6.1\
      *There were other files but this is the basic directory tree
      structure

      Questions:
      1) There were a lot of include folders and files in these examples.
      Where should those be located? Is it acceptable to keep them where
      they were installed, or should they be at the same level as the
      compiler bin?

      2) How (or where) are the pointers to these needed files set?

      Example:

      I compiled the hello.c file and it compiled fine. Hello.c located
      here:
      http://www.msdsite.com/c/hello.c

      In the hello.c example in the GEL files, it has no #include
      directive. All of the defines and declarations are done in the
      file. But there is a note that the SIO defines are also available
      in the sys/sio.h file. So, I removed those declarations and include
      the include directory as:
      #include <sys/sio.h> and compiled again. This time I got the
      error, which is what I'm trying to solve now. The error was:
      hello.c:136:21: sys/sio.h: No such file or directory
      make: *** [hello.o] Error 1

      So my basic problem, so far, is not setting the pointers, paths or
      variables such that my compiler can find the includes it needs.

      Also, just as another test, I removed the #include <sys/sio.h> and
      included an include that I really didn't need to see if the same
      error would be reported. It was:
      #include <stdio.h> but this time, there was no error. So, it found
      that inlcuded file. I have many possible stdio.h, so I looked for
      the one it was finding. It turns out, it was finding the one that
      is located in:
      c:\usr\m6811-elf\include

      I determined that by renaming the file and it then produced the
      error. So the next thing I did was look into the c:\include\sys for
      the sio.h file. It was not there.

      Then, just to test a little further, I moved the sio.h to this sys
      folder and compiled again and it found the file. So it appears that
      the compiler can find the file, if it's in that location. I have
      not set any environment varialbe to find this location but somehow
      the compiler knows to look there. But I don't think it is necessary
      to move all these files. I think this is just a matter of setting
      the environment variables to make sure all the include paths can be
      searched. That is my problem.

      Questions:

      1) So, after having said all of this. And with the directory
      structure above, can someone explain where these variables are set
      to make sure all my search pathes are configured properly?

      2) Are these variables normally set in the Makefile?

      Here is the hello.c and make file I was using to compile the hello.c
      program
      http://www.msdsite.com/c/Makefile
      http://www.msdsite.com/c/hello.c

      3) Finally, in the two installations (compiler and examples) above,
      there are two sets of includes.
      One is in the c:\usr\m6811-elf\include folder
      and the other is in the gel-hc1x-1.6.1\include folder.

      Should these be merged? Or should there just be 2 pointers so that
      both pathes are searched? Again, where would one normally sepcify
      that, using the make files?
    • ipscone
      Followup: I found the answer. In looking at another example, I found the makefile had: SCRDIR=../ GEL_BASEDIR=$(SCRDIR) include
      Message 2 of 7 , May 1, 2008
      • 0 Attachment
        Followup:

        I found the answer. In looking at another example, I found the
        makefile had:

        SCRDIR=../
        GEL_BASEDIR=$(SCRDIR)
        include $(GEL_BASEDIR)/config/make.defs

        Then in the make.defs, I found an include like:
        include $(GEL_BASEDIR)/config/gel.defs

        And then in the gel.defs file, I found and entry like:

        #GEL public includes
        GEL_INCDIR=$(GEL_BASEDIR)/include
        GEL_INCLUDES=-I$(GEL_INCDIR)/asm-$(CPU)/arch-$(BOARD) -I$(GEL_INCDIR)

        So it appears that all this environment pointing is done in the
        makefile. In my example all I had to do was put:

        SCRDIR=../
        GEL_BASEDIR=$(SCRDIR)
        include $(GEL_BASEDIR)/config/make.defs

        in the makefile and it compiled without error. whew! I guess I
        better do a little studying on makefiles. ;)
      • said jello
        Hi, Did you succeed in compiling the GEL libraries? I would love to see how you did it, I tried unsuccessfully to do it for some time now, and I gave up at the
        Message 3 of 7 , May 1, 2008
        • 0 Attachment
          Hi,

          Did you succeed in compiling the GEL libraries? I would love to see how you did it, I tried unsuccessfully to do it for some time now, and I gave up at the end.

          Thanks

          ipscone <ipscone@...> wrote:
          Followup:

          I found the answer. In looking at another example, I found the
          makefile had:

          SCRDIR=../
          GEL_BASEDIR= $(SCRDIR)
          include $(GEL_BASEDIR) /config/make. defs

          Then in the make.defs, I found an include like:
          include $(GEL_BASEDIR) /config/gel. defs

          And then in the gel.defs file, I found and entry like:

          #GEL public includes
          GEL_INCDIR=$ (GEL_BASEDIR) /include
          GEL_INCLUDES= -I$(GEL_INCDIR) /asm-$(CPU) /arch-$(BOARD) -I$(GEL_INCDIR)

          So it appears that all this environment pointing is done in the
          makefile. In my example all I had to do was put:

          SCRDIR=../
          GEL_BASEDIR= $(SCRDIR)
          include $(GEL_BASEDIR) /config/make. defs

          in the makefile and it compiled without error. whew! I guess I
          better do a little studying on makefiles. ;)



          Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now.

        • ipscone
          ... see how you did it, I tried unsuccessfully to do it for some time now, and I gave up at the end. ... I m not sure this will help but one thing the
          Message 4 of 7 , May 1, 2008
          • 0 Attachment
            --- In gnu-m68hc11@yahoogroups.com, said jello <sjellouli@...> wrote:
            >
            > Hi,
            >
            > Did you succeed in compiling the GEL libraries? I would love to
            see how you did it, I tried unsuccessfully to do it for some time
            now, and I gave up at the end.

            ---------------------

            I'm not sure this will help but one thing the instructions didn't
            say anything about where the GEL libraries should be installed. I
            determined that the GEL library must be overlaid on the compiler.

            If you see my directory structure above, you will see that they are
            in two different directories trees. In the compiler tree, there is
            no "include" but there is a "lib" folder. And in the GEL top level,
            there is no "lib" but there is an "include" folder. This made me
            wonder if the two installations should be merged.

            I also found some of the header files that seemed to be trying to
            point to the "bin" folder, as if it was in the GEL tree. On a
            hunch, I copied all of the GEL folders to the root level of the
            compiler such that it looked like this:

            c:\usr\bin (was part of the comiler installation)
            c:\usr\include (was originally in the GEL library)
            c:\usr\lib (was part of the compiler installation)
            c:\usr\examples (was part of the GEL library)
            c:\usr\src (was part of the GEL library)

            etc. Previously the bin and lib were in entirely different trees
            and the make files depended on them being merged. Basically I just
            laid the GEL folders on top of the compiler folders (there was no
            overlap). After I did this, I went to the "src" folder and executed
            the make and it built all my libraries.
          • said jello
            Hi, Thank you very much, I will try this later, but if it worked for you, I am hoping it will also work for me. I appreciate your help. ... see how you did it,
            Message 5 of 7 , May 2, 2008
            • 0 Attachment
              Hi,
              Thank you very much, I will try this later, but if it worked for you, I am hoping it will also work for me.
              I appreciate your help.

              ipscone <ipscone@...> wrote:
              --- In gnu-m68hc11@ yahoogroups. com, said jello <sjellouli@. ..> wrote:
              >
              > Hi,
              >
              > Did you succeed in compiling the GEL libraries? I would love to
              see how you did it, I tried unsuccessfully to do it for some time
              now, and I gave up at the end.

              ------------ ---------

              I'm not sure this will help but one thing the instructions didn't
              say anything about where the GEL libraries should be installed. I
              determined that the GEL library must be overlaid on the compiler.

              If you see my directory structure above, you will see that they are
              in two different directories trees. In the compiler tree, there is
              no "include" but there is a "lib" folder. And in the GEL top level,
              there is no "lib" but there is an "include" folder. This made me
              wonder if the two installations should be merged.

              I also found some of the header files that seemed to be trying to
              point to the "bin" folder, as if it was in the GEL tree. On a
              hunch, I copied all of the GEL folders to the root level of the
              compiler such that it looked like this:

              c:\usr\bin (was part of the comiler installation)
              c:\usr\include (was originally in the GEL library)
              c:\usr\lib (was part of the compiler installation)
              c:\usr\examples (was part of the GEL library)
              c:\usr\src (was part of the GEL library)

              etc. Previously the bin and lib were in entirely different trees
              and the make files depended on them being merged. Basically I just
              laid the GEL folders on top of the compiler folders (there was no
              overlap). After I did this, I went to the "src" folder and executed
              the make and it built all my libraries.



              Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now.

            Your message has been successfully submitted and would be delivered to recipients shortly.