簡體   English   中英

無法在 mac m1 big sur 上安裝 ruby​​-filemagic 0.7.2

[英]fail to install ruby-filemagic 0.7.2 on mac m1 big sur

安裝 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 */

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

有人可以幫助我,我被困在這個... *notes ---作為我之前使用 rbenv 的信息,它是否可能導致沖突或其他什么? 現在我使用 rmv

我遇到過同樣的問題。 我能夠通過使用以下命令安裝它來自對要點的評論

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

還有其他問題,包括--with-magic-include=/opt/homebrew/include --with-magic-lib=/opt/homebrew/lib/

如果沒有--source 'https://rubygems.org/'標志,它就無法工作。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM