How To: Install BlitzMax NG on Windows/Mac/Ubuntu

Started by markcwm, June 14, 2017, 21:33:06

Previous topic - Next topic

markcwm

BlitzMax NG on Windows

Install MinGW

The official MinGW is 32-bit only, MinGW-w64 is a separately maintained 64-bit branch, TDM-GCC is a now out-dated branch using both to provide a 64 and 32-bit GCC, Nuwen uses MinGW only but now supports 64-bit since GCC 4.8.1 (TDM development ended on GCC 5.1). Note that you may get errors when building C++ wrappers on compilers updated to the C++11 standard.

MinGW version numbers are based on GCC, NG is (in releases from v0.70 on) used with 5.1.0, BlitzMax OS can use 5.1.0 too but BlitzMax Legacy (below v1.51) needs 4.6.1, 4.7.1 or 4.8.1 as bcc was built with 4.6.1 and was closed source. Using 4.7.1 or 4.8.1 with Legacy needed a batch file to copy library files from MinGW to BlitzMax. Note that to run a batch file save as "myfile.bat" then type "myfile" in Cmd.

In an attempt to simplify MinGW, NG releases for Win32 contain a local TDM "MinGW32" folder, so you don't have to install MinGW unless you want to use the latest NG source or are still using BlitzMax OS/Legacy. Go to the TDM 5.1.0 files and get the latest "tdm64-gcc-5.1.0-2.exe" (note: if you're installing TDM's older versions you need to untick the checkbox in the installer).

Set Environment Variables

To set up an env var go to Computer > System properties > Advanced system settings > Environment Variables and click New, name it "MINGW" (without the quotes) and set value to "C:\wheremyMinGWis" then add to the PATH env var "C:\wheremyMinGWis\bin;" the semi-colon is the separator char. If you used BlitzMax Legacy with 4.7.1 or 4.8.1 you also needed an env var named "BMK_LD_OPTS" with value "-lmsvcrt -lgcc" for BRL's bmk, if you replaced it with Brucey's NG bmk it wasn't needed.

Install BlitzMax OS

Download and extract BlitzMax OS somewhere - or you can use BlitzMax Legacy and go to the next step. Follow the Readme.txt to install the 1.52 update which should work, if it doesn't then just copy "_src/win32_x86/bin" to the main folder.

Build brl and pub Maxmods

Download and extract the brl Maxmods and pub Maxmods to OS "mod", these allow you to build NG apps. Rename and replace the default brl and pub modules with these ones and build modules with threading to speed up bmk, if bmk or bcc don't build threaded then just build without threads.
cd ..\..\blitzmax-os\bin
bmk makemods -a -r
bmk makemods -a -r -h


Build bmk and bcc NG

Download and extract the bmk NG and bcc NG source to OS "src", I like to rename "-master" to the generation it is, like "-ng" or "-os" so I don't get confused. Build the apps and test they work with -v version number:
bmk -v
bcc -v
bmk makeapp -a -r -h -t console ..\src\bmk-ng\bmk.bmx
bmk makeapp -a -r -t console ..\src\bcc-ng\bcc.bmx


Install BlitzMax NG

Download and extract the bmx-ng cross-compiler installer somewhere. Copy the OS bin folder to NG and then copy over the NG bcc and bmk plus core.bmk and make.bmk, also create an empty "lib" folder to avoid warnings. Don't run setup_install.script, just download and extract brl NG and pub NG, as the installer currently doesn't finish setup and may delete bmk and bcc from "bin". In Cmd build modules again, since threading is the default option in NG you don't need -h, also remember to always enable -w overload warnings to skip non-critical errors.
cd ..\..\bmx-ng\bin
bmk makemods -a -w -g x64


Build bmk and bcc NG in 64-bit

Extract or copy the "bmk-ng" and "bcc-ng" source you built earlier over to NG "src", rebuild them in 64-bit and copy to the "bin" folder, this is not essential but it should be faster:
bmk makeapp -a -r -w -g x64 -t console ..\src\bmk-ng\bmk.bmx
bmk makeapp -a -r -w -g x64 -t console ..\src\bcc-ng\bcc.bmx


