【发布时间】:2016-09-25 12:46:04
【问题描述】:
我想安装 perl Gtk2,为此我需要先安装 Glib。我试过sudo cpanm Glib,但是编译的时候报错(我也试过下载.tar.gz源码等,效果一样)。我也尝试过使用旧版本的 Glib。我在 OS X 10.11 (El Capitan) 上。这是错误:
error: '_GStaticAssertCompileTimeAssertion_0' declared as an array with a negative size
我不知道如何解决它......如果有人能为我做点什么,非常感谢!
(顺便说一句,brew install glib 工作正常,但似乎我正在尝试构建和运行的应用程序 - 例如自动多项选择 - 正在某处寻找 Gtk2.pm。所以,安装的“glib”自制软件没有帮助。)
本杰明
p.-s。 :以下是完整的日志,如果有帮助:
cpanm (App::cpanminus) 1.7042 on perl 5.018002 built for darwin-thread-multi-2level
Work directory is /Users/benjamin/.cpanm/work/1474765262.7331
You have make /usr/bin/make
You have LWP 6.05
You have /usr/bin/tar: bsdtar 2.8.3 - libarchive 2.8.3
You have /usr/bin/unzip
Searching Glib () on cpanmetadb ...
--> Working on Glib
Fetching http://www.cpan.org/authors/id/X/XA/XAOC/Glib-1.322.tar.gz
-> OK
Unpacking Glib-1.322.tar.gz
Entering Glib-1.322
Checking configure dependencies from META.json
Checking if you have ExtUtils::MakeMaker 6.58 ... Yes (6.66)
Checking if you have ExtUtils::PkgConfig 1.000 ... Yes (1.15)
Checking if you have ExtUtils::Depends 0.300 ... Yes (0.306)
Configuring Glib-1.322
Running Makefile.PL
Including generated API documentation...
Checking if your kit is complete...
Looks good
Writing Makefile for Glib
Writing MYMETA.yml and MYMETA.json
-> OK
Checking dependencies from MYMETA.json ...
Checking if you have ExtUtils::Depends 0.300 ... Yes (0.306)
Checking if you have ExtUtils::PkgConfig 1.000 ... Yes (1.15)
Checking if you have ExtUtils::MakeMaker 0 ... Yes (6.66)
Building and testing Glib-1.322
cp lib/Glib/CodeGen.pm blib/lib/Glib/CodeGen.pm
cp /Users/benjamin/.cpanm/work/1474765262.7331/Glib-1.322/typemap blib/arch/Glib/Install/typemap
cp lib/Glib/ParseXSDoc.pm blib/lib/Glib/ParseXSDoc.pm
cp doctypes blib/arch/Glib/Install/doctypes
cp devel.pod blib/lib/Glib/devel.pod
cp gperl_marshal.h blib/arch/Glib/Install/gperl_marshal.h
cp lib/Glib/MakeHelper.pm blib/lib/Glib/MakeHelper.pm
cp gperl.h blib/arch/Glib/Install/gperl.h
cp lib/Glib.pm blib/lib/Glib.pm
cp lib/Glib/Object/Subclass.pm blib/lib/Glib/Object/Subclass.pm
cp build/IFiles.pm blib/arch/Glib/Install/Files.pm
cp lib/Glib/GenPod.pm blib/lib/Glib/GenPod.pm
[ XS Glib.xs ]
[ CC Glib.c ]
In file included from Glib.xs:22:
In file included from ./gperl.h:37:
In file included from /usr/local/Cellar/glib/2.48.2/include/glib-2.0/glib-object.h:23:
In file included from /usr/local/Cellar/glib/2.48.2/include/glib-2.0/gobject/gbinding.h:28:
In file included from /usr/local/Cellar/glib/2.48.2/include/glib-2.0/glib.h:30:
In file included from /usr/local/Cellar/glib/2.48.2/include/glib-2.0/glib/galloca.h:32:
/usr/local/Cellar/glib/2.48.2/include/glib-2.0/glib/gtypes.h:422:3: error: '_GStaticAssertCompileTimeAssertion_0' declared as an array with a negative size
G_STATIC_ASSERT(sizeof (unsigned long long) == sizeof (guint64));
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/Cellar/glib/2.48.2/include/glib-2.0/glib/gmacros.h:232:103: note: expanded from macro 'G_STATIC_ASSERT'
#define G_STATIC_ASSERT(expr) typedef char G_PASTE (_GStaticAssertCompileTimeAssertion_, __COUNTER__)[(expr) ? 1 : -1] G_GNUC_UNUSED
^~~~~~~~~~~~~~~
1 error generated.
make: *** [Glib.o] Error 1
-> FAIL Installing Glib failed. See
/Users/benjamin/.cpanm/work/1474765262.7331/build.log for details. Retry with --force to force install it.
【问题讨论】:
-
这在 10.11.6 上使用来自MacPorts 的 glib2 @ 2.48.2 和通过 perlbrew 安装的 Perl 5.20.2 对我来说编译得很好。 MacPorts 版本has patches 可能 HomeBrew 没有。
-
感谢您的回答。更新perl(通过perlbrew 5.24.0)后,我终于成功构建了Glib!不幸的是,现在是 Gtk2 无法编译……!
-
图形库和 Perl 是出了名的不稳定。但它对我有用!™ 再次使用来自 MacPorts 的 gtk2 @ 2.24.31 和来自 Perlbrew 的 5.20.2。 MacPorts 还提供了一个 Gtk2.pm 包 (p5-gtk2)。您可能希望备份到 Perl 5.20 或 5.22 以让模块修复 5.24 引起的任何问题。
-
不幸的是,仍然无法使用 Perl 5.20.2,也无法使用 5.22.2。我可能会开始一个新话题,因为现在无法构建的是 Gtk2,而不是 Glib。无论如何感谢您的帮助!