gpt4 book ai didi

ruby-on-rails - 无法在 mac m1 big sur 上安装 ruby​​-filemagic 0.7.2

转载 作者:行者123 更新时间:2023-12-02 02:00:12 26 4
gpt4 key购买 nike

安装 ruby​​-filemagic 0.7.2 失败我正在使用 mac M1 Bigsur ver 11.5.2

我已经尝试过的:

brew 安装 libmagic

已经安装但是仍然安装ruby-filemagic失败

这是日志:

    current directory: /Users/<username>/.rvm/gems/ruby-2.6.5/gems/ruby-filemagic-0.7.2/ext/filemagic
/Users/<username>/.rvm/rubies/ruby-2.6.5/bin/ruby -I /Users/<username>/.rvm/rubies/ruby-2.6.5/lib/ruby/site_ruby/2.6.0 -r ./siteconf20210907-83349-1lgxyp3.rb extconf.rb
checking for -lgnurx... no
checking for magic_open() in -lmagic... no
*** ERROR: missing required library to compile this module
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.

Provided configuration options:
--with-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/Users/<username>/.rvm/rubies/ruby-2.6.5/bin/$(RUBY_BASE_NAME)
--with-magic-dir
--without-magic-dir
--with-magic-include
--without-magic-include=${magic-dir}/include
--with-magic-lib
--without-magic-lib=${magic-dir}/lib
--with-gnurx-dir
--without-gnurx-dir
--with-gnurx-include
--without-gnurx-include=${gnurx-dir}/include
--with-gnurx-lib
--without-gnurx-lib=${gnurx-dir}/lib
--with-gnurxlib
--without-gnurxlib
--with-magiclib
--without-magiclib

To see why this extension failed to compile, please check the mkmf.log which can be found here:

/Users/<username>/.rvm/gems/ruby-2.6.5/extensions/-darwin-20/2.6.0/ruby-filemagic-0.7.2/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /Users/<username>/.rvm/gems/ruby-2.6.5/gems/ruby-filemagic-0.7.2 for inspection.
Results logged to /Users/<username>/.rvm/gems/ruby-2.6.5/extensions/-darwin-20/2.6.0/ruby-filemagic-0.7.2/gem_make.out

An error occurred while installing ruby-filemagic (0.7.2), and Bundler cannot continue.
Make sure that `gem install ruby-filemagic -v '0.7.2' --source 'https://rubygems.org/'` succeeds before bundling.

In Gemfile:
ruby-filemagic

日志来自:/Users//.rvm/gems/ruby-2.6.5/extensions/-darwin-20/2.6.0/ruby-filemagic-0.7.2/mkmf.log

have_library: checking for -lgnurx... -------------------- no

"gcc -o conftest -I/Users/<username>/.rvm/rubies/ruby-2.6.5/include/ruby-2.6.0/-darwin20 -I/Users/<username>/.rvm/rubies/ruby-2.6.5/include/ruby-2.6.0/ruby/backward -I/Users/<username>/.rvm/rubies/ruby-2.6.5/include/ruby-2.6.0 -I. -I/opt/local/include -I/usr/local/include -I/usr/include -I/opt/homebrew/opt/libyaml/include -I/opt/homebrew/opt/libksba/include -I/opt/homebrew/opt/readline/include -I/opt/homebrew/opt/zlib/include -I/opt/homebrew/opt/openssl@1.1/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -Wno-error=implicit-function-declaration -ggdb3 -Wall -Wextra -Wdeclaration-after-statement -Wdeprecated-declarations -Wdivision-by-zero -Wimplicit-function-declaration -Wimplicit-int -Wmisleading-indentation -Wpointer-arith -Wshorten-64-to-32 -Wwrite-strings -Wmissing-noreturn -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wunused-variable -Wextra-tokens -fno-common -pipe conftest.c -L. -L/Users/<username>/.rvm/rubies/ruby-2.6.5/lib -L/opt/local/lib -L/usr/local/lib -L/usr/lib -L/opt/homebrew/opt/libyaml/lib -L/opt/homebrew/opt/libksba/lib -L/opt/homebrew/opt/readline/lib -L/opt/homebrew/opt/zlib/lib -L/opt/homebrew/opt/openssl@1.1/lib -L. -fstack-protector-strong -L/opt/homebrew/opt/libyaml/lib -L/opt/homebrew/opt/libksba/lib -L/opt/homebrew/opt/readline/lib -L/opt/homebrew/opt/zlib/lib -L/opt/homebrew/opt/openssl@1.1/lib -lruby.2.6 "
ld: warning: directory not found for option '-L/opt/local/lib'
ld: warning: directory not found for option '-L/usr/local/opt/openssl/lib/'
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: int main(int argc, char **argv)
4: {
5: return 0;
6: }
/* end */

