Closed jiangxianfu closed 10 months ago
使用deps/3rd/obproxy.el8.x86_64.deps进行编译,产生如下报错
# 新版linux 内核移除了该头文件
src/obproxy/utils/ob_proxy_lib.h:94:10: fatal error: sys/sysctl.h: No such file or directory
# glibc 2.33 中移除,改用mallinfo2
ob_mod_define.cpp:97:37: error: ‘mallinfo mallinfo()’ is deprecated`
# glibc 2.30 以上, gettid()重名
./lib/ob_define.h:1219:16: error: ambiguating new declaration of ‘int64_t gettid()’
1219 | inline int64_t gettid()
| ^~~~~~
In file included from /usr/include/unistd.h:1208,
from ./lib/utility/utility.h:18,
from lib/utility/utility.cpp:15:
/usr/include/bits/unistd_ext.h:34:16: note: old declaration ‘__pid_t gettid()’
34 | extern __pid_t gettid (void) __THROW;
在进行以下修改后编译通过了
1. 移除 include<sys/sysctl.h>
2. mallinfo 都改为 mallinfo2
3. ob_define.h 中gettid重命名
4. devdeps-gtest-1.8.0-3.el8.x86_64.rpm 改为 devdeps-gtest-1.8.0-132022101316.el8.x86_64.rpm,不改会有#43同样问题
5. 添加-Wformat=0,否则会有报错
Alma Linux 9.1 内核 5.14.0 编译问题
使用deps/3rd/obproxy.el8.x86_64.deps进行编译,产生如下报错
# 新版linux 内核移除了该头文件 src/obproxy/utils/ob_proxy_lib.h:94:10: fatal error: sys/sysctl.h: No such file or directory # glibc 2.33 中移除,改用mallinfo2 ob_mod_define.cpp:97:37: error: ‘mallinfo mallinfo()’ is deprecated` # glibc 2.30 以上, gettid()重名 ./lib/ob_define.h:1219:16: error: ambiguating new declaration of ‘int64_t gettid()’ 1219 | inline int64_t gettid() | ^~~~~~ In file included from /usr/include/unistd.h:1208, from ./lib/utility/utility.h:18, from lib/utility/utility.cpp:15: /usr/include/bits/unistd_ext.h:34:16: note: old declaration ‘__pid_t gettid()’ 34 | extern __pid_t gettid (void) __THROW;
在进行以下修改后编译通过了
1. 移除 include<sys/sysctl.h> 2. mallinfo 都改为 mallinfo2 3. ob_define.h 中gettid重命名 4. devdeps-gtest-1.8.0-3.el8.x86_64.rpm 改为 devdeps-gtest-1.8.0-132022101316.el8.x86_64.rpm,不改会有#43同样问题 5. 添加-Wformat=0,否则会有报错
Good job! Can you continue to raise a PR?
Sure, but I need to test my modifications on other platform (el7/8) first :-)
Describe your use case
应该是centos9/alma9 的gcc默认版本是11.3.1 gcc --version gcc (GCC) 11.3.1 20220421 (Red Hat 11.3.1-2) Copyright (C) 2021 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
lib/allocator/ob_mod_define.cpp:97:37: error: ‘mallinfo mallinfo()’ is deprecated [-Werror=deprecated-declarations] 97 | struct mallinfo info = mallinfo(); | ^ In file included from lib/allocator/ob_mod_define.cpp:15: /usr/include/malloc.h:113:24: note: declared here 113 | extern struct mallinfo mallinfo (void) THROW MALLOC_DEPRECATED; | ^
~~~ lib/allocator/ob_mod_define.cpp:97:37: error: ‘mallinfo mallinfo()’ is deprecated [-Werror=deprecated-declarations] 97 | struct mallinfo info = mallinfo(); | ^ In file included from lib/allocator/ob_mod_define.cpp:15: /usr/include/malloc.h:113:24: note: declared here 113 | extern struct mallinfo mallinfo (void) THROW MALLOC_DEPRECATED;../src/obproxy/utils/ob_proxy_lib.h:94:10: fatal error: sys/sysctl.h: No such file or directory 94 | #include <sys/sysctl.h> | ^
~~~~~ compilation terminated. make[3]: [Makefile:6220: lib/allocator/ob_malloc.lo] Error 1 cc1plus: all warnings being treated as errors make[3]: [Makefile:6220: lib/allocator/ob_mod_define.lo] Error 1 In file included from ../src/obproxy/iocore/net/ob_inet.h:38, from ./lib/net/ob_addr.h:22, from lib/net/ob_addr.cpp:15: ../src/obproxy/utils/ob_proxy_lib.h:94:10: fatal error: sys/sysctl.h: No such file or directory 94 | #include <sys/sysctl.h> | ^~~~~~ compilation terminated. make[3]: [Makefile:6220: lib/net/ob_addr.lo] Error 1 make[3]: Leaving directory '/data/workspace/obproxy-4/src' make[2]: [Makefile:2931: all] Error 2 make[2]: Leaving directory '/data/workspace/obproxy-4/src' make[1]: [Makefile:460: all-recursive] Error 1 make[1]: Leaving directory '/data/workspace/obproxy-4' make: [Makefile:371: all] Error 2Describe the solution you'd like
希望能兼容下高版本系统 centos9/alam9
Describe alternatives you've considered
No response
Additional context
No response