【问题标题】:installing gdk-pixbuf on Elastic Beanstalk v2在 Elastic Beanstalk v2 上安装 gdk-pixbuf
【发布时间】:2021-07-29 17:50:31
【问题描述】:

我正在尝试让 Django-Weasyprint 在 AWS Linux2 Elastic Beanstalk 实例上正常工作。我遇到了[这个问题][1],当我将代码添加到 .platform/hooks/predeploy 时,图像都可以工作,但 href 链接停止工作。

因此,我尝试升级脚本中的软件包,我的脚本现在看起来像:

#!/usr/bin/env bash

yum install -y libxml2-devel libxslt-devel python-devel redhat-rpm-config libffi-devel cairo pango

export PKG_CONFIG_PATH=/usr/lib64/pkgconfig:/usr/lib/pkgconfig
export PATH=/usr/bin:$PATH
export LDFLAGS=-L/usr/lib64:/usr/lib
export LD_LIBRARY_PATH=/usr/lib64:/usr/lib
export CPPFLAGS=-I/usr/include

sudo yum-config-manager --enable epel
sudo yum update -y
sudo yum install -y gcc gcc-c++ glib2-devel.x86_64 libxml2-devel.x86_64 libpng-devel.x86_64 \
libjpeg-turbo-devel.x86_64 gobject-introspection.x86_64 gobject-introspection-devel.x86_64

wget http://ftp.gnome.org/pub/GNOME/sources/libcroco/0.6/libcroco-0.6.13.tar.xz
tar xvfJ libcroco-0.6.13.tar.xz
cd libcroco-0.6.13
./configure --prefix=/usr
make
sudo make install
cd ..

wget http://ftp.gnome.org/pub/GNOME/sources/gdk-pixbuf/2.42/gdk-pixbuf-2.42.6.tar.xz
tar xvfJ gdk-pixbuf-2.42.6.tar.xz
cd gdk-pixbuf-2.42.6
./configure --prefix=/usr --without-libtiff
make
sudo make install
cd ..

sudo yum install -y pixman-devel.x86_64 harfbuzz-devel.x86_64 freetype-devel.x86_64

wget http://www.freedesktop.org/software/fontconfig/release/fontconfig-2.13.93.tar.gz
tar xvf fontconfig-2.13.93.tar.gz
cd fontconfig-2.13.93
./configure --prefix=/usr --enable-libxml2
make
sudo make install
cd ..

wget http://cairographics.org/releases/cairo-1.16.0.tar.xz
tar xvfJ cairo-1.16.0.tar.xz
cd cairo-1.16.0
./configure --prefix=/usr
make
sudo make install
cd ..

wget http://ftp.gnome.org/pub/GNOME/sources/pango/1.48/pango-1.48.4.tar.xz
tar xvfJ pango-1.48.4.tar.xz
cd pango-1.48.4
./configure --prefix=/usr
make
sudo make install
cd ..

wget http://ftp.gnome.org/pub/GNOME/sources/librsvg/2.50/librsvg-2.50.5.tar.xz
tar xvfJ librsvg-2.50.5.tar.xz
cd librsvg-2.50.5
./configure --prefix=/usr
make
sudo make install
cd ..


sudo ldconfig /usr/lib

它会产生以下错误:

OSError:无法加载库“libpangocairo-1.0.so.0”: /lib64/libpangoft2-1.0.so.0:未定义符号: FcWeightFromOpenTypeDouble

我不知道如何解决,希望得到一些帮助 - 谢谢 [1]:Django Weasyprint on Elastic Beanstalk - Could not load GDK-Pixbuf

【问题讨论】:

    标签: django linux amazon-web-services


    【解决方案1】:

    对我来说,解决方案是将以下01_weasyprint.sh 文件放入hooks > predeploy > 01_weasyprint.sh

    #!/usr/bin/env bash
    
    yum install -y libxml2-devel libxslt-devel python-devel redhat-rpm-config libffi-devel cairo pango
    
    export PKG_CONFIG_PATH=/usr/lib64/pkgconfig:/usr/lib/pkgconfig
    export PATH=/usr/bin:$PATH
    export LDFLAGS=-L/usr/lib64:/usr/lib
    export LD_LIBRARY_PATH=/usr/lib64:/usr/lib
    export CPPFLAGS=-I/usr/include
    
    sudo yum-config-manager --enable epel
    sudo yum update -y
    sudo yum install -y gcc gcc-c++ glib2-devel.x86_64 libxml2-devel.x86_64 libpng-devel.x86_64 \
    libjpeg-turbo-devel.x86_64 gobject-introspection.x86_64 gobject-introspection-devel.x86_64
    
    wget http://ftp.gnome.org/pub/GNOME/sources/libcroco/0.6/libcroco-0.6.8.tar.xz
    tar xvfJ libcroco-0.6.8.tar.xz
    cd libcroco-0.6.8
    ./configure --prefix=/usr
    make
    sudo make install
    cd ..
    
    wget http://ftp.gnome.org/pub/GNOME/sources/gdk-pixbuf/2.28/gdk-pixbuf-2.28.2.tar.xz
    tar xvfJ gdk-pixbuf-2.28.2.tar.xz
    cd gdk-pixbuf-2.28.2
    ./configure --prefix=/usr --without-libtiff
    make
    sudo make install
    cd ..
    
    sudo yum install -y pixman-devel.x86_64 harfbuzz-devel.x86_64 freetype-devel.x86_64
    
    wget http://www.freedesktop.org/software/fontconfig/release/fontconfig-2.13.93.tar.gz
    tar xvf fontconfig-2.13.93.tar.gz
    cd fontconfig-2.13.93
    ./configure --prefix=/usr --enable-libxml2
    make
    sudo make install
    cd ..
    
    wget http://cairographics.org/releases/cairo-1.16.0.tar.xz
    tar xvfJ cairo-1.16.0.tar.xz
    cd cairo-1.16.0
    ./configure --prefix=/usr
    make
    sudo make install
    cd ..
    
    wget http://ftp.gnome.org/pub/GNOME/sources/pango/1.48/pango-1.48.4.tar.xz
    tar xvfJ pango-1.48.4.tar.xz
    cd pango-1.48.4
    ./configure --prefix=/usr
    make
    sudo make install
    cd ..
    
    wget http://ftp.gnome.org/pub/GNOME/sources/librsvg/2.40/librsvg-2.40.6.tar.xz
    tar xvfJ librsvg-2.40.6.tar.xz
    cd librsvg-2.40.6
    ./configure --prefix=/usr
    make
    sudo make install
    cd ..
    
    
    sudo ldconfig /usr/lib
    

    【讨论】:

      猜你喜欢
      • 2017-06-08
      • 2018-05-12
      • 2014-09-15
      • 2017-03-26
      • 2013-07-08
      • 2013-03-21
      • 2014-11-15
      • 2017-01-07
      • 2020-05-16
      相关资源
      最近更新 更多