Build maxgui and maxide NG

Download and extract maxgui NG to NG "mod" and maxide NG to NG "src". Build in 64-bit, this compiles to the main folder:
bmk makemods -a -w -g x64 maxgui
bmk makeapp -a -r -w -g x64 -t gui -o ..\MaxIDE ..\src\maxide-ng\maxide.bmx


What to do if NG is broken

If you get an error building the latest modules or compilers you should have a look at the file and line and if you can't fix it then post a bug report to Brucey either on Github by opening a new issue on the related repository, or if you're not sure then by email or posting to Brucey's Modules board.
You should download the latest release, anything from v0.70 onwards should be stable. In releases v0.87 and below threading will need enabled:
bmk makemods -a -h -w -g x64

markcwm

#1
BlitzMax NG on Mac OSX

Install Xcode

Go to Apple's developer site and log in or create your AppleID to be able to download Xcode, this also installs Command Line Tools for using Terminal. You'll probably want to use a download manager (like DownThemAll for Firefox) as Xcode is several GB. Go to Download More for all versions. The highest version of Xcode you can use for OSX 10.9.5 is 6.2, for OSX 10.10 it's 7.2.1, for OSX 10.11.5 it's 8.2.1, for OSX 10.8.5 it's 5.1.1. Xcode is free but you need to register as a developer ($99 per year) to publish apps on the AppStore. You need a Mac with a minimum of OSX 10.8 to publish an app. Open Terminal and run this command then hit Enter and type "agree":
sudo xcodebuild -license

Install Macports

Go to Macports site and download the installer for your OSX version. Macports is a package manager that lets you install tools from Terminal, you can search for packages if you click "Available Ports". After you install it open Terminal and run:
sudo port selfupdate

You don't need Macports to use NG but you will probably want it if you're developing on a Mac. Subversion and Git should be installed by Xcode, you can check with "svn --version" or "git --version" if not then run these:
sudo port install subversion
sudo port install git


You will probably need a good C++ editor, I use Geany but the Macports version didn't seem to work so download it from the Geany site.

Install BlitzMax OS

Download and extract BlitzMax OS somewhere - or you can use BlitzMax Legacy and go to the next step. We don't actually need to run install.bat so just copy "_src/macos_x86/bin" to the main folder and rename "mod/maxgui.mod" as we only need pub.mod and brl.mod for bcc and bmk.
If you do run the installer you may get a Clang error "unknown argument: '-fno-tree-vrp'" when building bcc.cpp (I couldn't fix this). Since Xcode 5.1 (I'm on 6.2) Clang causes unknown compiler flags to hard error rather than warn. The same error occurs when building brl.blitz, so open blitz.bmx and straight after "?MacosX86" add this line:
ModuleInfo "CC_OPTS: -Werror=unused-command-line-argument-hard-error-in-future"

Build brl and pub Maxmods

Download and extract the brl Maxmods and pub Maxmods to OS "mod", these allow you to build NG apps. Rename and replace the default brl and pub modules with these ones and build modules with threading to speed up bmk, if bmk or bcc don't build threaded then just build without threads.
cd ../../Applications/blitzmax-os/bin
./bmk makemods -a -r
./bmk makemods -a -r -h


Build bmk and bcc NG

Download and extract the bmk NG and bcc NG source to OS "src", I like to rename "-master" to the generation it is, like "-ng" or "-os" so I don't get confused. Build the apps and test they work with -v version number:
./bmk -v
./bcc -v
./bmk makeapp -a -r -h -t console ../src/bmk-ng/bmk.bmx
./bmk makeapp -a -r -t console ../src/bcc-ng/bcc.bmx


Install BlitzMax NG

Download and extract the bmx-ng cross-compiler installer somewhere. Copy the OS "bin" folder to NG and then copy the NG bcc and bmk plus core.bmk and make.bmk, also create an empty "lib" folder to avoid warnings. Don't run setup_install.script, just download and extract brl and pub NG, as the installer currently doesn't finish setup and may delete bmk and bcc from "bin". In Terminal build the modules again, since threading is the default option in NG you don't need -h, also remember to always enable -w overload warnings in NG to skip non-critical errors:
cd ../../bmx-ng/bin
./bmk makemods -a -w -g x64