"gcc -o conftest -I/Users/<username>/.rvm/rubies/ruby-2.6.5/include/ruby-2.6.0/-darwin20 -I/Users/<username>/.rvm/rubies/ruby-2.6.5/include/ruby-2.6.0/ruby/backward -I/Users/<username>/.rvm/rubies/ruby-2.6.5/include/ruby-2.6.0 -I. -I/opt/local/include -I/usr/local/include -I/usr/include -I/opt/homebrew/opt/libyaml/include -I/opt/homebrew/opt/libksba/include -I/opt/homebrew/opt/readline/include -I/opt/homebrew/opt/zlib/include -I/opt/homebrew/opt/openssl@1.1/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -Wno-error=implicit-function-declaration -ggdb3 -Wall -Wextra -Wdeclaration-after-statement -Wdeprecated-declarations -Wdivision-by-zero -Wimplicit-function-declaration -Wimplicit-int -Wmisleading-indentation -Wpointer-arith -Wshorten-64-to-32 -Wwrite-strings -Wmissing-noreturn -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wunused-variable -Wextra-tokens -fno-common -pipe conftest.c -L. -L/Users/<username>/.rvm/rubies/ruby-2.6.5/lib -L/opt/local/lib -L/usr/local/lib -L/usr/lib -L/opt/homebrew/opt/libyaml/lib -L/opt/homebrew/opt/libksba/lib -L/opt/homebrew/opt/readline/lib -L/opt/homebrew/opt/zlib/lib -L/opt/homebrew/opt/openssl@1.1/lib -L. -fstack-protector-strong -L/opt/homebrew/opt/libyaml/lib -L/opt/homebrew/opt/libksba/lib -L/opt/homebrew/opt/readline/lib -L/opt/homebrew/opt/zlib/lib -L/opt/homebrew/opt/openssl@1.1/lib -lruby.2.6 -lgnurx "
ld: warning: directory not found for option '-L/opt/local/lib'
ld: warning: directory not found for option '-L/usr/local/opt/openssl/lib/'
ld: library not found for -lgnurx
clang: error: linker command failed with exit code 1 (use -v to see invocation)
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: /*top*/
4: extern int t(void);
5: int main(int argc, char **argv)
6: {
7: if (argc > 1000000) {
8: int (* volatile tp)(void)=(int (*)(void))&t;
9: printf("%d", (*tp)());
10: }
11:
12: return 0;
13: }
14:
15: int t(void) { ; return 0; }
/* end */

--------------------

have_library: checking for magic_open() in -lmagic... -------------------- no

"gcc -o conftest -I/Users/<username>/.rvm/rubies/ruby-2.6.5/include/ruby-2.6.0/-darwin20 -I/Users/<username>/.rvm/rubies/ruby-2.6.5/include/ruby-2.6.0/ruby/backward -I/Users/<username>/.rvm/rubies/ruby-2.6.5/include/ruby-2.6.0 -I. -I/opt/local/include -I/usr/local/include -I/usr/include -I/opt/homebrew/opt/libyaml/include -I/opt/homebrew/opt/libksba/include -I/opt/homebrew/opt/readline/include -I/opt/homebrew/opt/zlib/include -I/opt/homebrew/opt/openssl@1.1/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -Wno-error=implicit-function-declaration -ggdb3 -Wall -Wextra -Wdeclaration-after-statement -Wdeprecated-declarations -Wdivision-by-zero -Wimplicit-function-declaration -Wimplicit-int -Wmisleading-indentation -Wpointer-arith -Wshorten-64-to-32 -Wwrite-strings -Wmissing-noreturn -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wunused-variable -Wextra-tokens -fno-common -pipe conftest.c -L. -L/Users/<username>/.rvm/rubies/ruby-2.6.5/lib -L/opt/local/lib -L/usr/local/lib -L/usr/lib -L/opt/homebrew/opt/libyaml/lib -L/opt/homebrew/opt/libksba/lib -L/opt/homebrew/opt/readline/lib -L/opt/homebrew/opt/zlib/lib -L/opt/homebrew/opt/openssl@1.1/lib -L. -fstack-protector-strong -L/opt/homebrew/opt/libyaml/lib -L/opt/homebrew/opt/libksba/lib -L/opt/homebrew/opt/readline/lib -L/opt/homebrew/opt/zlib/lib -L/opt/homebrew/opt/openssl@1.1/lib -lruby.2.6 -lmagic "
conftest.c:14:57: error: use of undeclared identifier 'magic_open'
int t(void) { void ((*volatile p)()); p = (void ((*)()))magic_open; return !p; }
^
1 error generated.
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: /*top*/
4: extern int t(void);
5: int main(int argc, char **argv)
6: {
7: if (argc > 1000000) {
8: int (* volatile tp)(void)=(int (*)(void))&t;
9: printf("%d", (*tp)());
10: }
11:
12: return 0;
13: }
14: int t(void) { void ((*volatile p)()); p = (void ((*)()))magic_open; return !p; }
/* end */

