OpenHarmony开发者论坛

标题: 编译poco库找不到shm_open方法 [打印本页]

作者: 杨益祥    时间: 2024-10-17 11:48
标题: 编译poco库找不到shm_open方法
[md]### 【问题描述】

1、编译poco库是找不到shm_*相关的函数

clang++: warning: argument unused during compilation: '--gcc-toolchain=/home/yyx/kuwoMusic/ohos/ohos-sdk/linux/native/llvm' [-Wunused-command-line-argument]
In file included from /home/yyx/kuwoMusic/ohos/poco-1.13.3/Foundation/src/SharedMemory.cpp:22:
/home/yyx/kuwoMusic/ohos/poco-1.13.3/Foundation/src/SharedMemory_POSIX.cpp:50:10: error: no member named 'shm_open' in the global namespace
_fd = ::shm_open(_name.c_str(), flags, S_IRUSR | S_IWUSR);
~~^
/home/yyx/kuwoMusic/ohos/poco-1.13.3/Foundation/src/SharedMemory_POSIX.cpp:59:5: error: no member named 'shm_unlink' in the global namespace
::shm_unlink(_name.c_str());
~~^
/home/yyx/kuwoMusic/ohos/poco-1.13.3/Foundation/src/SharedMemory_POSIX.cpp:129:5: error: no member named 'shm_unlink' in the global namespace
::shm_unlink(_name.c_str());
~~^
3 errors generated.
make[2]: *** [Foundation/CMakeFiles/Foundation.dir/build.make:1480: Foundation/CMakeFiles/Foundation.dir/src/SharedMemory.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
In file included from /home/yyx/kuwoMusic/ohos/poco-1.13.3/Foundation/src/Thread.cpp:28:
/home/yyx/kuwoMusic/ohos/poco-1.13.3/Foundation/src/Thread_POSIX.cpp:502:14: error: use of undeclared identifier 'pthread_setaffinity_np'; did you mean 'sched_setaffinity'?
return 0 == pthread_setaffinity_np(_pData->thread, sizeof(cpu_set_t), &cpuset);
^~~~~~~~~~~~~~~~~~~~~~
sched_setaffinity
/home/yyx/kuwoMusic/ohos/ohos-sdk/linux/native/sysroot/usr/include/sched.h:92:5: note: 'sched_setaffinity' declared here
int sched_setaffinity(pid_t, size_t, const cpu_set_t *);
^
In file included from /home/yyx/kuwoMusic/ohos/poco-1.13.3/Foundation/src/Thread.cpp:28:
/home/yyx/kuwoMusic/ohos/poco-1.13.3/Foundation/src/Thread_POSIX.cpp:514:11: error: use of undeclared identifier 'pthread_getaffinity_np'
if (0 == pthread_getaffinity_np(_pData->thread, sizeof(cpu_set_t), &cpuset))
^
2 errors generated.
make[2]: *** [Foundation/CMakeFiles/Foundation.dir/build.make:1779: Foundation/CMakeFiles/Foundation.dir/src/Thread.cpp.o] Error 1
make[2]: Leaving directory '/home/yyx/kuwoMusic/ohos/poco-1.13.3/ohos64build'
make[1]: *** [CMakeFiles/Makefile2:436: Foundation/CMakeFiles/Foundation.dir/all] Error 2
make[1]: Leaving directory '/home/yyx/kuwoMusic/ohos/poco-1.13.3/ohos64build'
make: *** [Makefile:152: all] Error 2

### 【运行环境】

SDK版本:version-Master_Version-OpenHarmony_4.0.10.5-20230824_120921-ohos-sdk-public_monthly.tar.gz
[/md]
作者: 深开鸿_王石    时间: 2024-10-17 15:16
shm_库是glibc的,ohos默认用的musl库,名字不一样,看看sys/shm.h




欢迎光临 OpenHarmony开发者论坛 (https://forums.openharmony.cn/) Powered by Discuz! X3.5