perl 在Mac OS Big Sur版本11.0.1上安装circos时缺少GD

8tntrjer  于 2023-05-23  发布在  Perl
关注(0)|答案(3)|浏览(498)

我发现在MacOS上安装Circos非常非常困难,我在Google上找到的所有答案都非常生 rust ,在MacOS Big Sur版本11.0.1上不适用。以下是我错过的:

(base) user@user-MacBook-Pro % circos -modules
ok       1.50 Carp
ok       0.45 Clone
ok       2.63 Config::General
ok       3.74 Cwd
ok      2.170 Data::Dumper
ok       2.55 Digest::MD5
ok       2.85 File::Basename
ok       3.74 File::Spec::Functions
ok     0.2304 File::Temp
ok       1.51 FindBin
ok       0.39 Font::TTF::Font
missing            GD
missing            GD::Polyline
ok        2.5 Getopt::Long
ok       1.39 IO::File
ok      0.430 List::MoreUtils
ok        1.5 List::Util
ok       0.01 Math::Bezier
ok   1.999811 Math::BigFloat
ok       0.07 Math::Round
ok       0.08 Math::VecStat
ok    1.03_01 Memoize
ok       1.84 POSIX
ok       1.30 Params::Validate
ok       1.69 Pod::Usage
ok       2.05 Readonly
ok 2017060201 Regexp::Common
ok       2.85 SVG
ok       1.19 Set::IntSpan
ok     1.6611 Statistics::Basic
ok    3.08_01 Storable
ok       1.22 Sys::Hostname
ok       2.03 Text::Balanced
ok       0.62 Text::Format
ok     1.9759 Time::HiRes

似乎唯一缺少的包是GD。所以我尝试安装GD。

(base) user@user-MacBook-Pro % curl -O http://www.cpan.org/authors/id/L/LD/LDS/GD-2.50.tar.gz
(base) user@user-MacBook-Pro % tar xvfz GD-2.50.tar.gz
(base) user@user-MacBook-Pro % cd GD-2.50
(base) user@user-MacBook-Pro % perl Makefile.pl
Notice: Type perl Makefile.PL -h for command-line option summary.

**UNRECOVERABLE ERROR**
Could not find gdlib-config in the search path. Please install libgd 2.0.28 or higher.
If you want to try to compile anyway, please rerun this script with the option --ignore_missing_gd.

再次,问题似乎是缺少libgd。我试着安装了一下:

(base) user@user-MacBook-Pro curl -O https://bitbucket.org/libgd/gd-libgd/downloads/libgd-2.1.0-rc2.tar.gz
(base) user@user-MacBook-Pro tar -xzvf libgd-2.1.0-rc2.tar.gz
(base) user@user-MacBook-Pro cd libgd-2.1.0-rc2
(base) user@user-MacBook-Pro ./configure
(base) user@user-MacBook-Pro make 
(base) user@user-MacBook-Pro sudo make install
........
Making install in config
 ../config/install-sh -c -d '/usr/local/bin'
 /usr/bin/install -c gdlib-config '/usr/local/bin'
 ../config/install-sh -c -d '/usr/local/lib/pkgconfig'
 /usr/bin/install -c -m 644 gdlib.pc '/usr/local/lib/pkgconfig'
Making install in tests
make[2]: Nothing to be done for `install-exec-am'.
make[2]: Nothing to be done for `install-data-am'.
make[2]: Nothing to be done for `install-exec-am'.
make[2]: Nothing to be done for `install-data-am'.

它仍然不工作我。任何建议将不胜感激。
谢谢苗

wixjitnu

wixjitnu1#

以下为我工作。我使用perlbrewperl版本5.30.1,macOS 11.0.1。

$ brew install pkg-config
$ brew install libgd
$ cpanm GD
mepcadol

mepcadol2#

我尝试了@Håkon Hægland的答案,但当我重新运行circos -modules时,它仍然显示GD丢失。我在这里尝试了另一个tutorial,它似乎对我有效。

wget http://search.cpan.org/CPAN/authors/id/L/LD/LDS/GD-2.51.tar.gz
tar xfvz ./GD-2.51.tar.gz
cd GD-2.51/
perl Makefile.PL 
make
sudo make install
erhoui1w

erhoui1w3#

tl;dr;

bundle config --local build.local-fastimage_resize --with-opt-dir="$(brew --prefix gd)"

说来话长
我找了一个同事在他的M1上为我试用。问题似乎来自于将默认自制前缀更改为/opt/homebrew,而不是之前的/usr/local
要重现一个简单的c程序可以使用(hello.c):

#include "gd.h"
#include <stdio.h>
int main() {
   printf("Hello");
   return 0;
}

然后可以尝试编译:

gcc -lgd hello.c -o hello

这在Intel Mac上有效,但在M1上失败。
要解决这个问题,可以设置正确的库查找(搜索)路径:

gcc -L/opt/homebrew/Cellar/gd/2.3.3_4/lib -lgd hello.c -o hello

我读到brew shellenv可以更好地解决这个问题,但我没有时间研究这种方法。
贷给:

相关问题