Skip to content

Commit

Permalink
doc: add dependency doc (#544)
Browse files Browse the repository at this point in the history
  • Loading branch information
yyuuttaaoo committed Dec 2, 2022
1 parent ad909ce commit c24dccc
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 5 deletions.
31 changes: 26 additions & 5 deletions docs/cn/developer-guide/development-environment.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ docker目录和scripts目录分别为辅助编译的镜像描述目录和脚本

## 开发镜像

iLogtail依赖了诸多第三方库(详见[编译依赖](./dependencies.md)),为了简化编译流程ilogtail提供了预编译依赖的镜像辅助编译。开发镜像的地址在`sls-registry.cn-beijing.cr.aliyuncs.com/sls-microservices/ilogtail-build-linux-amd64`,可通过下面命令获取。
iLogtail依赖了诸多第三方库(详见[编译依赖](./dependencies.md)),为了简化编译流程ilogtail提供了预编译依赖的镜像辅助编译。开发镜像的地址在`sls-opensource-registry.cn-shanghai.cr.aliyuncs.com/ilogtail-community-edition/ilogtail-build-linux`,可通过下面命令获取。

```shell
docker pull sls-registry.cn-beijing.cr.aliyuncs.com/sls-microservices/ilogtail-build-linux-amd64
docker pull sls-opensource-registry.cn-shanghai.cr.aliyuncs.com/ilogtail-community-edition/ilogtail-build-linux
```

开发镜像预先安装了gcc和go编译器,更新了git,为了代码风格统一安装了clang-format、go-tools,为了便于调试也安装了gdb、go-delve等工具。为方便国内开发者,预先设置了GOPROXY="[https://goproxy.cn,direct"](https://goproxy.cn,direct")
Expand All @@ -63,7 +63,7 @@ bin include lib lib64 share ssl
如果需要安装更多工具或编译依赖,可以在开发镜像上镜像叠加,制作自定义的开发镜像。

```dockerfile
from sls-registry.cn-beijing.cr.aliyuncs.com/sls-microservices/ilogtail-build-linux-amd64
from sls-opensource-registry.cn-shanghai.cr.aliyuncs.com/ilogtail-community-edition/ilogtail-build-linux
yum -y install ...
go install ...
```
Expand All @@ -82,7 +82,7 @@ go install ...

```json
{
"image": "sls-registry.cn-beijing.cr.aliyuncs.com/sls-microservices/ilogtail-build-linux-amd64:latest",
"image": "sls-opensource-registry.cn-shanghai.cr.aliyuncs.com/ilogtail-community-edition/ilogtail-build-linux:latest",
"customizations": {
"vscode": {
"extensions": [
Expand Down Expand Up @@ -186,7 +186,7 @@ cp -a ./core/build/plugin/libPluginAdapter.so ./output
```bash
docker run --name ilogtail-build -d \
-v `pwd`:/src -w /src \
sls-registry.cn-beijing.cr.aliyuncs.com/sls-microservices/ilogtail-build-linux-amd64:latest \
sls-opensource-registry.cn-shanghai.cr.aliyuncs.com/ilogtail-community-edition/ilogtail-build-linux:latest \
bash -c "sleep infinity"
```

Expand Down Expand Up @@ -237,3 +237,24 @@ scp libPluginBase.so <user>@<node>:/home/<user>
```bash
cp /logtail_host/home/<user>/libPluginBase.so /usr/local/ilogtail
```

## 常见问题

### 1. 更新代码后编译错误

如果发生编译错误,如

``` shell
/src/core/common/CompressTools.cpp:18:23: fatal error: zstd/zstd.h: No such file or directory
#include <zstd/zstd.h>
^
compilation terminated.
```

请确保本地编译镜像为最新版本。可使用以下命令更新:

``` shell
docker pull sls-opensource-registry.cn-shanghai.cr.aliyuncs.com/ilogtail-community-edition/ilogtail-build-linux
```

若使用VS Code进行开发,请重新编译开发容器镜像。使用Shift + Command + P(Mac)或Ctrl + Shift + P(Win)打开命令面板,输入rebuild,选择`Dev-Containers: Rebuild Without Cache and Reopen in Container`
15 changes: 15 additions & 0 deletions docs/cn/installation/sources/build.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,21 @@ Makefile描述了整个项目的所有编译目标,主要的包括:
VERSION=1.1.1 make dist
```

如果发生编译错误,如

``` shell
/src/core/common/CompressTools.cpp:18:23: fatal error: zstd/zstd.h: No such file or directory
#include <zstd/zstd.h>
^
compilation terminated.
```

请确保本地编译镜像为最新版本。可使用以下命令更新:

``` shell
docker pull sls-opensource-registry.cn-shanghai.cr.aliyuncs.com/ilogtail-community-edition/ilogtail-build-linux
```

## 使用镜像编译完整iLogtail

编译完整iLogtail的命令是`make all`,由于all是默认的编译目标,因此也可以直接`make`。该命令首先清理`output`目录,然后调用`./scripts/gen_build_scripts.sh`脚本生成编译用的脚本和镜像描述保存到`./gen`目录,调用 docker 制作镜像,制作的过程即镜像内的编译过程,最后将镜像内的编译结果复制到`output`目录。
Expand Down
1 change: 1 addition & 0 deletions docs/cn/installation/sources/dependencies.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,4 @@
| 16 | breakpad ([66571f4838b2306161f072555cb199049bc68142](https://github.com/google/breakpad/tree/66571f4838b2306161f072555cb199049bc68142)) | Windows上崩溃诊断 |
| 17 | leveldb ([1.22](https://github.com/google/leveldb/releases/tag/1.22)) | |
| 18 | yaml-cpp ([0.7.0](https://github.com/jbeder/yaml-cpp/releases/tag/yaml-cpp-0.7.0)) | 解析YAML配置 |
| 19 | zstd ([1.5.2](https://github.com/facebook/zstd/releases/tag/v1.5.2)) | zstd压缩发送数据 |

0 comments on commit c24dccc

Please sign in to comment.