微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

无法在Windows上安装bcrypt 3.1.16 gem:ld.exe:找不到-lgmp

如何解决无法在Windows上安装bcrypt 3.1.16 gem:ld.exe:找不到-lgmp

我正在尝试更新我的捆绑软件,它需要bcrypt,但是由于失败而失败。

>bundle
Fetching bcrypt 3.1.16
Installing bcrypt 3.1.16 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    current directory: C:/ruby24/lib/ruby/gems/2.4.0/gems/bcrypt-3.1.16/ext/mri
C:/ruby24/bin/ruby.exe -r ./siteconf20201016-19812-xjdoy9.rb extconf.rb
creating Makefile

current directory: C:/ruby24/lib/ruby/gems/2.4.0/gems/bcrypt-3.1.16/ext/mri
make "DESTDIR=" clean

current directory: C:/ruby24/lib/ruby/gems/2.4.0/gems/bcrypt-3.1.16/ext/mri
make "DESTDIR="
generating bcrypt_ext-x64-mingw32.def
compiling bcrypt_ext.c
compiling crypt_blowfish.c
x86_64-w64-mingw32-gcc  -D__SKIP_GNU -D_FORTIFY_SOURCE=2
-D__USE_MINGW_ANSI_STdio=1 -DFD_SETSIZE=2048 -D_WIN32_WINNT=0x0501
-D__MINGW_USE_VC2005_COMPAT -D_FILE_OFFSET_BITS=64   -c -o x86.o x86.S
compiling crypt_gensalt.c
compiling wrapper.c
wrapper.c:182:60: warning: 'struct crypt_data' declared inside parameter list
[enabled by default]
wrapper.c:182:60: warning: its scope is only this deFinition or declaration,which is probably not what you want [enabled by default]
linking shared-object bcrypt_ext.so
c:/devkit2/mingw/bin/../lib/gcc/x86_64-w64-mingw32/4.7.2/../../../../x86_64-w64-mingw32/bin/ld.exe:
cannot find -lgmp
collect2.exe: error: ld returned 1 exit status
make: *** [bcrypt_ext.so] Error 1

make Failed,exit code 2

Gem files will remain installed in
C:/ruby24/lib/ruby/gems/2.4.0/gems/bcrypt-3.1.16 for inspection.
Results logged to
C:/ruby24/lib/ruby/gems/2.4.0/extensions/x64-mingw32/2.4.0/bcrypt-3.1.16/gem_make.out

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

In Gemfile:
  devise was resolved to 4.7.3,which depends on
    bcrypt

在制作过程中失败

C:\ruby24\lib\ruby\gems\2.4.0\gems\bcrypt-3.1.16\ext\mri>make
linking shared-object bcrypt_ext.so
c:/devkit2/mingw/bin/../lib/gcc/x86_64-w64-mingw32/4.7.2/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lgmp
collect2.exe: error: ld returned 1 exit status
make: *** [bcrypt_ext.so] Error 1

这是ld -lgmp --verbose所提供的

C:\ruby24\lib\ruby\gems\2.4.0\gems\bcrypt-3.1.16\ext\mri>ld -lgmp --verbose
GNU ld (rubenvb-4.7.2-release) 2.23.51.20120920
  Supported emulations:
   i386pep
   i386pe
