Go library based on IUP, a multi-platform toolkit for building graphical user interfaces.
IUP-Go provides system native UI controls for Windows (Win32, WinUI), macOS (Cocoa), Linux/BSD (GTK, Qt, FLTK, EFL, Motif, GNUstep), Haiku (Interface Kit), WebAssembly (Emscripten), Android (Android), and iOS (Cocoa Touch).
C/C++/Obj-C source code is included and compiled together with bindings. Note that the first build can take a few minutes.
Alternatively, build with CGO_ENABLED=0 and no C compiler. A prebuilt library for the platform's default backend is bundled and loaded at runtime,
for linux, darwin, and windows on amd64 and arm64. Other backends and platforms require the cgo build.
To build the IUP C library standalone (without Go bindings), see iup/external for CMake build instructions.
Go 1.21 is the minimum required version.
- To remove a console window, i.e., compile a GUI app with a WinMain entry point, build with
-ldflags "-H=windowsgui". - You can add an icon resource to an .exe file with the rsrc tool.
- Windows manifest is included in the build by default. See below how to disable the manifest if you want to include your own.
For Win32, you need a C compiler, like MinGW-w64 or TDM-GCC. You can also build a binary in the MSYS2 shell.
- For MSYS2, install
pacman -S mingw-w64-x86_64-go mingw-w64-x86_64-gcc mingw-w64-x86_64-pkg-config. - You can build for Qt, with the
qtbuild tag. Install deps withpacman -S mingw-w64-x86_64-qt6-base. - You can build for GTK, with the
gtk/gtk4build tags. Install deps withpacman -S mingw-w64-x86_64-gtk3 / -gtk4. - You can build for FLTK, with the
fltkbuild tag. Install deps withpacman -S mingw-w64-x86_64-fltk.
For WinUI 3, you need a Clang C++ compiler.
The easiest method is to install MSYS2 and to start a MSYS2/CLANG64 session,
then install pacman -S mingw-w64-clang-x86_64-go mingw-w64-clang-x86_64-clang in that session.
You can also use LLVM MinGW.
The Windows App Runtime must be installed, any of 1.5 to 1.8 or 2.x.
Add -ldflags "-s -w" to strip symbols and DWARF info; the C++/WinRT headers generate huge amounts of debug info, dropping it shrinks a typical .exe from ~30 MB to ~5 MB.
On macOS, you need Command Line Tools for Xcode (if you have brew, you already have this).
To create an .app bundle, see Packaging.
- You can build for Qt, with the
qtbuild tag. Install deps withbrew install qt. - You can build for GTK, with the
gtk/gtk4build tag. Install deps withbrew install gtk+3 / gtk4. - You can build for FLTK, with the
fltkbuild tag. Install deps withbrew install fltk.
On Linux, you need a C/C++ compiler and the GTK or Qt development packages.
- Debian/Ubuntu:
apt-get install libgtk-3-dev - RedHat/Fedora:
dnf install gtk3-devel
- Debian/Ubuntu:
apt-get install libgtk-4-dev - RedHat/Fedora:
dnf install gtk4-devel
You can also build for GTK2.
For the WebBrowser control, libraries are loaded at runtime. You do not need to install WebKitGTK development packages.
For the GLCanvas control, install libegl-dev libgl-dev or libglvnd-devel.
- Debian/Ubuntu:
apt-get install qt6-base-dev - RedHat/Fedora:
dnf install qt6-qtbase-devel
- Debian/Ubuntu:
apt-get install qt5base-dev - RedHat/Fedora:
dnf install qt5-qtbase-devel
For the WebBrowser control, install qt6-webengine-dev or qt6-qtwebengine-devel.
For the GLCanvas control, install libegl-dev libgl-dev or libglvnd-devel.
Requires FLTK 1.4.x.
- Debian/Ubuntu:
apt-get install libfltk1.4-dev - RedHat/Fedora:
dnf install fltk-devel
For the GLCanvas control, install libegl-dev libgl-dev or libglvnd-devel.
- Debian/Ubuntu:
apt-get install libefl-all-dev - RedHat/Fedora:
dnf install efl
EFL needs this patch applied. You can still compile with distro packages, but you will not be able to open any modal window.
For the GLCanvas control, install libegl-dev libgl-dev or libglvnd-devel.
The library should work on other Unix-like systems, FreeBSD, NetBSD, OpenBSD, DragonFly, Solaris, Illumos, and AIX.
You can also compile for a time-tested Motif library if GTK or Qt are not available.
- Debian/Ubuntu:
apt-get install libmotif-dev libxmu-dev libxpm-dev - RedHat/Fedora:
dnf install motif-devel libXpm-devel
To compile with Xft support, install libxft-dev or libXft-devel.
For the GLCanvas control, install libgl-dev or libglvnd-devel.
The Cocoa driver can also be compiled against GNUstep on Linux/BSD.
This relies on the modern Objective-C stack, not the legacy GCC runtime.
Required combo:
Clangas the compiler (GCCwon't do)libobjc2- the Apple-compatible Objective-C runtime, NOT the legacylibobjcfrom gcc.libdispatch(GCD) - Apple's mainlinelibdispatch.libs-opal- Apple CoreGraphics-compatible drawing layer built on Cairo.libs-corebase- CoreFoundation.gnustep-base+gnustep-gui0.32+ (earlier versions are missing APIs the driver uses).
Stock distro packages are currently insufficient.
Also, several bugs in gnustep-base, gnustep-gui, libs-opal and libs-corebase must be patched.
The tarball with the required patches is at gnustep.tar.gz.
-fobjc-runtime=gnustep-2.2 tells Clang to emit Objective-C 2 ABI metadata compatible with libobjc2.
Cgo sanitizes compiler/linker flags by default, so you have to pass the flag and unblock it via the env vars:
CC=clang \
CGO_CFLAGS='-fobjc-runtime=gnustep-2.2' \
CGO_LDFLAGS='-fobjc-runtime=gnustep-2.2' \
CGO_CFLAGS_ALLOW='-fobjc-runtime.*' \
CGO_LDFLAGS_ALLOW='-fobjc-runtime.*' \
go build -tags gnustep
Native Interface Kit driver. Requires Haiku beta6, haiku_devel ships with a stock Haiku install, so no extra packages are needed.
- For
WebBrowser, installhaikuwebkit_develviapkgman install haikuwebkit_devel. - You can also build for Qt, with the
qtbuild tag. Install deps withpkgman install qt6_base_devel.
Compiles the IUP C driver to WebAssembly and runs the Go app in the browser; every widget renders as a DOM element.
See iup/external/wasm/README.md for prerequisites, build flow, and serving.
The same main() compiles as a desktop binary, an Android shared library, and an iOS executable. Every example under examples/ builds unchanged on all three.
Most examples are laid out for desktop windows and will overflow a phone screen though; production mobile apps need a layout tuned for small screens.
See mobile_sample and mobile_hello for examples designed for mobile. Also check demo_chat that handles both desktop and mobile layouts.
Examples without a top-level Dialog (e.g., alarm, message) will not run on mobile, the host platform requires a real Dialog as the root.
Builds the Go program as a c-shared .so consumed by a Gradle library.
See iup/external/android/README.md for prerequisites, build flow, permissions, and packaging.
For a one-command .apk without the Gradle project, see Packaging.
The Go binary IS the iOS executable; the Cocoa Touch driver calls UIApplicationMain itself.
See iup/external/ios/README.md for prerequisites, signing, and distribution.
For a one-command .ipa, see Packaging.
gl- build with support forGLCanvascontrolweb- build with support forWebBrowsercontrolmedia- build with support forAudio,CameraandMicrophonecontrolsplot- build with support forPlotcontrolctrl- build with support forMatrix,Cells, andFlat*controlsgtk- use GTK on macOS or Windowsgtk4- build for GTK4, default is GTK3gtk2- build for GTK2 (Linux/BSD)qt- build for the Qt frameworkqt5- build for Qt5 version, default is Qt6 (used withqt)fltk- build for FLTK (Fast Light Toolkit)efl- build for EFL (Enlightenment Foundation Libraries)motif- build for X11/Motif 2.x environmentgnustep- build for GNUstep (Linux/BSD)xft- build with Xft support (X FreeType interface) (used withmotif)xembed- use XEmbed tray protocol instead of SNI (GTK3/GTK2 and Motif)nomanifest- do not include manifest in Windows buildnopkgconfig- do not use pkg-config for compile and link flagsextlib- load the system IUP library instead of the bundled one (used withCGO_ENABLED=0)
You can provide explicit compiler and linker flags instead of using the defaults provided by pkg-config. For example, if dependencies are in a non-standard location:
CGO_CFLAGS="-I<include path> ..." CGO_LDFLAGS="-L<dir> -llib ..." go build -tags nopkconfig
You can also point PKG_CONFIG_LIBDIR to some local directory with custom modified .pc files.
iupkg builds and packages a program for distribution: a Windows .exe with icon, version info and manifest, or an .msix,
a macOS .app, Linux .tar.gz/.deb/.rpm, an Android .apk, an iOS .ipa, a WebAssembly site or a Haiku .hpkg.
Signing is built in: Authenticode, Apple code signing with notarization, APK signing and OpenPGP for the Linux packages, all without platform tools.
$ go install github.com/gen2brain/iup-go/cmd/iupkg@latest
See cmd/iupkg/README.md for every target, flag, and the signing setup.
API reference documentation is available at gen2brain.github.io/iup-go, generated from the docs directory. Each Go function links to its corresponding documentation page. Start with the guides on Attributes, Callbacks, Layout and Keyboard. Also check Go Reference and Examples.
User interfaces (and OpenGL) are usually not thread-safe, and IUP is not either. Most platforms enforce running UI on the main thread.
The secondary threads (goroutines) should not directly update the UI; instead, use PostMessage, which is expected to be thread-safe.
See example that uses PostMessage to send data to an element, which will be received by a callback when the main loop regains control.
You can also use Idle and Timer.
Once MainLoop is running, an attribute call from another goroutine panics instead of crashing inside the toolkit. Callbacks of IupThread are exempt, they run on a thread IUP started itself.
To cross-compile for Win32, install MinGW toolchain.
$ CGO_ENABLED=1 CC=x86_64-w64-mingw32-gcc GOOS=windows GOARCH=amd64 go build -ldflags "-s -w"
$ file alarm.exe
alarm.exe: PE32+ executable (console) x86-64, for MS Windows
$ CGO_ENABLED=1 CC=i686-w64-mingw32-gcc GOOS=windows GOARCH=386 go build -ldflags "-s -w"
$ file alarm.exe
alarm.exe: PE32 executable (console) Intel 80386, for MS Windows
To cross-compile for WinUI, install LLVM MinGW toolchain.
$ CGO_ENABLED=1 CC=x86_64-w64-mingw32-clang CXX=x86_64-w64-mingw32-clang++ GOOS=windows GOARCH=amd64 go build -tags winui -ldflags "-s -w"
$ file alarm.exe
alarm.exe: PE32+ executable (console) x86-64, for MS Windows, 7 sections
To cross-compile for macOS, install OSXCross toolchain. Ready-made SDK tarballs are available here.
$ CGO_ENABLED=1 CC=x86_64-apple-darwin25-clang GOOS=darwin GOARCH=amd64 go build -ldflags "-s -w"
$ file alarm
alarm: Mach-O 64-bit x86_64 executable, flags:<NOUNDEFS|DYLDLINK|TWOLEVEL|WEAK_DEFINES|BINDS_TO_WEAK>
$ CGO_ENABLED=1 CC=aarch64-apple-darwin25-clang GOOS=darwin GOARCH=arm64 go build -ldflags "-s -w"
$ file alarm
alarm: Mach-O 64-bit arm64 executable, flags:<NOUNDEFS|DYLDLINK|TWOLEVEL|WEAK_DEFINES|BINDS_TO_WEAK|PIE>
See more screenshots.
iup-go is MIT licensed, same as IUP. View LICENSE.














