【问题标题】:Refusing to link macOS-provided software: libiconv拒绝链接 macOS 提供的软件:libiconv
【发布时间】:2020-02-08 09:27:13
【问题描述】:

为了按照posted here 的步骤让 nokogiri 正常工作,我似乎无法正确链接 iconv。

当我运行命令时

brew link libiconv

我收到以下错误:

Warning: Refusing to link macOS-provided software: libiconv
If you need to have libiconv first in your PATH run:
  echo 'export PATH="/usr/local/opt/libiconv/bin:$PATH"' >> ~/.bash_profile

For compilers to find libiconv you may need to set:
  export LDFLAGS="-L/usr/local/opt/libiconv/lib"
  export CPPFLAGS="-I/usr/local/opt/libiconv/include"

我已将上述路径添加到我的 bash 配置文件中,重新加载终端,重新启动终端,甚至尝试重新启动计算机,但错误仍然存​​在。我也尝试过重新安装 libiconv 但无济于事(请参阅下面的输出)。

$ brew reinstall libiconv 
==> Reinstalling libiconv 
==> Downloading https://homebrew.bintray.com/bottles/libiconv-1.16.mojave.bottle.tar.gz
Already downloaded: /Users/sam/Library/Caches/Homebrew/downloads/203933f4d9f3c2f0463012d85013a6c01bdb89fc4d435341315b4537de1dba78--libiconv-1.16.mojave.bottle.tar.gz
==> Pouring libiconv-1.16.mojave.bottle.tar.gz
==> Caveats
libiconv is keg-only, which means it was not symlinked into /usr/local,
because macOS already provides this software and installing another version in
parallel can cause all kinds of trouble.

If you need to have libiconv first in your PATH run:
  echo 'export PATH="/usr/local/opt/libiconv/bin:$PATH"' >> ~/.bash_profile

For compilers to find libiconv you may need to set:
  export LDFLAGS="-L/usr/local/opt/libiconv/lib"
  export CPPFLAGS="-I/usr/local/opt/libiconv/include"

==> Summary
????  /usr/local/Cellar/libiconv/1.16: 30 files, 2.4MB

【问题讨论】:

    标签: homebrew symlink libiconv


    【解决方案1】:

    libiconv 仅限酒桶

    ❯ brew info libiconv
    libiconv: stable 1.16 (bottled) [keg-only]
    Conversion library
    https://www.gnu.org/software/libiconv/
    Not installed
    From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/libiconv.rb
    ==> Caveats
    libiconv is keg-only, which means it was not symlinked into /usr/local,
    because macOS already provides this software and installing another version in
    parallel can cause all kinds of trouble.
    

    在您提供的帖子链接中,不需要链接libiconv。因为只使用了真实的安装位置,而不是链接的位置。跳过这个link 步骤并运行以下命令,

    # use the real installation location is not preferred, cause it will
    # break you once the libiconv is upgraded to a new version
    gem install nokogiri -- --with-iconv-dir=/usr/local/Cellar/libiconv/1.16
    
    # you'd better pass the dir "/usr/local/opt/libiconv", 
    # which serves as a link to the real installation location.
    gem install nokogiri -- --with-iconv-dir=/usr/local/opt/libiconv
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-09-19
      • 1970-01-01
      • 2023-03-30
      • 2014-08-19
      • 1970-01-01
      相关资源
      最近更新 更多