BlueRoseNote/03-UnrealEngine/流程管理与部署/Ubantu平台Puerts编译问题解决.md

51 lines
2.2 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
title: Ubantu平台Puerts编译问题解决
date: 2023-09-15 15:50:48
excerpt:
tags:
- Ubantu
- Puerts
- Docker
rating: ⭐⭐⭐
---
# 前言
本人使用的版本是[Unreal_v1.0.5](https://github.com/Tencent/puerts/releases/tag/Unreal_v1.0.5)的Nodejs版本首先使用Ubantu23.04进行测试之后换成了Ubantu22.04。Puerts在UbantuLinux上部署的坑也比较多遂写此文。
# Linux上的编译问题解决
1. FileSystemOperation.cpp
1. `#include "HAL/PlatformFilemanager.h" => #include "HAL/PlatformFileManager.h"`
2. Compile PesapiFrameworkLoader.mm error: Objective-C was disabled in PCH file but is currently enabled
1. 将PesapiFrameworkLoader.mm的后缀名改成PesapiFrameworkLoader.cpp
## V8环境库问题
报错内容:**ld.lld: error: unable to find library -lnode**
在询问作者后得知是V8环境库的编译环境与系统环境不符所致需要自己编译库来解决。
>https://github.com/Tencent/puerts/issues/1521
大致方法就是下载并且运行编译脚本自己编译库。该库2月16日Released的版本在Ubantu22.04上测试通过所以建议大家使用Ubantu22.04。其他版本需要自己编译。
>https://github.com/puerts/backend-nodejs
### 编译所需要的库
```bash
sudo apt-get install clang
sudo apt-get install libc++-dev
sudo apt-get install libc++abi-dev
curl -sL https://deb.nodesource.com/setup_16.x | sudo -e bash -
sudo apt-get install -y nodejs
cd /home/user/Projects/backend-nodejs/node-script
npm install -s commander
# 部分纯净系统可能需要安装这2个东西
sudo apt-get install make
sudo apt-get install git
```
因为该脚本是为Gihub Action编写的其他还支持Ubuntu 20.04镜像,可以参考 https://github.com/actions/runner-images/ 。如果你是其他版本的系统就需要自己clone该仓库并且修改脚本进行编译。编译完文件会在/home/user/node/out/Release
调用方式:
```bash
./linux.sh 工作目录路径 16.x
```
这里我推荐修改脚本直接手动指定2个参数并且删除会报错地方之后就可以编译了。编译完替换**Plugins\Puerts\ThirdParty\nodejs_16\lib\Linux**中文件即可。
# UE-Runtime容器部署问题