03 - Open Source (EN)03g - IBM i Open Source miscellanea (EN)

Harbor – installation guide on windows systems

After the historical parenthesis of Harbor, let’s see how to install and configure the package to start developing with this splendid language.

  • Prerequisites:

Before downloading and installing Harbor we need to get a C compiler, there are many compatible ones but the recommended ones are visual C ++ included in visual-studio or MINGW. In this article we are going to install MINGW (as reported by the official harbour.wiki manual).

First we download the compiler using the following link and get the file for the architecture of our PC. Once downloaded, we install it easily through its guided wizard. Having a 64-bit windows 10 system, the images for x64 architectures have been reported from the wiki.

  1. Let’s save the exe file

2. Let’s start the installation

3. Depending on the system we choose the type of architecture

4. We choose the destination of the compiler files

Once the installation is finished, we add the path of the compiler’s BIN folder to the PATH environment variable.

– Harbor download

To download the Harbor package, we must go to the official github page of the project, click on the green Code button and on the Download ZIP submenu.

  • Harbor installation

Once the zip file has been downloaded we proceed to unpack the core-master folder in the path we prefer (it is advisable to rename the folder as harbor or hb and copy it directly to C :).

Harbor folder contents.

Once you have accessed the folder and we know that the C compiler is working correctly, you need to compile Harbor by running win-make.exe.At this point, a command prompt screen opens which is then closed when the operation is complete.

Command prompt running

Once the installation is finished, move inside the bin folder and check if the win folder has been created correctly. We move inside the latter until we reach the mingw subfolder.

Contents of the mingw folder

Here we find all the vital libraries and executables of the Harbor project including:

  • HBMK2 – compiler to generate EXE or semi-compiled executables with .HRB extension
  • HBRUN – interpreter to execute python-like code and mini database to manage created dbf files.

For convenience we will copy the contents of the mingw folder inside bin to conveniently configure the environment variable in PATH.

Environment variables to add
  • Function test

Once these steps are complete we are ready to use Harbor. Let’s start right away with the classic HELLO WORLD:

we create a file with the extension .PRG (extension of the xbase sources) for example on the desktop and we open it with the notepad, we paste this simple example inside it.

Function Main ()
     ? "Hello World"
RETURN 

We save the file and compile with the command Hbmk2 name of the file.prg and give enter. If all goes well the console output appears as follows:

and we will find the executable file ready to use:

  • Alternative method

If you don’t want to waste time compiling Harbor I am attaching here a ready-to-use rar package to download with the compiler inside.

To download the file click on the arrow on the right and then click on direct download

  • Alternative package installation

Once the package has been downloaded, unpack the folder in the desired path (always recommended C 🙂 and add the following ambient variables (also shown in the previous settings image):

-C: hb32 bin

-C: hb32 comp mingw bin

C: hb32 contrib

Once added, try to run the operation test to verify that you have correctly set the environment variables.

External links:

For this article I took a cue from the official wiki page: Link: Harbor Language Wiki Articles – Article: How to Install Harbor on Windows

  • Upcoming articles

In the next article we will see how to install Harbor on Linux and then the various tools recommended for development. Meanwhile, if you want to familiarize yourself with the compiler and the language in a basic way, you can see the examples included in the tests folder.

About author

Giorgio Caponera, IBM Fresh Face 2019, developer and IBM i passionate

Leave a Reply

%d bloggers like this: