c++ - 运行 perl 库时的 libz 冲突
问题描述
在 CentOS 7 Linux 上运行 coolname 3.10.0-957.27.2.el7.x86_64 #1 SMP Mon Jul 29 17:46:05 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
我们的应用程序是用 Perl 开发的,并使用 swig 和 XS 调用 c++ 库。它运行到 Centos。
我们有一个名为 db.pm 的 CORE 包,它实际上是用 c++ 编写的,并使用 XS 来允许 PERL 调用它。
使用 db.pm 我们有一个使用包 GD 打印 png 图像的 perl 代码。所以这段代码加载 db.pm ,获取数据库数据并创建一个图表并尝试打印它。
我们遇到的问题是,在加载 db.pm 时,我们认为 libz 已被访问,而在使用 GD 包时,它调用 libpng,该包也使用 libz。此时,当我们尝试打印图像时,我们有核心转储。
my $im = new GD::Image(100,100);
# allocate some colors
my $white = $im->colorAllocate(255,255,255);
my $black = $im->colorAllocate(0,0,0);
my $red = $im->colorAllocate(255,0,0);
my $blue = $im->colorAllocate(176,196,222);
# make the background transparent and interlaced
$im->transparent($white);
$im->interlaced('true');
# Put a black frame around the picture
$im->filledRectangle(0,0,50,50,'#f2f2f2');
# convert into png data
open my $out, '>', 'heatmap_img.png' or die;
binmode $out;
print $out $img->png;
print 'Success \n';
1;
解决方案
推荐阅读
- python - 我被困在如何将 Pytorch 代码转换为注意力模型的 Keras
- android - Android Studio 3.1.3 Gradle build error : Transformation exception and Conflicts found in the installation area
- python - Python - Geotext - 无法识别“里约热内卢”等城市
- excel - Excel中的图例键位置
- arrays - 删除包含特定键 JSON 的对象
- scala - 三个列表与猫的笛卡尔积
- android - 有没有办法从应用程序组件 dagger2 访问贡献模块实例
- macos - 如何永久更新 npm?
- php - 如果已经使用 php 准备语句从数据库中选择用户名和电子邮件
- android - 嵌套的 RecyclerViews:当 RecyclerView 正在计算布局或滚动时,无法调用 notifyDataSetChanged() 方法