当前位置: 首页 > news >正文

c++项目从aws服务器转移到mac编译

一,确认要迁移的目录和引用的包,查看Makefile文件,发现用到库目录/data/mrun/pcks,把当前的nm.s目录和/data/mrun/pcks打包,下载到mac上

二,下载到mac上之后,更改Makefile

三,遇到的报错

1,fatal error: 'ini.h' file not found

需要执行 brew install inih,成功后在/opt/homebrew/include目录下会有ini.h

2,fatal error: 'ixwebsocket/IXWebSocket.h' file not found

需要重新下载项目编译

#如果cmake找不到,就安装一下
brew install cmake

cd /Users/mini04/Desktop/data/zl/c++/pcks
git clone https://github.com/machinezone/IXWebSocket.git
cd IXWebSocket
mkdir build
cd build
cmake ..
make

安装成功

.h 文件找不到的,路径加在这里

3,fatal error: 'LightGBM/c_api.h' file not found

brew install lightgbm

安装成功之后在这里会有/opt/homebrew/include

4,fatal error: 'sodium.h' file not found

brew install libsodium

安装成功在这里/opt/homebrew/include

5,fatal error: 'cpprest/http_client.h' file not found

brew install cpprestsdk

6,

long out_len; // 原代码 改成 

int64_t out_len; // 修改为 int64_t

