Skip to content

Build GTK 2 examples

Adrian-George Bostan edited this page Dec 28, 2020 · 8 revisions

Build on Linux

Install libVLC

See installation instructions at https://github.com/adrg/libvlc-go/wiki/Install-on-Linux.

Install GTK 2

sudo apt-get install libgtk2.0-dev libglib2.0-dev libgtksourceview2.0-dev

Download and run example

go get
go build

Build on Windows

Install libVLC

See installation instructions at https://github.com/adrg/libvlc-go/wiki/Install-on-Windows.

Install GTK 2

Download and install MSYS2 package manager to the default location.

MSYS2 package manager download

Open MSYS shell and install MinGW-W64, pkg-config and GTK 2.

pacman --noconfirm --needed -Sy bash pacman pacman-mirrors
pacman --noconfirm -Su
pacman --noconfirm -S mingw-w64-x86_64-gcc mingw64/mingw-w64-x86_64-pkg-config mingw-w64-x86_64-gtk2

MSYS2 install dependencies

Apply a workaround for a bug that is currently present in the GDK package config file. This is a no-op if the bug has been fixed already.

bash -c "sed -i -e 's/-Wl,-luuid/-luuid/g' C:/msys64/mingw64/lib/pkgconfig/gdk-2.0.pc"
bash -c "sed -i -e 's/-Wl,-luuid/-luuid/g' C:/msys64/mingw64/lib/pkgconfig/gdk-win32-2.0.pc"

MSYS2 GDK workaround

Add MSYS2 binary paths to your PATH environment variable.

C:\msys64\mingw64\bin
C:\msys64\usr\bin

Add MSYS2 binary paths to PATH environment variable

Download and run example in CMD

go get
set CGO_LDFLAGS=-L{your-libvlc-sdk-path}
set CGO_CFLAGS=-I{your-libvlc-sdk-path}\include
go build

In this example, the location of the libVLC SDK files is C:\libvlc. Set environment variables

Build on macOS

Install libVLC

See installation instructions at https://github.com/adrg/libvlc-go/wiki/Install-on-macOS.

Install GTK 2

See installation instructions at https://github.com/mattn/go-gtk.

Download and run example

go get
go build
Clone this wiki locally