amazon-web-services - 将 jpostal/libpostal 部署到 EC2 实例中
问题描述
我正在尝试将 jpostal 工件部署到 EC2 实例中,以便我们的 Web 应用程序可以使用该库。据我了解,“scr/main/jniLibs”中的 jni 文件链接到“/usr/local/include/libpostal”和“/usr/local/lib/”中的 c 库。但是,我无权将“libpostal.h”写入“/usr/local/include/libpostal”和“pkgconfig,libpostal.a,libpostal.la,libpostal.so,libpostal.so.1,libpostal.so .1.0.0" 到 EC2 实例中的 "/usr/local/lib/"。有什么解决办法吗?
谢谢。
解决方案
I managed to build and save all artefacts into a local folder, e.g. "/app/libpostal/" and then the deployment process is simply copying them to the same folder in a EC2 machine. The key thing is to use ./configure command to specify all the folders to store the artefacts and there is a tricky step where I use my own jpostal_build.sh instead of the default one:
1. Custom "jpostal_build.sh" has 2 lines:
./bootstrap.sh
./configure --libdir=/app/libpostal/jniLibs make install
2. The main script "generate_jpostal_artifacts.sh":
#!/bin/bash
#################################################
## Build jpostal and libpostal artefacts
#################################################
#Install required build tools
sudo apt-get install curl autoconf automake libtool pkg-config
#Clean up and checkout libpostal from github
sudo rm -rf /app/libpostal
sudo mkdir -p /app/libpostal
sudo chown -R $USER /app
git clone https://github.com/openvenues/libpostal
cd libpostal
./bootstrap.sh
#Configure data directory and C libraries location
./configure --prefix=/app/libpostal --datadir=/app/libpostal/datadir
#Build libpostal
make -j4 make install sudo ldconfig cd ..
#Build jpostal
rm -rf ./jpostal
git clone https://github.com/openvenues/jpostal.git
cp jpostal_build.sh ./jpostal/build.sh
export PKG_CONFIG_PATH=/app/libpostal/lib/pkgconfig/
pkg-config --cflags --libs libpostal
cd jpostal
./gradlew assemble
cd ..
#################################################
## zip all libpostal/jpostal artifacts for future deployment
#################################################
cd /app
tar -cvzf totalcheck-libpostal-1.0.0.tar.gz libpostal
#################################################
## Create config file for local
#################################################
echo $(pwd)/libpostal/jniLibs > /var/tmp/libpostal_configs.txt
echo $(pwd)/libpostal/datadir/libpostal >> /var/tmp/libpostal_configs.txt
推荐阅读
- ibm-cloud - 如何在 Watson Assistant 上配置用户名和密码
- python - “连接到 SC2 websocket 失败。它起来了吗?”
- java - Bitmap.getPixel(x,y) 根据设备返回不同的颜色
- java - 如何将所有选定的 jcheckbox 值插入数据库
- html - css 表格列不会与固定标题对齐
- c - 允许哪些分配返回值?
- python - 为 CustomUser 指定的未知字段(密码 1、密码 2)
- html - Bootstrap4 导航链接活动顶部边框样式
- windows - 如何使用 vb.net 计算一天的总收入?
- c - 如何使用 qsort 对结构进行排序