g++ -std=c++17 -Wall -g -I./src -I/Users/mini04/Desktop/data/zl/c++/pcks/uWebSockets/src -I/Users/mini04/Desktop/data/zl/c++/pcks/uWebSockets/uSockets/src -I/Users/mini04/Desktop/data/zl/c++/pcks/spdlog/include -I/opt/homebrew/include/  -Isrc/wsclients -Isrc/exchangeinfo -Isrc/client -Isrc/stgs -I/Users/mini04/Desktop/data/zl/c++/pcks/IXWebSocket-master/ -c src/stgs/Stgs.cpp -o build/stgs/Stgs.o
src/stgs/Stgs.cpp:303:17: error: no matching function for call to 'LGBM_BoosterPredictForMat'303 |             if (LGBM_BoosterPredictForMat(|                 ^~~~~~~~~~~~~~~~~~~~~~~~~
/opt/homebrew/include/LightGBM/c_api.h:1281:23: note: candidate function not viable: no known conversion from 'long *' to 'int64_t *' (aka 'long long *') for 11th argument1281 | LIGHTGBM_C_EXPORT int LGBM_BoosterPredictForMat(BoosterHandle handle,|                       ^1282 |                                                 const void* data,1283 |                                                 int data_type,1284 |                                                 int32_t nrow,1285 |                                                 int32_t ncol,1286 |                                                 int is_row_major,1287 |                                                 int predict_type,1288 |                                                 int start_iteration,1289 |                                                 int num_iteration,1290 |                                                 const char* parameter,1291 |                                                 int64_t* out_len,|                                                 ~~~~~~~~~~~~~~~~
src/stgs/Stgs.cpp:729:13: error: no matching function for call to 'LGBM_BoosterPredictForMat'729 |         if (LGBM_BoosterPredictForMat(|             ^~~~~~~~~~~~~~~~~~~~~~~~~
/opt/homebrew/include/LightGBM/c_api.h:1281:23: note: candidate function not viable: no known conversion from 'long *' to 'int64_t *' (aka 'long long *') for 11th argument1281 | LIGHTGBM_C_EXPORT int LGBM_BoosterPredictForMat(BoosterHandle handle,|                       ^1282 |                                                 const void* data,1283 |                                                 int data_type,1284 |                                                 int32_t nrow,1285 |                                                 int32_t ncol,1286 |                                                 int is_row_major,1287 |                                                 int predict_type,1288 |                                                 int start_iteration,1289 |                                                 int num_iteration,1290 |                                                 const char* parameter,1291 |                                                 int64_t* out_len,|                                                 ~~~~~~~~~~~~~~~~
src/stgs/Stgs.cpp:837:18: warning: unused variable 'ret' [-Wunused-variable]837 |             bool ret = orders->cancel(p.get(), pred);|                  ^~~
src/stgs/Stgs.cpp:858:18: warning: unused variable 'ret' [-Wunused-variable]858 |             bool ret = orders->cancel(p.get(), pred);|                  ^~~
In file included from src/stgs/Stgs.cpp:1:
src/stgs/Stgs.h:36:19: warning: private field 'p_exinfo' is not used [-Wunused-private-field]36 |     ExchangeInfo* p_exinfo;|                   ^
3 warnings and 2 errors generated.
make: *** [build/stgs/Stgs.o] Error 1

7,library ':lib_lightgbm.so' not found

在 macOS 上,动态库的扩展名与 Linux 系统不同。在 macOS 上,动态库使用 .dylib 作为文件扩展名,而在 Linux 系统上,动态库通常使用 .so(Shared Object)作为扩展名。这是操作系统之间的一个标准差异。

brew install lightgbm

安装成功:

8,

ld: archive member '/' not a mach-o file in '/Users/mini04/Desktop/data/zl/c++/pcks/uWebSockets/uSockets/libuSockets.a'

cd /Users/mini04/Desktop/data/zl/c++/pcks
git clone https://github.com/uNetworking/uWebSockets.git
cd uWebSockets如果报错:/bin/sh: lib.exe: command not found修改 Makefile文件,lib.exe /out:uSockets.a *.o || ar rvs uSockets.a *.o改成ar rcs uSockets.a *.o
需要下面的两个包
git clone https://github.com/uNetworking/uSockets.git
cd uSockets
make
cd ..
git clone https://github.com/ebiggers/libdeflate.git
cd libdeflate
make
cd ..
如果报错 clang: error: unsupported option '-fopenmp'如果不需要 OpenMP 支持,可以直接从 Makefile 中删除 -fopenmp 选项。找到使用 cc 编译的那一行,去掉 -fopenmp,然后再尝试执行 make

9,如果找不到某个文件,看下文件名称是否是   lib需要的文件名.后缀  ,如果不是,改成这样的格式

http://www.dtcms.com/a/283988.html

相关文章:

  • Spring Boot 自动配置:从 spring.factories 到 AutoConfiguration.imports 的演变
  • 深入理解 SemaphoreSlim 在.NET Core API 开发中的应用
  • 【DOCKER】综合项目 MonitorHub (监控中心)
  • Java集合处理库——collection-complete
  • 模型材质一键替换~轻松还原多种三维场景
  • Jmeter的安装
  • ESP32——基于idf框架开发I2C设备
  • Redis红锁中的看门狗机制
  • 如何解决pip安装报错ModuleNotFoundError: No module named ‘flask’问题
  • 【SpringBoot】实战-开发接口-用户-登录
  • APIs案例及知识点串讲(中)
  • docker--安装--原理
  • 寻找数组中的多数元素:HashMap方法解析
  • 【无标题】构建黑洞虚维度空间的完整理论
  • COZE官方文档基础知识解读第五期 —— 插件
  • Android默认背光亮度配置说明
  • 如何清除 npm 缓存
  • web前端渡一大师课 CSS属性计算过程
  • 【Android】ViewBinding(视图绑定)
  • 华为P30/pro (ELE-AL00) 鸿蒙4.2降级 EMUI 9
  • 单片机+微信小程序做示波器
  • 深入解析:前端 localStorage 的读取是异步的吗?为什么硬盘 I/O 是异步的,而它却是同步的?
  • Linux 软件安装的四种方式详解
  • HTTP 状态码笔记
  • 网络原理 —— HTTP
  • uniapp用webview导入本地网页,ios端打开页面空白问题
  • 自定义 django 中间件
  • 《小白学习产品经理》第六章:方法论之SWOT分析
  • 3D工业相机是什么?如何选择和使用它?
  • docker安装与简单项目上手