"gcc -o conftest -I/Users/<username>/.rvm/rubies/ruby-2.6.5/include/ruby-2.6.0/-darwin20 -I/Users/<username>/.rvm/rubies/ruby-2.6.5/include/ruby-2.6.0/ruby/backward -I/Users/<username>/.rvm/rubies/ruby-2.6.5/include/ruby-2.6.0 -I. -I/opt/local/include -I/usr/local/include -I/usr/include -I/opt/homebrew/opt/libyaml/include -I/opt/homebrew/opt/libksba/include -I/opt/homebrew/opt/readline/include -I/opt/homebrew/opt/zlib/include -I/opt/homebrew/opt/openssl@1.1/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -Wno-error=implicit-function-declaration -ggdb3 -Wall -Wextra -Wdeclaration-after-statement -Wdeprecated-declarations -Wdivision-by-zero -Wimplicit-function-declaration -Wimplicit-int -Wmisleading-indentation -Wpointer-arith -Wshorten-64-to-32 -Wwrite-strings -Wmissing-noreturn -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wunused-variable -Wextra-tokens -fno-common -pipe conftest.c -L. -L/Users/<username>/.rvm/rubies/ruby-2.6.5/lib -L/opt/local/lib -L/usr/local/lib -L/usr/lib -L/opt/homebrew/opt/libyaml/lib -L/opt/homebrew/opt/libksba/lib -L/opt/homebrew/opt/readline/lib -L/opt/homebrew/opt/zlib/lib -L/opt/homebrew/opt/openssl@1.1/lib -L. -fstack-protector-strong -L/opt/homebrew/opt/libyaml/lib -L/opt/homebrew/opt/libksba/lib -L/opt/homebrew/opt/readline/lib -L/opt/homebrew/opt/zlib/lib -L/opt/homebrew/opt/openssl@1.1/lib -lruby.2.6 -lmagic "
ld: warning: directory not found for option '-L/opt/local/lib'
ld: warning: directory not found for option '-L/usr/local/opt/openssl/lib/'
ld: library not found for -lmagic
clang: error: linker command failed with exit code 1 (use -v to see invocation)
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: /*top*/
4: extern int t(void);
5: int main(int argc, char **argv)
6: {
7: if (argc > 1000000) {
8: int (* volatile tp)(void)=(int (*)(void))&t;
9: printf("%d", (*tp)());
10: }
11:
12: return 0;
13: }
14: extern void magic_open();
15: int t(void) { magic_open(); return 0; }
/* end */

--------------------

谁能帮帮我,我被困在这个...*注意---作为我以前使用 rbenv 的信息,它是否可能导致冲突或其他什么?现在我使用 rmv

最佳答案

我遇到了同样的问题。我可以使用 a comment on a gist 中的以下命令安装它

gem install ruby​​-filemagic -v '0.7.2' --source 'https://rubygems.org/' --with-magic-include=/opt/homebrew/include --with -magic-lib=/opt/homebrew/lib/

还有其他questions包括 --with-magic-include=/opt/homebrew/include --with-magic-lib=/opt/homebrew/lib/

如果没有 --source 'https://rubygems.org/' 标志,它就无法工作。

关于ruby-on-rails - 无法在 mac m1 big sur 上安装 ruby​​-filemagic 0.7.2,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69083813/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com