Build bmk and bcc NG in 64-bit

Extract or copy the "bmk-ng" and "bcc-ng" source you built earlier over to NG "src", rebuild them in 64-bit and copy to the "bin" folder, this is not essential but it should be faster:
./bmk makeapp -a -r -w -g x64 -t console ../src/bmk-ng/bmk.bmx
./bmk makeapp -a -r -w -g x64 -t console ../src/bcc-ng/bcc.bmx


Build maxgui and maxide NG

Download and extract maxgui NG to NG "mod" and maxide NG to NG "src". Build in 64-bit, this compiles to the main folder:
./bmk makemods -a -w -g x64 maxgui
./bmk makeapp -a -r -w -g x64 -t gui -o ../MaxIDE ../src/maxide-ng/maxide.bmx


What to do if NG is broken

If you get an error building the latest modules or compilers you should have a look at the file and line and if you can't fix it then post a bug report to Brucey either on Github by opening a new issue on the related repository, or if you're not sure then by email or posting to Brucey's Modules board.
You should download the latest release, anything from v0.70 onwards should be stable. In releases v0.87 and below threading will need enabled:
./bmk makemods -a -h -w -g x64

markcwm

#2
BlitzMax NG on Ubuntu/Debian

Debian is actually untested but it really shouldn't be much different to Ubuntu. A new issue is that with the latest Ubuntu Blitzmax apps are now sandboxed. I don't know the correct solution to this yet but you should still be able to launch apps from the Terminal.

Install 32/64-bit dependencies

First update the packages list. These packages are correct for Ubuntu 16 but should also work for 14 and should be the same for 32 or 64-bit. The extra packages are for Gtkmaxgui, dbus was due to a missing dependency error.
sudo apt-get update
sudo apt-get install g++-multilib libglu1-mesa-dev libfreetype6-dev libxft-dev libxpm-dev libasound2-dev libpulse-dev libopenal-dev libxxf86vm-dev
sudo apt-get install libdbus-1-dev libwebkitgtk-dev libwebkitgtk-3.0-dev


You may want to use subversion as this lets you download single modules in bah Maxmods with:
svn checkout https://github.com/user/repo/EDIT tree/master TO trunk/code.mod

Another tool you may want is apt-file, which lets you search for missing dependencies, see below.
sudo apt-get install subversion
sudo apt-get install apt-file


Install 32-bit in 64-bit dependencies

These packages enable BlitzMax OS to build modules and console apps for NG but won't build Gtkmaxgui since Ubuntu 14. So if you want to build 32-bit linux apps you should definitely use a 32-bit linux, or VM.
sudo apt-get install g++-multilib libglu1-mesa:i386 libfreetype6:i386 libxft2:i386 libxpm4:i386 libasound2:i386 libpulse0:i386 libopenal1:i386
sudo apt-get install libwebkitgtk-1.0-0:i386


Search for dependencies

You can use apt-cache to list what dependencies are installed or apt-file to list the paths of all files, you only need apt-file if you get errors like "No such file or directory" and the related package is installed, it helped me resolve Blitzmax compiler include paths. First you use "update" to build a cache then "search" for part of a name, look at the version numbers as you will need the right one. You can also use the Ubuntu Packages site to search for dependencies, just type in the keyword and make sure you have the right distribution selected.
sudo apt-cache search libwebkitgtk
OR
apt-file update
apt-file search libwebkitgtk


Install BlitzMax OS

Download and extract BlitzMax OS somewhere - or you can use BlitzMax Legacy and go to the next step. We don't actually need to run install.bat so just copy "_src/linux_x86/bin" to the main folder and rename "mod/maxgui.mod" as we only need pub.mod and brl.mod for bcc and bmk.
If you do run the installer you may get an error about "ftheader.h: No such file or directory" so to resolve it edit fltkmaxgui.bmx and straight after "?Linux" add this line:
ModuleInfo "CC_OPTS: -I/usr/include/x86_64-linux-gnu/freetype2"

Build brl and pub Maxmods

