Repository navigation
Installation
Download a prebuilt installer from the
Releases page. Each one puts
rpgc on your PATH and brings the runtime headers with it — there is nothing
to build and no compiler toolchain to set up first.
| Platform | Download | Architectures |
|---|---|---|
| macOS | openrpg-<version>.pkg |
Apple Silicon (arm64) |
| Debian / Ubuntu |
rpgc_<version>_amd64.deb, rpgc_<version>_arm64.deb
|
x86_64, ARM64 |
| RHEL / Fedora |
rpgc-<version>-1.x86_64.rpm, rpgc-<version>-1.aarch64.rpm
|
x86_64, ARM64 |
| Windows |
openrpg-<version>-windows-x64.exe, openrpg-<version>-windows-arm64.exe
|
x86_64, ARM64 |
If your machine is not on that list, build from source instead.
The .pkg bundles both rpgc and the display file compiler dspfc.
Two things must be present first. Xcode Command Line Tools provide the
clang++ that rpgc invokes to build the programs it compiles, and the
ncurses headers display file programs need:
xcode-select --install # skip if `xcode-select -p` already prints a pathAnd unixODBC, which rpgc itself links against:
brew install unixodbc(Installing Homebrew pulls in the Command Line Tools, so if you already have
brew you almost certainly have them.)
OpenRPG is not code-signed with an Apple Developer certificate, so Gatekeeper will block the installer. Clear the quarantine flag, then open it:
xattr -cr ~/Downloads/openrpg-*.pkgDouble-click the .pkg and follow the prompts.
The packages declare everything they need — the C++ compiler rpgc shells out
to, the unixODBC headers and library, and the ncurses headers display file
programs link against — so the package manager pulls all of it in for you.
Debian / Ubuntu:
sudo dpkg -i rpgc_*.deb
sudo apt-get install -f # resolves any missing dependenciesRHEL / Fedora:
sudo dnf install ./rpgc-*.rpmOn Linux the display file compiler ships as its own dspfc package. rpgc
recommends it, so most package managers install it alongside — if you are
writing display file programs and dspfc is not on
your PATH afterwards, install it the same way:
sudo dpkg -i dspfc_*.deb # Debian/Ubuntu
sudo dnf install ./dspfc-*.rpm # RHEL/FedoraRun the installer and follow the prompts. It adds rpgc to your PATH.
No other prerequisites are needed. The installer bundles a self-contained
C++ toolchain (a trimmed llvm-mingw)
for rpgc and dspfc to build the programs they compile, plus a PDCurses
build for display file programs. You do not need MSYS2 or Visual Studio.
Embedded SQL is the one exception: it needs a platform ODBC driver installed separately — see Database Connections.
ARM64 note: of the ODBC drivers this guide covers, only Microsoft's ODBC Driver 18 for SQL Server (18.2+) ships a native ARM64 Windows build. The SQLite, PostgreSQL and MySQL/MariaDB installers are x86_64-only, so SQL and RLA features against those three are not available on Windows ARM64 without building a driver yourself.
rpgc -v # prints the version
dspfc -v # only if you installed the display file compilerThe installers cover the compiler itself. Embedded SQL and record-level access additionally need an ODBC driver for whichever database you are using — see Database Connections for per-database setup.
Build from source if there is no prebuilt package for your machine — an Intel
Mac, a distribution that takes neither .deb nor .rpm, or any other
platform with a C++17 compiler.
Prerequisites:
-
C++17 compiler (clang++ or g++) —
rpgcalso invokes it at runtime to build the programs it compiles, so it is needed after installation too - Flex (lexer generator)
- Bison (parser generator)
- unixODBC + a database driver — only for embedded SQL and RLA
-
ncurses — only for display file programs; on macOS it comes with the
Command Line Tools, on Linux it is a separate
-dev/-develpackage
# macOS — clang++ and ncurses come from the Xcode Command Line Tools
xcode-select --install
brew install flex bison unixodbc
# Debian/Ubuntu
sudo apt install flex bison g++ unixodbc-dev libncurses-dev
# RHEL/Fedora
sudo dnf install flex bison gcc-c++ unixODBC-devel ncurses-develOn Windows, install MSYS2 and build from the MINGW64 shell (or CLANGARM64 on ARM64, which has no native gcc):
pacman -S mingw-w64-x86_64-gcc mingw-w64-x86_64-flex mingw-w64-x86_64-bison makeWindows has a built-in ODBC driver manager, so unixODBC is not needed there.
Build:
The display file compiler lives in a submodule, so clone recursively:
git clone --recursive https://github.com/danlong005/OpenRPG.git
cd OpenRPG
makeThis produces the rpgc executable in the working directory. If you cloned
without --recursive, run git submodule update --init before building.
Install:
sudo make install-all # rpgc + dspfc, into /usr/local
make install-all PREFIX=~/.local # or a user-local prefix, no sudoUse make install instead of make install-all to install rpgc on its own,
without the display file compiler.
This installs the rpgc binary to $PREFIX/bin/ and the runtime headers to
$PREFIX/share/rpgc/runtime/. When compiling a program, OpenRPG finds those
headers automatically — it checks relative to the binary, then the current
directory, then the install prefix.
To remove it again:
sudo make uninstall
sudo make uninstall-dspf # if you installed dspfc too- Installation
- Quick Start
- CLI Reference
- Language Basics
- Data Types
- Variables and Constants
- Data Structures
- Arrays
- Varying-Dimension Arrays
- Control Flow
- Procedures
- Procedure Overloading
- Built-In Functions
- Error Handling
- Operation Extenders
- Enumerations
- Program Status Data Structure
- Data Areas
- SND-MSG
- Embedded SQL
- Record-Level Access
- Display Files (WORKSTN)
- Program-Described Files (I-Specs and O-Specs)
- DATA-INTO and DATA-GEN
- XML-INTO
- Fixed-Format Source
- Database Connections
- Multi-Module Programs
- Environment Variables
- Testing
- Complete Example: Employee Report
- IBM i Conformance Results
- IBM i Execution Results