On the https://sourceforge.net/projects/gcbasic page I see under the download button "Windows Mac Linux" ... but there seems to be no information or binary download available for macOS (formerly OS X).
Ensure that the latest Xcode and command line tools are installed. Xcode is available from the App Store; the command line tools can then be installed separately with xcode-select --install.
Move gcc-8.1 to /usr/local/ and (using the Bourne shell - just type sh in a terminal) add it first in your path with export PATH=/usr/local/gcc-8.1/bin:$PATH (this will last until you exit the terminal, no permananet harm done).
You also need to setup the library and include path environament variables for the correct SDK version which, for the current High Sierra 10.13.6 are:
(i) export LIBRARY_PATH=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/lib and
(ii) export C_INCLUDE_PATH=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include
Edit the gcbasic source files to replace all occurrences of #IFDEF FB_LINUX with #IFDEF FB_UNIX (as some IFDEFs are mixed case, I just replaced LINUX with UNIX).
Yes, believe it or not, you can now successfully compile gcbasic with (acconting for the file path where you stashed FreeBASIC): ../fbc-1.06/bin/fbc -exx -v -arch native gcbasic.bas
I've run out of time to do a test compile and burn a hex tonight, but I'll report when I get time.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I had occasion to rebuild gcbasic.bas and found I'd left out one of the environment variable exports ... so here it is:
Step 6 (iii) export MACOSX_DEPLOYMENT_TARGET=10.4
It should be noted that this macOS version is dependent on the specific version of the FreeBASIC compiler which has -macosx_version_min hardcoded (in this case to 10.4).
To complete the tale, here's a shell script to do all of step 6 (except editing gcbasic.bas) for the latest High Sierra macOS 10.13.6 and Xcode v10 which bumped the SDK to 10.14 for the upcoming Mohave release:
1
2
3
4
5
6
7
8
9
#!/bin/shecho"Setup for compiling Great Cow BASIC with FreeBASIC"exportPATH=/usr/local/gcc-8.1/bin:$PATHexportLIBRARY_PATH=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/lib
exportC_INCLUDE_PATH=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include
exportMACOSX_DEPLOYMENT_TARGET=10.4
../../../fbc-1.06/bin/fbc -exx -v -arch native gcbasic.bas
With a little bit of luck, the next release of Great Cow BASIC might include a macOS binary installation to mnake all this academic for most.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I'm happy to report that gcbasic binary for macOS created in the previous post successfully compiles a modified version of first-start-sample.gcb for a PIC12F675 to flash a LED on GPIO.2.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
That is a comprehensive set of instructions there Trev. In a purely personal preference, I have been using Geany as my 'IDE' with a version of the GCB compiler that I managed to make and compile. I was using CudaText, but found it rather unstable on the Mac, but very beautiful. I switched to Geany which is less pretty, but rock solid. Perhaps due to me having had the XCode tools on my iMac for some time, I didn't need some of the steps outlined above.
I just wish I'd had access to your instructions back in May 2018, it took me ages to figure some of that out!
Trev, many thanks for sharing.
The CudaText image below shows an error with 'PreProcess.awk' not being found. This could be due to the paths to the files not being passed to the compiler correctly. I found CudaText required full, explicit paths to 'Include' files or they would not be located, Geany doesn't and I think this allows Geany to also locate the Pre-Processor files. You can't spot them in the Geany screenshot, but all the libraries are Pre-Processed normally as they are within Windows.
Geany and the Mac binary do compile quickly, but not so fast as to complete in the zero seconds claimed in the Geany screenshot above. Guess I've done something to the message parsing that has wiped the compile time somehow...
Last edit: mkstevo 2018-08-27
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I should add that any work that is required to get this working is well worth the effort. Having previously been running GCB and it's IDE under WINE, a compilation of even a trivial program could sometimes take close to two minutes . I did manage to speed things up quite a lot by forcing the compilation script and G+STools to skip some of the tests on the included libraries (which I detailed in a number of posts that outlined my steps to get GCB working under WINE) but it was still very slow.
The native Mac build increases the speed of compilation enormously over running it in WINE. With the compile and build process taking under 5 seconds for a program that took 45 - 50 seconds, with my fudge to G+STools I did that sped up compilation, 90 - 100 seconds otherwise under WINE.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I only use emacs because it's cross-platform and works the same everywhere. I've used it on many operating systems (Windows 3.1 onwards, Coherent, OS/2, Solaris, FreeBSD, macOS) over the years. The Great Cow BASIC syntax highlighting was also trivial to add to emacs.
I have not looked at integrating help... I simply have the searchable help file PDF permanantly open in another window (being new to GCB :-).
On the https://sourceforge.net/projects/gcbasic page I see under the download button "Windows Mac Linux" ... but there seems to be no information or binary download available for macOS (formerly OS X).
So the quest began.
Download the FreeBASIC macOS 10.4 binary compilation from: http://tmc.castleparadox.com/temp/fbc-1.06-darwin-wip20160505.tar.bz2
Download the GCB distribution from: https://sourceforge.net/projects/gcbasic/files/GCBasic%20-%20Linux%20Distribution/GCB%40Syn.rar/download
Ensure that the latest Xcode and command line tools are installed. Xcode is available from the App Store; the command line tools can then be installed separately with
xcode-select --install
.Unfortunately Apple replaced gcc with Clang and FreeBASIC needs the real gcc due to a certain obscure use of goto... so, you can compile your own version of gcc following the instructions at: https://bitbucket.org/sol_prog/macos-gcc-binary or you can take the low road and just download the pre-compiled binary version from https://bitbucket.org/sol_prog/macos-gcc-binary/raw/38724f2d24aa5b7944d2227d8098b1d30ac5d7b5/gcc-8.1.tar.bz2
Move gcc-8.1 to /usr/local/ and (using the Bourne shell - just type sh in a terminal) add it first in your path with
export PATH=/usr/local/gcc-8.1/bin:$PATH
(this will last until you exit the terminal, no permananet harm done).You also need to setup the library and include path environament variables for the correct SDK version which, for the current High Sierra 10.13.6 are:
(i)
export LIBRARY_PATH=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/lib
and(ii)
export C_INCLUDE_PATH=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include
Edit the gcbasic source files to replace all occurrences of #IFDEF FB_LINUX with #IFDEF FB_UNIX (as some IFDEFs are mixed case, I just replaced LINUX with UNIX).
Yes, believe it or not, you can now successfully compile gcbasic with (acconting for the file path where you stashed FreeBASIC):
../fbc-1.06/bin/fbc -exx -v -arch native gcbasic.bas
I've run out of time to do a test compile and burn a hex tonight, but I'll report when I get time.
I had occasion to rebuild gcbasic.bas and found I'd left out one of the environment variable exports ... so here it is:
Step 6 (iii) export MACOSX_DEPLOYMENT_TARGET=10.4
It should be noted that this macOS version is dependent on the specific version of the FreeBASIC compiler which has -macosx_version_min hardcoded (in this case to 10.4).
To complete the tale, here's a shell script to do all of step 6 (except editing gcbasic.bas) for the latest High Sierra macOS 10.13.6 and Xcode v10 which bumped the SDK to 10.14 for the upcoming Mohave release:
With a little bit of luck, the next release of Great Cow BASIC might include a macOS binary installation to mnake all this academic for most.
I'm happy to report that gcbasic binary for macOS created in the previous post successfully compiles a modified version of first-start-sample.gcb for a PIC12F675 to flash a LED on GPIO.2.
emacs on macOS with native macOS gcbasic:
That is a comprehensive set of instructions there Trev. In a purely personal preference, I have been using Geany as my 'IDE' with a version of the GCB compiler that I managed to make and compile. I was using CudaText, but found it rather unstable on the Mac, but very beautiful. I switched to Geany which is less pretty, but rock solid. Perhaps due to me having had the XCode tools on my iMac for some time, I didn't need some of the steps outlined above.
I just wish I'd had access to your instructions back in May 2018, it took me ages to figure some of that out!
Trev, many thanks for sharing.
The CudaText image below shows an error with 'PreProcess.awk' not being found. This could be due to the paths to the files not being passed to the compiler correctly. I found CudaText required full, explicit paths to 'Include' files or they would not be located, Geany doesn't and I think this allows Geany to also locate the Pre-Processor files. You can't spot them in the Geany screenshot, but all the libraries are Pre-Processed normally as they are within Windows.
Last edit: mkstevo 2018-08-27
Geany and the Mac binary do compile quickly, but not so fast as to complete in the zero seconds claimed in the Geany screenshot above. Guess I've done something to the message parsing that has wiped the compile time somehow...
Last edit: mkstevo 2018-08-27
I should add that any work that is required to get this working is well worth the effort. Having previously been running GCB and it's IDE under WINE, a compilation of even a trivial program could sometimes take close to two minutes . I did manage to speed things up quite a lot by forcing the compilation script and G+STools to skip some of the tests on the included libraries (which I detailed in a number of posts that outlined my steps to get GCB working under WINE) but it was still very slow.
The native Mac build increases the speed of compilation enormously over running it in WINE. With the compile and build process taking under 5 seconds for a program that took 45 - 50 seconds, with my fudge to G+STools I did that sped up compilation, 90 - 100 seconds otherwise under WINE.
I only use emacs because it's cross-platform and works the same everywhere. I've used it on many operating systems (Windows 3.1 onwards, Coherent, OS/2, Solaris, FreeBSD, macOS) over the years. The Great Cow BASIC syntax highlighting was also trivial to add to emacs.
I have not looked at integrating help... I simply have the searchable help file PDF permanantly open in another window (being new to GCB :-).
I'm hopeful Great Cow BASIC will fix the minor #IFDEF issue and start producing macOS (and FreeBSD) binaries. See https://sourceforge.net/p/gcbasic/feature-requests/16/