using internal linker script:
==================================================
/* Default linker script,for normal executables */
OUTPUT_FORMAT(pei-x86-64)
SEARCH_DIR("=/usr/local/lib"); SEARCH_DIR("=/lib"); SEARCH_DIR("=/usr/lib");
SECTIONS
{
  /* Make the virtual address and file offset synced if the alignment is
     lower than the target page size. */
  . = SIZEOF_HEADERS;
  . = ALIGN(__section_alignment__);
  .text  __image_base__ + ( __section_alignment__ < 0x1000 ? . : __section_alignment__ ) :
  {
     *(.init)
    *(.text)
    *(SORT(.text$*))
     *(.text.*)
     *(.gnu.linkonce.t.*)
    *(.glue_7t)
    *(.glue_7)
    . = ALIGN(8);
     ___CTOR_LIST__ = .; __CTOR_LIST__ = . ;
                        LONG (-1); LONG (-1);*(.ctors); *(.ctor); *(SORT(.ctors.*));  LONG (0); LONG (0);
     ___DTOR_LIST__ = .; __DTOR_LIST__ = . ;
                        LONG (-1); LONG (-1); *(.dtors); *(.dtor); *(SORT(.dtors.*));  LONG (0); LONG (0);
     *(.fini)
    /* ??? Why is .gcc_exc here?  */
     *(.gcc_exc)
    PROVIDE (etext = .);
     *(.gcc_except_table)
  }
  /* The Cygwin32 library uses a section to avoid copying certain data
     on fork.  This used to be named ".data".  The linker used
     to include this between __data_start__ and __data_end__,but that
     breaks building the cygwin32 dll.  Instead,we name the section
     ".data_cygwin_nocopy" and explicitly include it after __data_end__. */
  .data BLOCK(__section_alignment__) :
  {
    __data_start__ = . ;
    *(.data)
    *(.data2)
    *(SORT(.data$*))
    *(.jcr)
    __data_end__ = . ;
    *(.data_cygwin_nocopy)
  }
  .rdata BLOCK(__section_alignment__) :
  {
    *(.rdata)
             *(SORT(.rdata$*))
    __rt_psrelocs_start = .;
    *(.rdata_runtime_pseudo_reloc)
    __rt_psrelocs_end = .;
  }
  __rt_psrelocs_size = __rt_psrelocs_end - __rt_psrelocs_start;
  ___RUNTIME_PSEUDO_RELOC_LIST_END__ = .;
  __RUNTIME_PSEUDO_RELOC_LIST_END__ = .;
  ___RUNTIME_PSEUDO_RELOC_LIST__ = . - __rt_psrelocs_size;
  __RUNTIME_PSEUDO_RELOC_LIST__ = . - __rt_psrelocs_size;
  .eh_frame BLOCK(__section_alignment__) :
  {
    *(.eh_frame*)
  }
  .pdata BLOCK(__section_alignment__) :
  {
    *(.pdata*)
  }
  .xdata BLOCK(__section_alignment__) :
  {
    *(.xdata*)
  }
  .bss BLOCK(__section_alignment__) :
  {
    __bss_start__ = . ;
    *(.bss)
    *(COMMON)
    __bss_end__ = . ;
  }
  .edata BLOCK(__section_alignment__) :
  {
    *(.edata)
  }
  /disCARD/ :
  {
    *(.debug$S)
    *(.debug$T)
    *(.debug$F)
    *(.drectve)
     *(.note.GNU-stack)
     *(.gnu.lto_*)
  }
  .idata BLOCK(__section_alignment__) :
  {
    /* This cannot currently be handled with grouped sections.
        See pep.em:sort_sections.  */
    SORT(*)(.idata$2)
    SORT(*)(.idata$3)
    /* These zeroes mark the end of the import list.  */
    LONG (0); LONG (0); LONG (0); LONG (0); LONG (0);
    SORT(*)(.idata$4)
    __IAT_start__ = .;
    SORT(*)(.idata$5)
    __IAT_end__ = .;
    SORT(*)(.idata$6)
    SORT(*)(.idata$7)
  }
  .CRT BLOCK(__section_alignment__) :
  {
    ___crt_xc_start__ = . ;
    *(SORT(.CRT$XC*))  /* C initialization */
    ___crt_xc_end__ = . ;
    ___crt_xi_start__ = . ;
    *(SORT(.CRT$XI*))  /* C++ initialization */
    ___crt_xi_end__ = . ;
    ___crt_xl_start__ = . ;
    *(SORT(.CRT$XL*))  /* TLS callbacks */
    /* ___crt_xl_end__ is defined in the TLS Directory support code */
    ___crt_xp_start__ = . ;
    *(SORT(.CRT$XP*))  /* Pre-termination */
    ___crt_xp_end__ = . ;
    ___crt_xt_start__ = . ;
    *(SORT(.CRT$XT*))  /* Termination */
    ___crt_xt_end__ = . ;
  }
  /* Windows TLS expects .tls$AAA to be at the start and .tls$ZZZ to be
     at the end of the .tls section.  This is important because _tls_start MUST
     be at the beginning of the section to enable SECREL32 relocations with TLS
     data.  */
  .tls BLOCK(__section_alignment__) :
  {
    ___tls_start__ = . ;
    *(.tls$AAA)
    *(.tls)
    *(.tls$)
    *(SORT(.tls$*))
    *(.tls$ZZZ)
    ___tls_end__ = . ;
  }
  .endjunk BLOCK(__section_alignment__) :
  {
    /* end is deprecated,don't use it */
    PROVIDE (end = .);
    PROVIDE ( _end = .);
     __end__ = .;
  }
  .rsrc BLOCK(__section_alignment__) :
  {
    *(.rsrc)
    *(SORT(.rsrc$*))
  }
  .reloc BLOCK(__section_alignment__) :
  {
    *(.reloc)
  }
  .stab BLOCK(__section_alignment__) (NOLOAD) :
  {
    *(.stab)
  }
  .stabstr BLOCK(__section_alignment__) (NOLOAD) :
  {
    *(.stabstr)
  }
  /* DWARF debug sections.
     Symbols in the DWARF debugging sections are relative to the beginning
     of the section.  Unlike other targets that fake this by putting the
     section VMA at 0,the PE format will not allow it.  */
  /* DWARF 1.1 and DWARF 2.  */
  .debug_aranges BLOCK(__section_alignment__) (NOLOAD) :
  {
    *(.debug_aranges)
  }
  .debug_pubnames BLOCK(__section_alignment__) (NOLOAD) :
  {
    *(.debug_pubnames)
  }
  .debug_pubtypes BLOCK(__section_alignment__) (NOLOAD) :
  {
    *(.debug_pubtypes)
  }
  /* DWARF 2.  */
  .debug_info BLOCK(__section_alignment__) (NOLOAD) :
  {
    *(.debug_info .gnu.linkonce.wi.*)
  }
  .debug_abbrev BLOCK(__section_alignment__) (NOLOAD) :
  {
    *(.debug_abbrev)
  }
  .debug_line BLOCK(__section_alignment__) (NOLOAD) :
  {
    *(.debug_line)
  }
  .debug_frame BLOCK(__section_alignment__) (NOLOAD) :
  {
    *(.debug_frame*)
  }
  .debug_str BLOCK(__section_alignment__) (NOLOAD) :
  {
    *(.debug_str)
  }
  .debug_loc BLOCK(__section_alignment__) (NOLOAD) :
  {
    *(.debug_loc)
  }
  .debug_macinfo BLOCK(__section_alignment__) (NOLOAD) :
  {
    *(.debug_macinfo)
  }
  /* sgi/MIPS DWARF 2 extensions.  */
  .debug_weaknames BLOCK(__section_alignment__) (NOLOAD) :
  {
    *(.debug_weaknames)
  }
  .debug_funcnames BLOCK(__section_alignment__) (NOLOAD) :
  {
    *(.debug_funcnames)
  }
  .debug_typenames BLOCK(__section_alignment__) (NOLOAD) :
  {
    *(.debug_typenames)
  }
  .debug_varnames BLOCK(__section_alignment__) (NOLOAD) :
  {
    *(.debug_varnames)
  }
  .debug_macro BLOCK(__section_alignment__) (NOLOAD) :
  {
    *(.debug_macro)
  }
  /* DWARF 3.  */
  .debug_ranges BLOCK(__section_alignment__) (NOLOAD) :
  {
    *(.debug_ranges)
  }
  /* DWARF 4.  */
  .debug_types BLOCK(__section_alignment__) (NOLOAD) :
  {
    *(.debug_types .gnu.linkonce.wt.*)
  }
}


