FreeBSD

In order to compile Gambas on FreeBSD, you must install required development packages.

For this How-to I'm using pre-compiled packages, but you can use FreeBSD ports instead, of course. :-)

Here is the packages list :

# pkg_add -r autoconf268 automake111 libtool libffi bzip2 unixODBC mysql55-client postgresql91-client sqlite2 sqlite3 libXtst gtk20 librsvg2 cairo gdk-pixbuf imlib imlib2 curl pcre poppler qt4 qt4-moc sdl sdl_ttf sdl_mixer sdl_image libGL libGLU glew libv4l v4l_compat libxml2 libxslt

Here is the packages list for GhostBSD 20.11.28: (On 30/Dec/2020) (these may work better for your version as updated from the list above)

# pkg install autoconf automake alure libtool libffi bzip2 unixODBC mysql57-client sqlite3 libXtst cairo ncurses gsl openssl imlib imlib2 curl pcre poppler gmime26 gtk3 qt5 sdl sdl2 sdl_ttf sdl_mixer sdl_image sdl2_ttf sdl2_mixer sdl2_image glib libGLU gmime26 glew gtkglext libv4l v4l_compat libxml2 libxslt pkgconf

Get the source code and change to its directory.

Then, you can compile the Gambas source code:

$ ./reconf-all
$ ./configure
$ make
# make install

for newer versions that have dropped qt4 use the following ./configure command...

$ ./configure -C --disable-qt4

Note you could obtain some problems at compile time because of some environment variables.
Indeed, if you get an error about any linker options, don't forget to verify if you have well the LD_LIBRARY_PATH environment variable declared on your FreeBSD system.
The value of this variable must contains : /usr/local/lib

Second thing, on *BSD systems the OpenGL headers are located at /usr/X11R6/include .
So once again, don't forget to add this path in the CPATH environment variable on your FreeBSD system. Otherwise you cannot compile the gb.qt4.opengl component and all others related to this one.