Tencent / MMKV

An efficient, small mobile key-value storage framework developed by WeChat. Works on Android, iOS, macOS, Windows, and POSIX.
Other
17.08k stars 1.88k forks source link

在centos上无法通过POSIX/Python下的cmake #1337

Closed hxxyyangyong closed 2 days ago

hxxyyangyong commented 4 days ago

我在mac上所有的步骤都能成功,但是迁移到centos上就出现了错误

各种版本: cmake 3.20.2 Python 3.9.18 clang 16.0.6

不论是我自己构建: cd mmkv/POSIX mkdir build cd build cmake .. make

还是直接 python3 setup.py install

都是如下的报错 报错信息如下:

- The C compiler identification is GNU 11.4.1
-- The CXX compiler identification is GNU 11.4.1
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- The ASM compiler identification is GNU
-- Found assembler: /usr/bin/cc
-- pybind11 v2.8.0 
-- Found PythonInterp: /usr/bin/python3.9 (found version "3.9.18") 
-- Found PythonLibs: /usr/lib64/libpython3.9.so
-- Performing Test HAS_FLTO
-- Performing Test HAS_FLTO - Success
-- Configuring done
-- Generating done
-- Build files have been written to: XXX/MMKV/POSIX/Python/build
[  2%] Building CXX object Core/CMakeFiles/core.dir/MMKV.cpp.o
[  5%] Building CXX object Core/CMakeFiles/core.dir/MMKV_Android.cpp.o
[  8%] Building CXX object Core/CMakeFiles/core.dir/MMKV_IO.cpp.o
[ 11%] Building CXX object Core/CMakeFiles/core.dir/MMKV_OSX.cpp.o
[ 13%] Building CXX object Core/CMakeFiles/core.dir/MMKVLog.cpp.o
[ 16%] Building CXX object Core/CMakeFiles/core.dir/MMKVLog_Android.cpp.o
[ 19%] Building CXX object Core/CMakeFiles/core.dir/CodedInputData.cpp.o
[ 22%] Building CXX object Core/CMakeFiles/core.dir/CodedInputData_OSX.cpp.o
[ 25%] Building CXX object Core/CMakeFiles/core.dir/CodedInputDataCrypt.cpp.o
[ 27%] Building CXX object Core/CMakeFiles/core.dir/CodedInputDataCrypt_OSX.cpp.o
[ 30%] Building CXX object Core/CMakeFiles/core.dir/CodedOutputData.cpp.o
[ 33%] Building CXX object Core/CMakeFiles/core.dir/KeyValueHolder.cpp.o
[ 36%] Building CXX object Core/CMakeFiles/core.dir/PBUtility.cpp.o
In file included from xxx/MMKV/Core/PBUtility.cpp:20:
XXX/MMKV/Core/PBUtility.h: In function ‘uint32_t mmkv::pbMMBufferSize(const mmkv::MMBuffer&)’:
XXX/MMKV/Core/PBUtility.h:151:46: error: invalid use of incomplete type ‘const class mmkv::MMBuffer’
  151 |     auto valueLength = static_cast<uint32_t>(data.length());
      |                                              ^~~~
In file included from XXX/MMKV/Core/PBUtility.h:25,
                 from XXX/MMKV/Core/PBUtility.cpp:20:
XXX/MMKV/Core/MMKVPredef.h:171:7: note: forward declaration of ‘class mmkv::MMBuffer’
  171 | class MMBuffer;
      |       ^~~~~~~~
make[2]: *** [Core/CMakeFiles/core.dir/build.make:244: Core/CMakeFiles/core.dir/PBUtility.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:144: Core/CMakeFiles/core.dir/all] Error 2
make: *** [Makefile:91: all] Error 2
lingol commented 3 days ago

I currently don't have a CentOS env at hand, it will take some time. I noticed that in your posted log, you are using GCC. What's the version of it? And what is the version of your CentOS?

lingol commented 2 days ago

I just noticed that your code is not up to date. Line 20 of PBUtility.cpp in the master branch. https://github.com/Tencent/MMKV/blob/master/Core/PBUtility.cpp#L20

PS: the master branch is known for some GCC & Linux compile failures. You can checkout the dev branch for testing.

hxxyyangyong commented 2 days ago

我可以试试dev分支, 但我在mac上执行都是OK的,只是将执行环境迁移到了centOS而已,当然两边的基础环境工具版本是不一致的。

hxxyyangyong commented 2 days ago

dev branch is ok, need run setup.py ,custom build Still failed