Download and extract the brl Maxmods and pub Maxmods to OS "mod", these allow you to build NG apps. Rename and replace the default brl and pub modules with these ones and build modules with threading to speed up bmk, if bmk or bcc don't build threaded then just build without threads.
cd blitzmax-os/bin
./bmk makemods -a -r
./bmk makemods -a -r -h


Build bmk and bcc NG

Download and extract the bmk NG and bcc NG source to OS "src", I like to rename "-master" to the generation it is, like "-ng" or "-os" so I don't get confused. Build the apps and test they work with -v version number:
./bmk -v
./bcc -v
./bmk makeapp -a -r -h -t console ../src/bmk-ng/bmk.bmx
./bmk makeapp -a -r -t console ../src/bcc-ng/bcc.bmx


Install BlitzMax NG

Download and extract the bmx-ng cross-compiler installer somewhere. Copy the OS "bin" folder over to NG and then copy the NG bcc and bmk plus core.bmk and make.bmk, also create an empty "lib" folder to avoid warnings. Don't run setup_install.script, just download and extract brl NG and pub NG, as the installer currently doesn't finish setup and may delete bmk and bcc from "bin". In Terminal build the modules again, since threading is the default option in NG you don't need -h, also remember to always enable -w overload warnings in NG to skip non-critical errors:
cd ../../bmx-ng/bin
./bmk makemods -a -w -g x86
./bmk makemods -a -w -g x64


Build bmk and bcc NG in 64-bit

If you're in 32-bit linux the compilers are already 32-bit so skip this step. Otherwise extract or copy "bmk-ng" and "bcc-ng" over to NG "src", rebuild them in 64-bit and copy to the "bin" folder, this is not essential but it should be faster:
./bmk makeapp -a -r -w -g x64 -t console ../src/bmk-ng/bmk.bmx
./bmk makeapp -a -r -w -g x64 -t console ../src/bcc-ng/bcc.bmx


Build Maxgui NG and Gtkmaxgui

Download and extract maxgui NG to NG "mod" and build with:
./bmk makemods -a -w -g x86 maxgui
./bmk makemods -a -w -g x64 maxgui


Maxgui NG now contains Gtkmaxgui but if you're using Blitzmax OS and want to try Gtk+3 instead of the older, slower Gtk+ (v1) in bah.mod then download gtk Maxmods and build with:
./bmk makemods -a gtk

If you have an older PC and can't use Gtk+3 then you can use subversion to checkout Gtk+ (v1) gtkmaxgui, gtkwebkitgtk and maxguitextareascintilla to "bah.mod" - or just download all of bah and extract the modules. To use svn, just "cd" to where you want to download to, then remember to edit the git url part "tree/master" to "trunk":
cd ../mod
mkdir bah.mod
cd bah.mod
svn checkout https://github.com/maxmods/bah.mod/trunk/gtkmaxgui.mod
svn checkout https://github.com/maxmods/bah.mod/trunk/gtkwebkitgtk.mod
svn checkout https://github.com/maxmods/bah.mod/trunk/maxguitextareascintilla.mod
cd ../../bin
./bmk makemods -a bah


Build maxide NG

Download and extract maxide NG to NG "src". Open maxide.bmx in a text editor and check it's importing the right Gtk+ modules. Then build the IDE, this compiles to the main folder:
./bmk makeapp -a -r -w -g x64 -t gui -o ../MaxIDE ../src/maxide-ng/maxide.bmx

What to do if NG is broken

If you get an error building the latest modules or compilers you should have a look at the file and line and if you can't fix it then post a bug report to Brucey on Github by opening a new issue on the related repository, or if you're not sure then by email or posting to Brucey's Modules board.
You should download the latest release, any release from v0.70 onwards is fairly stable or try the older source I used: bcc 0.90 and bmk 3.18 (2017-06-20). In releases v0.87 and below threading will need enabled:
./bmk makemods -a -h -w -g x64

markcwm

Added "GTK+3 Maxmods" and "What to do if NG is broken".

markcwm

Added "Search for dependencies" and rewrote "BlitzMax NG on Windows".

markcwm

Bump!

Improved and also updated for 32-bit Ubuntu.