GO-GTK在树莓派上的交叉编译

huangapple go评论101阅读模式
英文:

GO-GTK Cross Compilation for RaspberryPi

问题

我正在使用GO-GTK来显示图像,该项目在amd64上运行良好,但是当我尝试将其交叉编译为arm(Raspberry Pi)时,出现以下错误。请指导如何将go-gtk从amd64交叉编译到arm(Raspberry Pi 3)。

编译器输出如下所示:

github.com/mattn/go-gtk/glib

github.com/mattn/go-gtk/glib

在文件/usr/lib/x86_64-linux-gnu/glib-2.0/include/glibconfig.h:9:0中包含,
来自/usr/include/glib-2.0/glib/gtypes.h:32,
来自/usr/include/glib-2.0/glib/galloca.h:32,
来自/usr/include/glib-2.0/glib.h:30,
来自./glib.go.h:4,
来自src/github.com/mattn/go-gtk/glib/glib.go:5:
/usr/include/glib-2.0/glib/gtypes.h: 在函数‘_GLIB_CHECKED_ADD_U64’中:
/usr/include/glib-2.0/glib/gmacros.h:232:53: 错误:数组‘_GStaticAssertCompileTimeAssertion_0’的大小为负
#define G_STATIC_ASSERT(expr) typedef char G_PASTE (GStaticAssertCompileTimeAssertion, COUNTER)[(expr) ? 1 : -1] G_GNUC_UNUSED
^
/usr/include/glib-2.0/glib/gmacros.h:229:47: 注意:在宏‘G_PASTE_ARGS’的定义中
#define G_PASTE_ARGS(identifier1,identifier2) identifier1 ## identifier2
^
/usr/include/glib-2.0/glib/gmacros.h:232:44: 注意:在宏‘G_PASTE’的扩展中
#define G_STATIC_ASSERT(expr) typedef char G_PASTE (GStaticAssertCompileTimeAssertion, COUNTER)[(expr) ? 1 : -1] G_GNUC_UNUSED
^
/usr/include/glib-2.0/glib/gtypes.h:422:3: 注意:在宏‘G_STATIC_ASSERT’的扩展中
G_STATIC_ASSERT(sizeof (unsigned long long) == sizeof (guint64));
^
github.com/mattn/go-gtk/pango

github.com/mattn/go-gtk/pango

在文件/usr/lib/x86_64-linux-gnu/glib-2.0/include/glibconfig.h:9:0中包含,
来自/usr/include/glib-2.0/glib/gtypes.h:32,
来自/usr/include/glib-2.0/glib/galloca.h:32,
来自/usr/include/glib-2.0/glib.h:30,
来自/usr/include/pango-1.0/pango/pango-coverage.h:25,
来自/usr/include/pango-1.0/pango/pango-font.h:25,
来自/usr/include/pango-1.0/pango/pango-attributes.h:25,
来自/usr/include/pango-1.0/pango/pango.h:25,
来自./pango.go.h:7,
来自src/github.com/mattn/go-gtk/pango/pango.go:5:
/usr/include/glib-2.0/glib/gtypes.h: 在函数‘_GLIB_CHECKED_ADD_U64’中:
/usr/include/glib-2.0/glib/gmacros.h:232:53: 错误:数组‘_GStaticAssertCompileTimeAssertion_0’的大小为负
#define G_STATIC_ASSERT(expr) typedef char G_PASTE (GStaticAssertCompileTimeAssertion, COUNTER)[(expr) ? 1 : -1] G_GNUC_UNUSED
^
/usr/include/glib-2.0/glib/gmacros.h:229:47: 注意:在宏‘G_PASTE_ARGS’的定义中
#define G_PASTE_ARGS(identifier1,identifier2) identifier1 ## identifier2
^
/usr/include/glib-2.0/glib/gmacros.h:232:44: 注意:在宏‘G_PASTE’的扩展中
#define G_STATIC_ASSERT(expr) typedef char G_PASTE (GStaticAssertCompileTimeAssertion, COUNTER)[(expr) ? 1 : -1] G_GNUC_UNUSED
^
/usr/include/glib-2.0/glib/gtypes.h:422:3: 注意:在宏‘G_STATIC_ASSERT’的扩展中
G_STATIC_ASSERT(sizeof (unsigned long long) == sizeof (guint64));

环境变量

GOARCH="arm"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/minhaj/GoLang"
GORACE=""
GOROOT="/usr/local/go"
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
GOARM=""
CC="arm-linux-gnueabi-gcc"
GOGCCFLAGS="-fPIC -marm -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build977266484=/tmp/go-build -gno-record-gcc-switches"
CXX="g++"
CGO_ENABLED="1"
PKG_CONFIG="pkg-config"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"

英文:

I am using GO-GTK to display images, the project is working fine on amd64 but when I try to cross compile it for arm (RaspberryPi), it gives me below error.
Please advise how to cross-compile go-gtk from amd64 to arm (Raspberrypi3).

