• Lv0
    粉丝0

积分0 / 贡献0

提问1答案被采纳0文章0

作者动态

    编译poco库找不到shm_open方法

    杨益祥 显示全部楼层 发表于 2024-10-17 11:48:04

    【问题描述】

    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

    您尚未登录,无法参与评论,登录后可以:
    参与开源共建问题交流
    认同或收藏高质量问答
    获取积分成为开源共建先驱

    精彩评论1

    深开鸿_王石

    沙发 发表于 2024-10-17 15:16:46
    shm_库是glibc的,ohos默认用的musl库,名字不一样,看看sys/shm.h

    Copyright   ©2023  OpenHarmony开发者论坛  京ICP备2020036654号-3 |技术支持 Discuz!

    返回顶部