安装 semacode (0.7.5) 时出错 gem
error occurred while installing semacode (0.7.5) gem
从 gem 文件安装 semacode gem 时出现问题。有办法解决这个问题吗?我正在 运行ning 捆绑安装。这是我的机器问题还是 gem 问题?当我尝试在本地 运行 应用程序时,这个问题确实第一次在我的机器上发生。
使用来自 https://github.com/toretore/semacode.git 的 semacode 0.7.5(在 master@4e31e0b)
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
make "DESTDIR=" clean
.rbenv/versions/2.3.5/lib/ruby/gems/2.3.0/bundler/gems/semacode-4e31e0b79a1a/ext
make "DESTDIR="
compiling reedsol.c
compiling semacode.c
semacode.c:61:3: error: implicit declaration of function 'iec16022init' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
iec16022init(&semacode->width, &semacode->height, message);
^
semacode.c:96:28: warning: 'bzero' call operates on objects of type 'semacode_t' (aka 'struct semacode_t') while the size is based on a different type 'semacode_t *' (aka 'struct
semacode_t *') [-Wsizeof-pointer-memaccess]
bzero(semacode, sizeof(semacode));
~~~~~~~~ ^~~~~~~~
semacode.c:96:28: note: did you mean to dereference the argument to 'sizeof' (and multiply it by the number of elements)?
bzero(semacode, sizeof(semacode));
^~~~~~~~
semacode.c:129:27: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
encode_string(semacode, StringValueLen(message), StringValuePtr(message));
~~~~~~~~~~~~~ ^~~~~~~~~~~~~~~~~~~~~~~
./semacode.h:26:27: note: expanded from macro 'StringValueLen'
#define StringValueLen(s) RSTRING_LEN(RB_STRING_VALUE(s))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
RSTRING_EMBED_LEN(str) : \
^~~~~~~~~~~~~~~~~~~~~~
(long)((RBASIC(str)->flags >> RSTRING_EMBED_LEN_SHIFT) & \
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
semacode.c:129:27: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
encode_string(semacode, StringValueLen(message), StringValuePtr(message));
~~~~~~~~~~~~~ ^~~~~~~~~~~~~~~~~~~~~~~
./semacode.h:26:27: note: expanded from macro 'StringValueLen'
#define StringValueLen(s) RSTRING_LEN(RB_STRING_VALUE(s))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-2.3.0/ruby/ruby.h:995:28: note: expanded from macro 'RSTRING_LEN'
RSTRING(str)->as.heap.len)
~~~~~~~~~~~~~~~~~~~~~~^~~
semacode.c:239:20: warning: equality comparison result unused [-Wunused-comparison]
semacode->data == NULL;
~~~~~~~~~~~~~~~^~~~~~~
semacode.c:239:20: note: use '=' to turn this equality comparison into an assignment
semacode->data == NULL;
^~
=
semacode.c:243:44: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
DATA_PTR(self) = encode_string(semacode, StringValueLen(message), StringValuePtr(message));
~~~~~~~~~~~~~ ^~~~~~~~~~~~~~~~~~~~~~~
./semacode.h:26:27: note: expanded from macro 'StringValueLen'
#define StringValueLen(s) RSTRING_LEN(RB_STRING_VALUE(s))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.rbenv/versions/2.3.5/include/ruby-2.3.0/ruby/ruby.h:994:6: note: expanded from macro 'RSTRING_LEN'
RSTRING_EMBED_LEN(str) : \
^~~~~~~~~~~~~~~~~~~~~~
.rbenv/versions/2.3.5/include/ruby-2.3.0/ruby/ruby.h:990:6: note: expanded from macro 'RSTRING_EMBED_LEN'
(long)((RBASIC(str)->flags >> RSTRING_EMBED_LEN_SHIFT) & \
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
semacode.c:243:44: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
DATA_PTR(self) = encode_string(semacode, StringValueLen(message), StringValuePtr(message));
~~~~~~~~~~~~~ ^~~~~~~~~~~~~~~~~~~~~~~
./semacode.h:26:27: note: expanded from macro 'StringValueLen'
#define StringValueLen(s) RSTRING_LEN(RB_STRING_VALUE(s))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.rbenv/versions/2.3.5/include/ruby-2.3.0/ruby/ruby.h:995:28: note: expanded from macro 'RSTRING_LEN'
RSTRING(str)->as.heap.len)
~~~~~~~~~~~~~~~~~~~~~~^~~
6 warnings and 1 error generated.
make: *** [semacode.o] Error 1
make failed, exit code 2
Gem files will remain installed in .rbenv/versions/2.3.5/lib/ruby/gems/2.3.0/bundler/gems/semacode-4e31e0b79a1a for inspection.
Results logged to .rbenv/versions/2.3.5/lib/ruby/gems/2.3.0/bundler/gems/extensions/x86_64-darwin-19/2.3.0-static/semacode-4e31e0b79a1a/gem_make.out
An error occurred while installing semacode (0.7.5), and Bundler cannot continue.
In Gemfile:
semacode
我在 macOS 上看到了一些类似的问题,这些问题是自 v12 发布后才开始出现的。如果您有 v12,您可以尝试从 download.developer.apple.com/Developer_Tools/... 降级到 v11.5,然后重试 gem 安装
学分 - @anothermh
试试这个
gem install semacode -v 0.7.5 -- --with-cflags="-Wno-error=implicit-function-declaration"
这里有更多信息:
Clang now reports an error when you use a function without an explicit declaration when building C or Objective-C code for macOS (-Werror=implicit-function-declaration flag is on). This additional error detection unifies Clang’s behavior for iOS/tvOS and macOS 64-bit targets for this diagnostic. (49917738)
https://developer.apple.com/documentation/xcode-release-notes/xcode-12-release-notes
从 gem 文件安装 semacode gem 时出现问题。有办法解决这个问题吗?我正在 运行ning 捆绑安装。这是我的机器问题还是 gem 问题?当我尝试在本地 运行 应用程序时,这个问题确实第一次在我的机器上发生。
使用来自 https://github.com/toretore/semacode.git 的 semacode 0.7.5(在 master@4e31e0b)
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
make "DESTDIR=" clean
.rbenv/versions/2.3.5/lib/ruby/gems/2.3.0/bundler/gems/semacode-4e31e0b79a1a/ext
make "DESTDIR="
compiling reedsol.c
compiling semacode.c
semacode.c:61:3: error: implicit declaration of function 'iec16022init' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
iec16022init(&semacode->width, &semacode->height, message);
^
semacode.c:96:28: warning: 'bzero' call operates on objects of type 'semacode_t' (aka 'struct semacode_t') while the size is based on a different type 'semacode_t *' (aka 'struct
semacode_t *') [-Wsizeof-pointer-memaccess]
bzero(semacode, sizeof(semacode));
~~~~~~~~ ^~~~~~~~
semacode.c:96:28: note: did you mean to dereference the argument to 'sizeof' (and multiply it by the number of elements)?
bzero(semacode, sizeof(semacode));
^~~~~~~~
semacode.c:129:27: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
encode_string(semacode, StringValueLen(message), StringValuePtr(message));
~~~~~~~~~~~~~ ^~~~~~~~~~~~~~~~~~~~~~~
./semacode.h:26:27: note: expanded from macro 'StringValueLen'
#define StringValueLen(s) RSTRING_LEN(RB_STRING_VALUE(s))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
RSTRING_EMBED_LEN(str) : \
^~~~~~~~~~~~~~~~~~~~~~
(long)((RBASIC(str)->flags >> RSTRING_EMBED_LEN_SHIFT) & \
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
semacode.c:129:27: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
encode_string(semacode, StringValueLen(message), StringValuePtr(message));
~~~~~~~~~~~~~ ^~~~~~~~~~~~~~~~~~~~~~~
./semacode.h:26:27: note: expanded from macro 'StringValueLen'
#define StringValueLen(s) RSTRING_LEN(RB_STRING_VALUE(s))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-2.3.0/ruby/ruby.h:995:28: note: expanded from macro 'RSTRING_LEN'
RSTRING(str)->as.heap.len)
~~~~~~~~~~~~~~~~~~~~~~^~~
semacode.c:239:20: warning: equality comparison result unused [-Wunused-comparison]
semacode->data == NULL;
~~~~~~~~~~~~~~~^~~~~~~
semacode.c:239:20: note: use '=' to turn this equality comparison into an assignment
semacode->data == NULL;
^~
=
semacode.c:243:44: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
DATA_PTR(self) = encode_string(semacode, StringValueLen(message), StringValuePtr(message));
~~~~~~~~~~~~~ ^~~~~~~~~~~~~~~~~~~~~~~
./semacode.h:26:27: note: expanded from macro 'StringValueLen'
#define StringValueLen(s) RSTRING_LEN(RB_STRING_VALUE(s))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.rbenv/versions/2.3.5/include/ruby-2.3.0/ruby/ruby.h:994:6: note: expanded from macro 'RSTRING_LEN'
RSTRING_EMBED_LEN(str) : \
^~~~~~~~~~~~~~~~~~~~~~
.rbenv/versions/2.3.5/include/ruby-2.3.0/ruby/ruby.h:990:6: note: expanded from macro 'RSTRING_EMBED_LEN'
(long)((RBASIC(str)->flags >> RSTRING_EMBED_LEN_SHIFT) & \
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
semacode.c:243:44: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
DATA_PTR(self) = encode_string(semacode, StringValueLen(message), StringValuePtr(message));
~~~~~~~~~~~~~ ^~~~~~~~~~~~~~~~~~~~~~~
./semacode.h:26:27: note: expanded from macro 'StringValueLen'
#define StringValueLen(s) RSTRING_LEN(RB_STRING_VALUE(s))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.rbenv/versions/2.3.5/include/ruby-2.3.0/ruby/ruby.h:995:28: note: expanded from macro 'RSTRING_LEN'
RSTRING(str)->as.heap.len)
~~~~~~~~~~~~~~~~~~~~~~^~~
6 warnings and 1 error generated.
make: *** [semacode.o] Error 1
make failed, exit code 2
Gem files will remain installed in .rbenv/versions/2.3.5/lib/ruby/gems/2.3.0/bundler/gems/semacode-4e31e0b79a1a for inspection.
Results logged to .rbenv/versions/2.3.5/lib/ruby/gems/2.3.0/bundler/gems/extensions/x86_64-darwin-19/2.3.0-static/semacode-4e31e0b79a1a/gem_make.out
An error occurred while installing semacode (0.7.5), and Bundler cannot continue.
In Gemfile:
semacode
我在 macOS 上看到了一些类似的问题,这些问题是自 v12 发布后才开始出现的。如果您有 v12,您可以尝试从 download.developer.apple.com/Developer_Tools/... 降级到 v11.5,然后重试 gem 安装
学分 - @anothermh
试试这个
gem install semacode -v 0.7.5 -- --with-cflags="-Wno-error=implicit-function-declaration"
这里有更多信息:
Clang now reports an error when you use a function without an explicit declaration when building C or Objective-C code for macOS (-Werror=implicit-function-declaration flag is on). This additional error detection unifies Clang’s behavior for iOS/tvOS and macOS 64-bit targets for this diagnostic. (49917738)
https://developer.apple.com/documentation/xcode-release-notes/xcode-12-release-notes