Compiler Output given below

    github.com/mattn/go-gtk/glib
# github.com/mattn/go-gtk/glib
In file included from /usr/lib/x86_64-linux-gnu/glib-2.0/include/glibconfig.h:9:0,
                 from /usr/include/glib-2.0/glib/gtypes.h:32,
                 from /usr/include/glib-2.0/glib/galloca.h:32,
                 from /usr/include/glib-2.0/glib.h:30,
                 from ./glib.go.h:4,
                 from src/github.com/mattn/go-gtk/glib/glib.go:5:
/usr/include/glib-2.0/glib/gtypes.h: In function '_GLIB_CHECKED_ADD_U64':
/usr/include/glib-2.0/glib/gmacros.h:232:53: error: size of array '_GStaticAssertCompileTimeAssertion_0' is negative
 #define G_STATIC_ASSERT(expr) typedef char G_PASTE (_GStaticAssertCompileTimeAssertion_, __COUNTER__)[(expr) ? 1 : -1] G_GNUC_UNUSED
                                                     ^
/usr/include/glib-2.0/glib/gmacros.h:229:47: note: in definition of macro 'G_PASTE_ARGS'
 #define G_PASTE_ARGS(identifier1,identifier2) identifier1 ## identifier2
                                               ^
/usr/include/glib-2.0/glib/gmacros.h:232:44: note: in expansion of macro 'G_PASTE'
 #define G_STATIC_ASSERT(expr) typedef char G_PASTE (_GStaticAssertCompileTimeAssertion_, __COUNTER__)[(expr) ? 1 : -1] G_GNUC_UNUSED
                                            ^
/usr/include/glib-2.0/glib/gtypes.h:422:3: note: in expansion of macro 'G_STATIC_ASSERT'
   G_STATIC_ASSERT(sizeof (unsigned long long) == sizeof (guint64));
   ^
github.com/mattn/go-gtk/pango
# github.com/mattn/go-gtk/pango
In file included from /usr/lib/x86_64-linux-gnu/glib-2.0/include/glibconfig.h:9:0,
                 from /usr/include/glib-2.0/glib/gtypes.h:32,
                 from /usr/include/glib-2.0/glib/galloca.h:32,
                 from /usr/include/glib-2.0/glib.h:30,
                 from /usr/include/pango-1.0/pango/pango-coverage.h:25,
                 from /usr/include/pango-1.0/pango/pango-font.h:25,
                 from /usr/include/pango-1.0/pango/pango-attributes.h:25,
                 from /usr/include/pango-1.0/pango/pango.h:25,
                 from ./pango.go.h:7,
                 from src/github.com/mattn/go-gtk/pango/pango.go:5:
/usr/include/glib-2.0/glib/gtypes.h: In function '_GLIB_CHECKED_ADD_U64':
/usr/include/glib-2.0/glib/gmacros.h:232:53: error: size of array '_GStaticAssertCompileTimeAssertion_0' is negative
 #define G_STATIC_ASSERT(expr) typedef char G_PASTE (_GStaticAssertCompileTimeAssertion_, __COUNTER__)[(expr) ? 1 : -1] G_GNUC_UNUSED
                                                     ^
/usr/include/glib-2.0/glib/gmacros.h:229:47: note: in definition of macro 'G_PASTE_ARGS'
 #define G_PASTE_ARGS(identifier1,identifier2) identifier1 ## identifier2
                                               ^
/usr/include/glib-2.0/glib/gmacros.h:232:44: note: in expansion of macro 'G_PASTE'
 #define G_STATIC_ASSERT(expr) typedef char G_PASTE (_GStaticAssertCompileTimeAssertion_, __COUNTER__)[(expr) ? 1 : -1] G_GNUC_UNUSED
                                            ^
/usr/include/glib-2.0/glib/gtypes.h:422:3: note: in expansion of macro 'G_STATIC_ASSERT'
   G_STATIC_ASSERT(sizeof (unsigned long long) == sizeof (guint64));

ENVIRONMENT VARIABLES

    GOARCH="arm"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/minhaj/GoLang"
GORACE=""
GOROOT="/usr/local/go"
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
GOARM=""
CC="arm-linux-gnueabi-gcc"
GOGCCFLAGS="-fPIC -marm -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build977266484=/tmp/go-build -gno-record-gcc-switches"
CXX="g++"
CGO_ENABLED="1"
PKG_CONFIG="pkg-config"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"

答案1

得分: 1

删除amd64 gtk库并重新安装32位库后,它正常工作。

英文:

After removing amd64 gtk libraries and reinstalling 32bit libraries it works fine.

huangapple
  • 本文由 发表于 2017年5月27日 22:10:17
  • 转载请务必保留本文链接:https://go.coder-hub.com/44217852.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定