Golang and GUI toolkits on FreeBSD
Sam Fourman Jr.
sfourman at gmail.com
Wed Feb 18 06:30:50 UTC 2015
Hello list,
I am trying to toy around with some sort of gui toolkit to build a X11 app
it turns out that I cant compile anything, not wx or gtk3 etc..
I am wondering if because clang is the default compiler on FreeBSD that is
causing me issues.
I would like to get to the bottom of how to fix this, so we can make a note
in the FreeBSD port so that others know. so please ask questions lets
figure out what is going on, it could be that I am missing something simple
(Eg, FreeBSD has everything in /usr/local )
I really would appreciate any help at knowing how to fix this.
here is a example below of yet another toolkit that wont compile
when trying to build the sample code on this page:
https://github.com/andlabs/ui/wiki/Getting-Started
I get this:
go build gui.go
# github.com/andlabs/ui
cc did not produce error at completed:1
on input:
#line 13 "/home/sfourman/go/src/github.com/andlabs/ui/area_unix.go"
#include "gtk_unix.h"
extern gboolean our_area_get_child_position_callback(GtkOverlay *,
GtkWidget *, GdkRectangle *, gpointer);
extern void our_area_textfield_populate_popup_callback(GtkEntry *, GtkMenu
*, gpointer);
extern gboolean our_area_textfield_focus_out_event_callback(GtkWidget *,
GdkEvent *, gpointer);
extern gboolean our_area_draw_callback(GtkWidget *, cairo_t *, gpointer);
extern gboolean our_area_button_press_event_callback(GtkWidget *, GdkEvent
*, gpointer);
extern gboolean our_area_button_release_event_callback(GtkWidget *,
GdkEvent *, gpointer);
extern gboolean our_area_motion_notify_event_callback(GtkWidget *,
GdkEvent *, gpointer);
extern gboolean our_area_enterleave_notify_event_callback(GtkWidget *,
GdkEvent *, gpointer);
extern gboolean our_area_key_press_event_callback(GtkWidget *, GdkEvent *,
gpointer);
extern gboolean our_area_key_release_event_callback(GtkWidget *, GdkEvent
*, gpointer);
/* because cgo doesn't like ... */
static inline void gtkGetDoubleClickSettings(GtkSettings *settings, gint
*maxTime, gint *maxDistance)
{
g_object_get(settings,
"gtk-double-click-time", maxTime,
"gtk-double-click-distance", maxDistance,
NULL);
}
#include <stddef.h> /* for ptrdiff_t and size_t below */
/* Define intgo when compiling with GCC. */
typedef ptrdiff_t intgo;
typedef struct { char *p; intgo n; } _GoString_;
typedef struct { char *p; intgo n; intgo c; } _GoBytes_;
_GoString_ GoString(char *p);
_GoString_ GoStringN(char *p, int l);
_GoBytes_ GoBytes(void *p, int n);
char *CString(_GoString_);
void *_CMalloc(size_t);
#line 1 "not-declared"
void __cgo_f_1_1(void) { __typeof__(CAIRO_FORMAT_ARGB32)
*__cgo_undefined__; }
#line 1 "not-type"
void __cgo_f_1_2(void) { CAIRO_FORMAT_ARGB32 *__cgo_undefined__; }
#line 1 "not-const"
void __cgo_f_1_3(void) { enum { __cgo__undefined__ =
(CAIRO_FORMAT_ARGB32)*1 }; }
#line 2 "not-declared"
void __cgo_f_2_1(void) { __typeof__(CAIRO_STATUS_SUCCESS)
*__cgo_undefined__; }
#line 2 "not-type"
void __cgo_f_2_2(void) { CAIRO_STATUS_SUCCESS *__cgo_undefined__; }
#line 2 "not-const"
void __cgo_f_2_3(void) { enum { __cgo__undefined__ =
(CAIRO_STATUS_SUCCESS)*1 }; }
#line 3 "not-declared"
void __cgo_f_3_1(void) { __typeof__(FALSE) *__cgo_undefined__; }
#line 3 "not-type"
void __cgo_f_3_2(void) { FALSE *__cgo_undefined__; }
#line 3 "not-const"
void __cgo_f_3_3(void) { enum { __cgo__undefined__ = (FALSE)*1 }; }
#line 4 "not-declared"
void __cgo_f_4_1(void) { __typeof__(GCallback) *__cgo_undefined__; }
#line 4 "not-type"
void __cgo_f_4_2(void) { GCallback *__cgo_undefined__; }
followed by a bunch more errors that I dont think are relevant.
below is my config:
sfourman at Sam ~/go/freebsd % go version
go version go1.4.1 freebsd/amd64
sfourman at Sam ~/go/freebsd % go env
GOARCH="amd64"
GOBIN=""
GOCHAR="6"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="freebsd"
GOOS="freebsd"
GOPATH="/home/sfourman/go"
GORACE=""
GOROOT="/usr/local/go"
GOTOOLDIR="/usr/local/go/pkg/tool/freebsd_amd64"
CC="cc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0"
CXX="g++"
CGO_ENABLED="1"
sfourman at Sam ~/go/freebsd % cc -v
FreeBSD clang version 3.5.1 (tags/RELEASE_351/final 225668) 20150115
Target: x86_64-unknown-freebsd11.0
Thread model: posix
sfourman at Sam ~/go/freebsd %
uname -a
FreeBSD Sam 11.0-CURRENT FreeBSD 11.0-CURRENT #4 r277531: Thu Jan 22
11:47:53 CST 2015 sfourman at Sam:/usr/obj/usr/src/sys/GENERIC amd64
--
Sam Fourman Jr.
More information about the freebsd-questions
mailing list