Menu

'How To' Create a Linux version of the Great Cow Basic Compiler?

Help
2016-01-02
2016-01-04
  • T. Lee Davidson

    T. Lee Davidson - 2016-01-02

    The Great Cow Basic home page (http://gcbasic.sourceforge.net/) mentions, in the latest news of 28/12/2015, an added ‘how to’ - Create a Linux version of the Great Cow Basic Compiler. But, it does not mention where this particular 'how to' might be found.

    I have tried to find the gcbasic.bas source code so that I can compile it with FreeBasic v1.0. However, all of the download links on the Downloads page (http://gcbasic.sourceforge.net/download.html) and those at https://sourceforge.net/projects/gcbasic/files/ (except for the various support files) are for Windows executables. I downloaded two of them (Core and Minimal), executed them with Wine, and neither of them contains the gcbasic.bas source code.

    The 'update' file (http://gcbasic.sourceforge.net/newfiles/update.zip) is dated 16-Feb-2014.

    I am very eager to start using GCB. Please tell me:
    1. Where I might find that probably quite handy 'how to' for a Linux version of the compiler, or
    2. Where I might find the gcbasic.bas source code.

    I should probably add that I did a search of the forum, and all posts I found referring to this type of issue are, like, two years old.

    Thank you for any guidance.

    Lee

     
    • T. Lee Davidson

      T. Lee Davidson - 2016-01-04

      EDIT (2016-02-11): Please do not use the following instructions. They have been superceded by instructions more proper for Linux. Instead, please use the instructions you'll find in the Online Help. Scroll all the way down to the bottom on the left side, and under "GCBasic for Linux", click "Overview".

      ---------- Old outdated instructions. Do not use. ----------
      After gaining more information and sources (thanks Anobium), I am going to summarize the process of:
      'How To Create a Linux version of the Great Cow Basic Compiler'

      I will diverge from the instructions found at http://gcbasic.sourceforge.net/help/ > GCBasic for Linux ( http://gcbasic.sourceforge.net/help/lunixoverview.htm ), starting at Step 3. The primary reasons for this are:
      1. Extracting to a root-owned directory must be done with root privileges, and I prefer to use my graphical file manager as opposed to the command line.
      2. Compiling should not be done as 'root', and file permissions make it very difficult to create a compiled file in what should be a root-owned directory, and
      3. The extra steps I included make it easier to develop in a directory other than the GCBasic install directory.

      So, follow Steps 1 and 2, and then (#1 below should be Step 3, thanks SourceForge):

      1. Unrar the GreatCowBasic distribution into a subdirectory where you downloaded it.
        Note: The tools in G+Stools cannot be used on a Linux system. That directory can be deleted. (Note: Per Anobium's reply immediately below, it is recommended to not delete the G+Stools directory.)

      2. In a console from within the unpacked directory, cd to the directory containing the GreatCowBasic source files:
        cd GreatCowBasic/Sources/GCBASIC

      3. Compile the GreatCowBasic compiler:
        You can determine the architecture of your machine with 'uname -p' or 'lscpu'.
        Replace "<arch>" in the command below with the appropriate value.
        (See http://www.freebasic.net/wiki/wikka.php?wakka=CompilerOptarch for the available architecture options.)</arch>

        Execute: fbc -exx -v -arch <arch> gcbasic.bas</arch>

      4. If no error occurs, you've successfully compiled the GCBasic compiler.
        Confirm proper execution and the version of GCBASIC by executing:
        ./gcbasic -v

      5. Move your new "gcbasic" executable file to the GreatCowBasic parent directory:
        mv gcbasic ../..
        cd ../.. (cd back to the GreatCowBasic parent directory)

        You can now delete the Sources directory, if you wish, before you do the 'mv' below.

      6. Modify "sample gcbasic.ini" to suit your preferences and rename it to "gcbasic.ini".
        (Note: If you wish to set "WorkingDir" to a directory in your Home directory, keep in mind that you cannot use "~" as a HOME wildcard. GCBasic does not understand it.)

      7. Move the GreatCowBasic directory to /opt (you'll need root priveleges):
        cd .. (cd to the parent of the GreatCowBasic directory, then)
        [sudo] mv GreatCowBasic /opt/

        (Note: Giving GCBasic a home in /opt is in compliance with the Linux Filesystem Hierarchy Standard.)

      8. Install the helper scripts (attached) in "~/bin" (preferred) or "/usr/local/bin".

      9. Verify that you can execute gcbasic no matter what directory you are in.
        (You may need to add "~/bin" or "/usr/local/bin" to your PATH.)

      For PIC programming: I don't use PICs, but I'm fairly sure you'll need a PIC-compatible programmer. You might find what you need at:
      http://www.microchip.com/DevelopmentTools/ProductDetails.aspx?PartNO=pg164120

      For AVR programming: You'll need "avrdude". It should be available in your distributions repository. If not, check here: http://www.nongnu.org/avrdude/

      I hope that helps my fellow Linux users. If you have any questions, I'll try to answer them as I am able.

      Lee

      P.S. I have not tested either of the attached 'flash' helper scripts. You may well need to edit them to suit your environment and tools.

       

      Last edit: T. Lee Davidson 2016-02-11
      • Anobium

        Anobium - 2016-01-04

        One point. Do not delete the G+Stools directory, there are things in there that are very useful.

        I am writing a pre-processor in AWK that will pre-processor the source file and support the compiler in terms of validation etc. The pre-processor should be execute prior to compiling and you can check the exitcode and the generated logs for errors etc.

        See the MAKEHEX.BAT for use in the MS-DOS environment.

        I nearly removed the folder... before I thought... why did i add to the distribution....... pre-processor!!

         
        • T. Lee Davidson

          T. Lee Davidson - 2016-01-04

          Point taken, Anobium. I have edited the post of instructions to include a note regarding your recommendation.

           
  • Anobium

    Anobium - 2016-01-02

    I will create and post a Linux distribution tomorrow. This will ensure you havr the latest supported release package.

    Thanks for info on other matters. I have made some changes to address this feedback.

    Anobium

     
  • Anobium

    Anobium - 2016-01-03

    Just posted a build. See https://sourceforge.net/projects/gcbasic/files/GCBasic%20-%20Sources/

    Please read the message displayed in the folder, you will need this information. Others will be able to respond to questions with respect the Linux build process.

    Anobium

     
  • T. Lee Davidson

    T. Lee Davidson - 2016-01-04

    I notice that you posted that up earlier, Anobium. That's great! Thank you.

    I have compiled a set of instructions that are a bit more Linux-oriented than the ones at:
    http://gcbasic.sourceforge.net/help/ > GCBasic for Linux
    (http://gcbasic.sourceforge.net/help/lunixoverview.htm)

    I will be posting those separately.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.