==================================================
attempt to open /home/ruben/mingw-w64/mingw64mingw64/mingw64/usr/local/lib/libgmp.dll.a Failed
attempt to open /home/ruben/mingw-w64/mingw64mingw64/mingw64/usr/local/lib/gmp.dll.a Failed
attempt to open /home/ruben/mingw-w64/mingw64mingw64/mingw64/usr/local/lib/libgmp.a Failed
attempt to open /home/ruben/mingw-w64/mingw64mingw64/mingw64/usr/local/lib/gmp.lib Failed
attempt to open /home/ruben/mingw-w64/mingw64mingw64/mingw64/usr/local/lib/libgmp.dll Failed
attempt to open /home/ruben/mingw-w64/mingw64mingw64/mingw64/usr/local/lib/gmp.dll Failed
attempt to open /home/ruben/mingw-w64/mingw64mingw64/mingw64/usr/local/lib\libgmp.a Failed
attempt to open /home/ruben/mingw-w64/mingw64mingw64/mingw64/lib/libgmp.dll.a Failed
attempt to open /home/ruben/mingw-w64/mingw64mingw64/mingw64/lib/gmp.dll.a Failed
attempt to open /home/ruben/mingw-w64/mingw64mingw64/mingw64/lib/libgmp.a Failed
attempt to open /home/ruben/mingw-w64/mingw64mingw64/mingw64/lib/gmp.lib Failed
attempt to open /home/ruben/mingw-w64/mingw64mingw64/mingw64/lib/libgmp.dll Failed
attempt to open /home/ruben/mingw-w64/mingw64mingw64/mingw64/lib/gmp.dll Failed
attempt to open /home/ruben/mingw-w64/mingw64mingw64/mingw64/lib\libgmp.a Failed
attempt to open /home/ruben/mingw-w64/mingw64mingw64/mingw64/usr/lib/libgmp.dll.a Failed
attempt to open /home/ruben/mingw-w64/mingw64mingw64/mingw64/usr/lib/gmp.dll.a Failed
attempt to open /home/ruben/mingw-w64/mingw64mingw64/mingw64/usr/lib/libgmp.a Failed
attempt to open /home/ruben/mingw-w64/mingw64mingw64/mingw64/usr/lib/gmp.lib Failed
attempt to open /home/ruben/mingw-w64/mingw64mingw64/mingw64/usr/lib/libgmp.dll Failed
attempt to open /home/ruben/mingw-w64/mingw64mingw64/mingw64/usr/lib/gmp.dll Failed
attempt to open /home/ruben/mingw-w64/mingw64mingw64/mingw64/usr/lib\libgmp.a Failed
attempt to open /home/ruben/mingw-w64/mingw64mingw64/mingw64/usr/local/lib/libgmp.dll.a Failed
attempt to open /home/ruben/mingw-w64/mingw64mingw64/mingw64/usr/local/lib/gmp.dll.a Failed
attempt to open /home/ruben/mingw-w64/mingw64mingw64/mingw64/usr/local/lib/libgmp.a Failed
attempt to open /home/ruben/mingw-w64/mingw64mingw64/mingw64/usr/local/lib/gmp.lib Failed
attempt to open /home/ruben/mingw-w64/mingw64mingw64/mingw64/usr/local/lib/libgmp.dll Failed
attempt to open /home/ruben/mingw-w64/mingw64mingw64/mingw64/usr/local/lib/gmp.dll Failed
attempt to open /home/ruben/mingw-w64/mingw64mingw64/mingw64/usr/local/lib\gmp.lib Failed
attempt to open /home/ruben/mingw-w64/mingw64mingw64/mingw64/lib/libgmp.dll.a Failed
attempt to open /home/ruben/mingw-w64/mingw64mingw64/mingw64/lib/gmp.dll.a Failed
attempt to open /home/ruben/mingw-w64/mingw64mingw64/mingw64/lib/libgmp.a Failed
attempt to open /home/ruben/mingw-w64/mingw64mingw64/mingw64/lib/gmp.lib Failed
attempt to open /home/ruben/mingw-w64/mingw64mingw64/mingw64/lib/libgmp.dll Failed
attempt to open /home/ruben/mingw-w64/mingw64mingw64/mingw64/lib/gmp.dll Failed
attempt to open /home/ruben/mingw-w64/mingw64mingw64/mingw64/lib\gmp.lib Failed
attempt to open /home/ruben/mingw-w64/mingw64mingw64/mingw64/usr/lib/libgmp.dll.a Failed
attempt to open /home/ruben/mingw-w64/mingw64mingw64/mingw64/usr/lib/gmp.dll.a Failed
attempt to open /home/ruben/mingw-w64/mingw64mingw64/mingw64/usr/lib/libgmp.a Failed
attempt to open /home/ruben/mingw-w64/mingw64mingw64/mingw64/usr/lib/gmp.lib Failed
attempt to open /home/ruben/mingw-w64/mingw64mingw64/mingw64/usr/lib/libgmp.dll Failed
attempt to open /home/ruben/mingw-w64/mingw64mingw64/mingw64/usr/lib/gmp.dll Failed
attempt to open /home/ruben/mingw-w64/mingw64mingw64/mingw64/usr/lib\gmp.lib Failed
ld: cannot find -lgmp

Windows 8.1,Ruby 2.4

>ridk version
---
ruby:
  path: C:/ruby24
  version: 2.4.3
  platform: x64-mingw32
ruby_installer:
  package_version: 2.4.3-1
  git_commit: 36aac73
msys2:
  path: C:\msys64
  title: MSYS2 64bit
  version: '20161025'
cc: x86_64-w64-mingw32-gcc (rubenvb-4.7.2-release) 4.7.2
sh: GNU bash,version 4.3.46(2)-release (x86_64-pc-msys)
os: Microsoft Windows [Version 6.3.9600]

解决方法

我有一个MSYS2的旧版本,Ruby用来构建本机C ++ gem。我删除了旧的\msys64目录,并用Chocolatey(choco install msys2)重新安装,使用ridk install安装了构建工具,并且能够编译bcrypt gem。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。