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
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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):
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.)
In a console from within the unpacked directory, cd to the directory containing the GreatCowBasic source files:
cd GreatCowBasic/Sources/GCBASIC
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>
If no error occurs, you've successfully compiled the GCBasic compiler.
Confirm proper execution and the version of GCBASIC by executing:
./gcbasic -v
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.
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.)
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.)
Install the helper scripts (attached) in "~/bin" (preferred) or "/usr/local/bin".
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 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
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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!!
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
See the Help for the overview of the Linux build process. The online Help is here - http://gcbasic.sourceforge.net/help/ See the last entry on the left hand page.
And, I did look at the Help: http://gcbasic.sourceforge.net/help/ . Apparently, I did not scroll down far enough. I looked in "Introducing Great Cow BASIC" and "Using GCBASIC" thinking that would be the logical location for information on using GCBasic on Linux. Perhaps a note in there informing one to scroll down would be helpful.
Step 2 in the "GCBasic for Linux" section says, "Download the GreatCowBasic package with source code from SourceForge."
For a SourceForge dummy, would that be done by going to the link given and clicking the "Download Snapshot" link?
And, since SourceForge does not appear to give any version information, how would one verify that the recommended version (ie. v.95.002) is being used?
Thank you for the awesome help :-)
Lee
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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
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):
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.)
In a console from within the unpacked directory, cd to the directory containing the GreatCowBasic source files:
cd GreatCowBasic/Sources/GCBASIC
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>
If no error occurs, you've successfully compiled the GCBasic compiler.
Confirm proper execution and the version of GCBASIC by executing:
./gcbasic -v
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.
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.)
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.)
Install the helper scripts (attached) in "~/bin" (preferred) or "/usr/local/bin".
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
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!!
Point taken, Anobium. I have edited the post of instructions to include a note regarding your recommendation.
Good questions.
See https://sourceforge.net/p/gcbasic/discussion/629990/thread/69f52973/ for the 2015 discussion on Linux.
See the Help for the overview of the Linux build process. The online Help is here - http://gcbasic.sourceforge.net/help/ See the last entry on the left hand page.
See here for the complete distribution. https://sourceforge.net/p/gcbasic/code/HEAD/tree/GCBASIC/trunk/ the source .bas is located here https://sourceforge.net/p/gcbasic/code/HEAD/tree/GCBASIC/trunk/gcbasic.bas
I strongly recommend you use the v.95.002 (I will release v.95.003 in the next few days) as your starting point for all Linux builds.
I have removed http://gcbasic.sourceforge.net/newfiles as this is not the newfiles. Please use the https://sourceforge.net/projects/gcbasic/files/ as your source for general distributions. I think I should have removed in the past to clarify the download locations.
Hope this helps.
Anobium
Thank you for the answers, Anobium. Very informative.
I have just a couple comments and two more questions.
I did find the https://sourceforge.net/p/gcbasic/discussion/629990/thread/69f52973/ thread. But, it is primarily about a GCBasicIDE for Linux. There is a web page referenced there for "Procedures for gcbasic work on linux" that subsequently references:
http://downloads.sourceforge.net/gcbasic/GCBASIC_zip_0930.zip , and
http://gcbasic.sourceforge.net/newfiles/update.zip . That's what led me to "newfiles".
And, I did look at the Help: http://gcbasic.sourceforge.net/help/ . Apparently, I did not scroll down far enough. I looked in "Introducing Great Cow BASIC" and "Using GCBASIC" thinking that would be the logical location for information on using GCBasic on Linux. Perhaps a note in there informing one to scroll down would be helpful.
Step 2 in the "GCBasic for Linux" section says, "Download the GreatCowBasic package with source code from SourceForge."
For a SourceForge dummy, would that be done by going to the link given and clicking the "Download Snapshot" link?
And, since SourceForge does not appear to give any version information, how would one verify that the recommended version (ie. v.95.002) is being used?
Thank you for the awesome help :-)
Lee
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
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
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.