gotk4 icon indicating copy to clipboard operation
gotk4 copied to clipboard

Error building on Linux

Open simonasGit opened this issue 2 months ago • 1 comments

similar to #147

from the examples repo:

package main

import (
	"os"

	"github.com/diamondburned/gotk4/pkg/gio/v2"
	"github.com/diamondburned/gotk4/pkg/gtk/v4"
)

func main() {
	app := gtk.NewApplication("com.github.diamondburned.gotk4-examples.gtk4.simple", gio.ApplicationFlagsNone)
	app.ConnectActivate(func() { activate(app) })

	if code := app.Run(os.Args); code > 0 {
		os.Exit(code)
	}
}

func activate(app *gtk.Application) {
	window := gtk.NewApplicationWindow(app)
	window.SetTitle("gotk4 Example")
	window.SetChild(gtk.NewLabel("Hello from Go!"))
	window.SetDefaultSize(400, 300)
	window.Show()
}

# github.com/diamondburned/gotk4/pkg/glib/v2
cgo-generated-wrappers:8:13: warning: conflicting types for built-in function ‘free’; expected ‘void(void *)’ [-Wbuiltin-dec
laration-mismatch]
cgo-generated-wrappers:1:1: note: ‘free’ is declared in header ‘<stdlib.h>’
# github.com/diamondburned/gotk4/pkg/gio/v2
cgo-generated-wrappers:262:13: warning: conflicting types for built-in function ‘free’; expected ‘void(void *)’ [-Wbuiltin-d
eclaration-mismatch]
cgo-generated-wrappers:1:1: note: ‘free’ is declared in header ‘<stdlib.h>’
# github.com/diamondburned/gotk4/pkg/gtk/v4
cgo-generated-wrappers:578:13: warning: conflicting types for built-in function ‘free’; expected ‘void(void *)’ [-Wbuiltin-d
eclaration-mismatch]
cgo-generated-wrappers:1:1: note: ‘free’ is declared in header ‘<stdlib.h>’
[]
2025/10/17 21:32:28 ERROR This application can not open files. glib_old_log_api=1 priority=4 glib_domain=GLib-GIO syslog_ide
ntifier=main
exit status 1

Go env:

AR='ar'
CC='gcc'
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_ENABLED='1'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
CXX='g++'
GCCGO='gccgo'
GO111MODULE=''
GOAMD64='v1'
GOARCH='amd64'
GOAUTH='netrc'
GOBIN=''
GOCACHE='/home/basil/.cache/go-build'
GOCACHEPROG=''
GODEBUG=''
GOENV='/home/basil/.config/go/env'
GOEXE=''
GOEXPERIMENT='nodwarf5'
GOFIPS140='off'
GOFLAGS=''
GOGCCFLAGS='-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build2010831352=/tmp/go-bu
ild -gno-record-gcc-switches'
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMOD='/home/basil/code/kuzu-bookmarks/go.mod'
GOMODCACHE='/home/basil/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='linux'
GOPATH='/home/basil/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/usr/lib/go'
GOSUMDB='sum.golang.org'
GOTELEMETRY='local'
GOTELEMETRYDIR='/home/basil/.config/go/telemetry'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/usr/lib/go/pkg/tool/linux_amd64'
GOVCS=''
GOVERSION='go1.25.2 X:nodwarf5'
GOWORK=''
PKG_CONFIG='pkg-config'

simonasGit avatar Oct 17 '25 18:10 simonasGit

@simonasGit This is expected gtk behavior when you pass the commandline args. See the docs to properly handle it: https://docs.gtk.org/gio/flags.ApplicationFlags.html

Image
go run ./simple/main.go additional_args_is_not_allowed
# github.com/diamondburned/gotk4/pkg/glib/v2
cgo-generated-wrappers:8:13: warning: conflicting types for built-in function ‘free’; expected ‘void(void *)’ [-Wbuiltin-declaration-mismatch]
cgo-generated-wrappers:1:1: note: ‘free’ is declared in header ‘<stdlib.h>’
# github.com/diamondburned/gotk4/pkg/gio/v2
cgo-generated-wrappers:262:13: warning: conflicting types for built-in function ‘free’; expected ‘void(void *)’ [-Wbuiltin-declaration-mismatch]
cgo-generated-wrappers:1:1: note: ‘free’ is declared in header ‘<stdlib.h>’
# github.com/diamondburned/gotk4/pkg/gtk/v4
cgo-generated-wrappers:578:13: warning: conflicting types for built-in function ‘free’; expected ‘void(void *)’ [-Wbuiltin-declaration-mismatch]
cgo-generated-wrappers:1:1: note: ‘free’ is declared in header ‘<stdlib.h>’
2025/11/06 00:21:48 ERROR This application can not open files. glib_old_log_api=1 priority=4 glib_domain=GLib-GIO syslog_identifier=main
exit status 1

ppvan avatar Nov 05 '25 17:11 ppvan