I first became insterested when I saw Youtube videos of GCbasics ability to compile code for the LGT8f32p and i decided to check GCBASIC out. This was months ago as compliling GCC was put on the back burner. Now i have tried to comple GCbasic v0_96_06 along with FBC 1.06, but even after updating the bulld.sh file, i cannot get it to successfuly compile. can I please get help?
Just in case you are still reading this. The problem with the "Indirect Goto" errors is that freebasic is using the Apple version of Gcc to compile the gcbasic.bas code into the macOS assembly and final executable file. You need to ensure that the Apple Gcc is "replaced" by the Free Software Foundation version of Gcc.
The problem with this is that if you actually use XCode to develop programs or Apps on the Mac that might use or need the Apple version, replacing it with another could cause XCode to fail.
There may be a way of temporarily redirecting freebasic to the Free Software Foundation version by using something like:
$export PATH ... {path to alternate Gcc here}
from within the compile shell script, but that is way beyond my capabilities.
I have always installed the XCode command line tools, then deleted the files and aliases that point to the Apple Gcc finally copied back in the Free Software Foundation files. Then copied and pasted the assembler "as" and linker(?) "ld" into the various folders until freebasic compiles gcbasic without any errors. This is a somewhat hit and miss affair as I'm not certain what I'm doing! I have managed it, and have written some notes (below) on how I did this, but can't be certain that they will work for you.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
If this has already been solved on a previous post, I apologize, but i have tried finding past posts but have not been able to solve my issue. Whether this is due to my lack of familiarity, idk.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
If that is suitable, I could email you a copy if you PM me? If it isn't suitable, if someone can extract the sources from the .exe file, I could try and compile it for you? I have Mojave, so can't promise it will suit Catalina. Trev made a full installer for macOS which should be your first step if you haven't installed it already. It isn't the most recent version, and won't have support for the LGT device, but should get most things into roughly the right location for you.
I have written some notes, but they may not be of much help!
Have you managed to get FreeBasic installed?
If you run FreeBasic from a Terminal window, do you get a response from it?
Have you got the full XCode package installed? If so, this may cause problems.
My notes:
HowIcompiledGCBfortheMac.IfyouhavethefullXCodepackageinstalled,youmayrunintoproblems.I'd suggest you don'tdoanyofthiswithoutsignificantknowledgeofwhatyouaredoing.Downloadfbc-1.06-darwin-wip20160505.tar.bz2Thisislocatedat:http://tmc.castleparadox.com/temp/fbc-1.06-darwin-wip20160505.tar.bz2Downloadthecurrentversionofgcc.Downloadthecurrent"Linux"buildversionofGCB.Thisisapasswordprotected.rarfile.Kekamayberequiredtoopenthisfile,thepasswordisGCB.DownloadtheXCodecommandLinetoolsfortheversionofmacOSinuse.Installthis.Unzip,UnRARorUnTarallotherdownloadedfiles.Navigateto:/Library/Developer/CommandLineTools/usr/binDeletethegccfile.Navigateto:/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/libCopyallfileswhichstartwith"crt1".Copytheminto:/Library/Developer/CommandLineTools/usr/binCopythefiles:as,cc1from/Users/mkstevo/.Trash/gcc-9.2NavigatetotheGCC-9.2(oryourversionoftheGCCfiles)folderwhichyouextractedearlier.Locatethe/gcc-9.2/binfolderandrenamethex86_64-apple-darwin18.7.0-gcc-9.2filetogccCopythisrenamedfileinto/Library/Developer/CommandLineTools/usr/bin*Maynotberequired?*Copythefiles:as,cc1*from/gcc-9.2/libexec/gcc/x86_64-apple-darwin18.7.0/9.2.0*into/Library/Developer/CommandLineTools/usr/binOpenaterminalcommandwindow.Type:gcc--versionYoushouldseesomethinglike:gcc(GCC)9.2.0Copyright(C)2019FreeSoftwareFoundation,Inc.Thisisfreesoftware;seethesourceforcopyingconditions.ThereisNOwarranty;notevenforMERCHANTABILITYorFITNESSFORAPARTICULARPURPOSE.IfthisreturnsanApplecopyrightnotice,thensomethinghasgonewrong.Iwouldsuggestdeletingany/Library/Developer/CommandLineToolsfoldersandstartingagain.IfyouhavethefullXCodepackageinstalled,youmayrunintoproblems.Navigateto:/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/libCopyallfileswhichstartwith"crt1".Copytheminto:theFreeBasicfolderyouextractedearlier:/fbc-1.06/lib/freebasic/darwin-x86_64/EdittheShellscriptfromwithintheGreatCowBasicsourcefolder:/sources/darwinbuild/build.shThisonlyneedsthelinesaslistedbelow:#!/bin/sh##v1.01-Updatedfilepathsfornewarchivelayout#echoecho"Compiling Great Cow BASIC for macOS with FreeBASIC"echo#FreeBASIChasahardcodedOStargetversion;thisneedstomatchbelow#oryouwillgetalinkererrorsimilartothefollowing:#ld:warning:objectfile(gcbasic.o)wasbuiltfornewerOSXversion(10.13)thanbeinglinked(10.1)exportMACOSX_DEPLOYMENT_TARGET=10.4#Nowcompile!##CorrectthepathforyourFreeBASICversionandlocation/Users/mkstevo/GCB_Mac/Sources/fbc-1.06/bin/fbc-exx-v-archnative/Users/mkstevo/GCB_Mac/Sources/GreatCowBasicSource/sources/gcbasic.basechoecho"Finished"echoEditthepathsothatitpointstoyourFreeBasicfolder,andtheGreatCowBasicsourcesfolder.Saveanychanges.Returntotheterminalandmakethisscriptexecuteable:chmod-x/Users/mkstevo/GCB_Mac/Sources/GreatCowBasicSource/sources/darwinbuild/build.shFinally,itistimetoseeifthisworks.Returntotheterminalanddragthebuild.shscriptintoit,pressenterandhopeallgoeswell.Ifitdoesnot,tryanddeterminewhereyouhavegonewrong.Missinglibrariescanusuallybecuredbylocatingtheminthegccfoldersandcopyingtheminto:/Library/Developer/CommandLineTools/usr/binSomemissinglibrariescanbefoundinthe/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/libfolder.Againcopytheminto:/Library/Developer/CommandLineTools/usr/binIfyoustillgeterrors,trycopyingthemissingfilesintotheFreeBasicfolder:/fbc-1.06/lib/freebasic/darwin-x86_64/MakesurethattheGreatCowBasicsourcesfoldercontains:gcbasic.basassembly.bipreprocessor.biutils.bivariables.biafolder:/darwinbuild/containingbuild.shAssumingthecompilationcompletedsuccessfully,youshouldbeleftwithafilecalledgcbasicThiscandroppedintoterminaltoseeifitwassuccessful.Itshouldshowsometextdescribinghowtousethefile.Thisstarts:GreatCowBASIC-ABASICcompilerformicrocontrollersVersion:0.98.062019-06-12(Darwin64bit)Congratulations.Let'shaveacelebration!
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
@jesus also get latest rc version. The lgt328 is supported well but there maybe the author
needs to test it more, so still in release candidate.
I'm using compiler version: 0.98.07 RC36....win 64bit.
I seem to get gcb stuff from github.
Anobium could explain.
Glad someone else is interested in lgt328 :)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Well, that was an afternoon of frustration! I have previously managed to compile GCB for macOS and had everything set up. In order to help Jesus I tried downloading the current build (RC42) and compiling it. Failed. I knew why, since I last did this I have had some horrendous problems with my iMac failing repeatedly to boot. Long story short, I partitioned the drive in two and installed the OS on one partition with my user account and "stuff" on the other. This meant that I could reinstall (and reinstall, and reinstall...) the OS without wiping my data. This left me with a few problems, usually relating to the paths to my user account. However, macOS now assumes I don't have the developer tools command line utilities installed and I've had to go through my list of (inaccurate) instructions again. Three hours later and I'm good to go.
Initially I got an error when compiling RC42:
gcbasic.bas(15046) error 3: Expected End-of-Line, found '/' in '//not supported'
Looking at line 15046 I found:
#IFDEF __FB_UNIX__ //not supported#ELSE
I assumed that "//not supported" was a comment and so used an apostrophe to comment out the comment...
Then things looked much brighter. The compile, build and link then completed.
Running the new gcbasic executeable in Terminal produced this:
I will sort the // in the source for the next release. What I need is a MAC user who is willing to test the MPLABX-PIC-AS software... then, we can sort for the MAC users.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I have a pathological hate of MPLab and all that it incorporates! That's what got me started with GCB.
If PIC-AS is useable on macOS without me needing to install all, or part, of MPLabX (i.e. it is just a standalone executeable with few dependancies) I may be willing to have a look. I'm not sure what PIC-AS is, what it offers, what it does and why I do (or don't) need it.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
If I understand your reply, by compiling using PIC-AS would allow simulation of a program, within MPLabX? I guess that compiling using the GCB assembler doesn't allow this? A simulator would be an enormous help for me. Although I have built some test panels that have the common "bits 'n' bobs" I usually need, or connections for them on it. That means I can quickly knock up a prototype for testing code. Then I write, test, rewrite, retest, rewrite, retest, hone into shape, rewrite, retest, refine, done! Not the best use of my time, but it's how my brain works.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Yes. You can walk the code in MPLAB-X simulator. The reason for the PIC-AS capability is to resolve bugs in the core compiler/libraries using the MPLAB-X simulator.
Hugh does have a Great Cow BASIC simulator but it is not as robust as MPLAB-X simulator.
Re the method. Your method works. And, MPLAB-X simulator is only there for really hard issues where your method does not work. :-)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Is the simulator Hugh has available for end users? I could really use something like that. Robust or not.
My method "works" well enough for me. It suits my scattered thought patterns well. Fortunately the OTP devices are almost as old as I am, and just as rare. EeProm based devices are more suited to my approach.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Take a look at PICSimLab that is what I use but I am not sure if it will work on Mac. https://sourceforge.net/projects/picsim/
The Prof, who created it for his University courses, is very good and quick at fixing bugs if you find any.
Last edit: Chris Roper 2021-02-28
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I can't get it to run under WINE. I will give it a try once I get the super cheap laptop out. I thought I had looked at it before but dismissed it as {I thought} it didn't cover the devices I used most often, 16F1825/29 and 12F1840.
Thanks for the suggestion.
Last edit: mkstevo 2021-02-28
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Just had a look at the "online" version. It does not seem to cover the devices I tend to use, that's a pity. It also looks as though it is permanently wired to the development board configuration.
OshonSoft PIC16 emulator does simulate (almost) all of the devices I use, and I've nearly been tempted to buy it on more than a few occasions. The one thing that stops me is the hard coded ports for the LCD. I've politely asked if the LCD module could have moveable "connections" and each time Vladimir has replied that this change is imminent, but it hasn't happened yet as far as I can tell.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi all,
I first became insterested when I saw Youtube videos of GCbasics ability to compile code for the LGT8f32p and i decided to check GCBASIC out. This was months ago as compliling GCC was put on the back burner. Now i have tried to comple GCbasic v0_96_06 along with FBC 1.06, but even after updating the bulld.sh file, i cannot get it to successfuly compile. can I please get help?
Just in case you are still reading this. The problem with the "Indirect Goto" errors is that freebasic is using the Apple version of Gcc to compile the gcbasic.bas code into the macOS assembly and final executable file. You need to ensure that the Apple Gcc is "replaced" by the Free Software Foundation version of Gcc.
The problem with this is that if you actually use XCode to develop programs or Apps on the Mac that might use or need the Apple version, replacing it with another could cause XCode to fail.
There may be a way of temporarily redirecting freebasic to the Free Software Foundation version by using something like:
$export PATH ... {path to alternate Gcc here}
from within the compile shell script, but that is way beyond my capabilities.
I have always installed the XCode command line tools, then deleted the files and aliases that point to the Apple Gcc finally copied back in the Free Software Foundation files. Then copied and pasted the assembler "as" and linker(?) "ld" into the various folders until freebasic compiles gcbasic without any errors. This is a somewhat hit and miss affair as I'm not certain what I'm doing! I have managed it, and have written some notes (below) on how I did this, but can't be certain that they will work for you.
incase this helps, a screenshot of the build.sh file
If this has already been solved on a previous post, I apologize, but i have tried finding past posts but have not been able to solve my issue. Whether this is due to my lack of familiarity, idk.
Also, I currently have Catalina installed [10.15.6]
For LGT support you will need a 0.98.07 as a minimum.
See the files tab for the release candidate software.
hmm, I will try that version now. Thank you,
Is this file only available as a .exe file?
I have a Mac binary for 0.98.07 RC09.
If that is suitable, I could email you a copy if you PM me? If it isn't suitable, if someone can extract the sources from the .exe file, I could try and compile it for you? I have Mojave, so can't promise it will suit Catalina. Trev made a full installer for macOS which should be your first step if you haven't installed it already. It isn't the most recent version, and won't have support for the LGT device, but should get most things into roughly the right location for you.
I have written some notes, but they may not be of much help!
Have you managed to get FreeBasic installed?
If you run FreeBasic from a Terminal window, do you get a response from it?
Have you got the full XCode package installed? If so, this may cause problems.
My notes:
Let me put a new Linus distro in Release Candidates. It will be RC41
I just saw this message, I will check it out
@jesus also get latest rc version. The lgt328 is supported well but there maybe the author
needs to test it more, so still in release candidate.
I'm using compiler version: 0.98.07 RC36....win 64bit.
I seem to get gcb stuff from github.
Anobium could explain.
Glad someone else is interested in lgt328 :)
Well, that was an afternoon of frustration! I have previously managed to compile GCB for macOS and had everything set up. In order to help Jesus I tried downloading the current build (RC42) and compiling it. Failed. I knew why, since I last did this I have had some horrendous problems with my iMac failing repeatedly to boot. Long story short, I partitioned the drive in two and installed the OS on one partition with my user account and "stuff" on the other. This meant that I could reinstall (and reinstall, and reinstall...) the OS without wiping my data. This left me with a few problems, usually relating to the paths to my user account. However, macOS now assumes I don't have the developer tools command line utilities installed and I've had to go through my list of (inaccurate) instructions again. Three hours later and I'm good to go.
Initially I got an error when compiling RC42:
gcbasic.bas(15046) error 3: Expected End-of-Line, found '/' in '//not supported'
Looking at line 15046 I found:
I assumed that "//not supported" was a comment and so used an apostrophe to comment out the comment...
Then things looked much brighter. The compile, build and link then completed.
Running the new gcbasic executeable in Terminal produced this:
I then copied the directory over the top of my "old" installation, loaded up Geany and compiled my Eiffel Tower Clock code:
So. If you would like a compiled binary for macOS (I'm using Mojave) of RC42, I could let you have one.
Well done!! Well done.
I will sort the // in the source for the next release. What I need is a MAC user who is willing to test the MPLABX-PIC-AS software... then, we can sort for the MAC users.
I have a pathological hate of MPLab and all that it incorporates! That's what got me started with GCB.
If PIC-AS is useable on macOS without me needing to install all, or part, of MPLabX (i.e. it is just a standalone executeable with few dependancies) I may be willing to have a look. I'm not sure what PIC-AS is, what it offers, what it does and why I do (or don't) need it.
LOL - I will just sort the issue with the source. When someone wants to use the capability under MAC OS, then, we can address at that point.
You dont need MPLAB-X to make is work, but, to see your program in the MPLAB-X simulator ... you need the ful MPLAB-X. :-)
If I understand your reply, by compiling using PIC-AS would allow simulation of a program, within MPLabX? I guess that compiling using the GCB assembler doesn't allow this? A simulator would be an enormous help for me. Although I have built some test panels that have the common "bits 'n' bobs" I usually need, or connections for them on it. That means I can quickly knock up a prototype for testing code. Then I write, test, rewrite, retest, rewrite, retest, hone into shape, rewrite, retest, refine, done! Not the best use of my time, but it's how my brain works.
Yes. You can walk the code in MPLAB-X simulator. The reason for the PIC-AS capability is to resolve bugs in the core compiler/libraries using the MPLAB-X simulator.
Hugh does have a Great Cow BASIC simulator but it is not as robust as MPLAB-X simulator.
Re the method. Your method works. And, MPLAB-X simulator is only there for really hard issues where your method does not work. :-)
Is the simulator Hugh has available for end users? I could really use something like that. Robust or not.
My method "works" well enough for me. It suits my scattered thought patterns well. Fortunately the OTP devices are almost as old as I am, and just as rare. EeProm based devices are more suited to my approach.
Take a look at PICSimLab that is what I use but I am not sure if it will work on Mac.
https://sourceforge.net/projects/picsim/
The Prof, who created it for his University courses, is very good and quick at fixing bugs if you find any.
Last edit: Chris Roper 2021-02-28
I can't get it to run under WINE. I will give it a try once I get the super cheap laptop out. I thought I had looked at it before but dismissed it as {I thought} it didn't cover the devices I used most often, 16F1825/29 and 12F1840.
Thanks for the suggestion.
Last edit: mkstevo 2021-02-28
The latest release has increased the number of Supported Devices but not sure if it includes your preferences.
There is a web based version you can try:
https://lcgamboa.github.io/
Not sure how good it is though as I only use the Latest Windows Copy.
Just had a look at the "online" version. It does not seem to cover the devices I tend to use, that's a pity. It also looks as though it is permanently wired to the development board configuration.
OshonSoft PIC16 emulator does simulate (almost) all of the devices I use, and I've nearly been tempted to buy it on more than a few occasions. The one thing that stops me is the hard coded ports for the LCD. I've politely asked if the LCD module could have moveable "connections" and each time Vladimir has replied that this change is imminent, but it hasn't happened yet as far as I can tell.