diff --git "a/\351\227\256\351\242\230\344\277\256\346\224\271\346\226\207\346\241\243/openssh.1.md" "b/\351\227\256\351\242\230\344\277\256\346\224\271\346\226\207\346\241\243/openssh.1.md" new file mode 100644 index 0000000000000000000000000000000000000000..1dcab7a7a42c39dfdf46199e6ff02e689789b6a8 --- /dev/null +++ "b/\351\227\256\351\242\230\344\277\256\346\224\271\346\226\207\346\241\243/openssh.1.md" @@ -0,0 +1,20 @@ +# openssh.1 # + +## 1、问题现象 ## +出自:https://gitee.com/src-openeuler/openssh(openEuler-24.03-LTS) + +``` +[ 188s] ssh-ecdsa.c:267:6: error: call to undeclared function 'is_ecdsa_pkcs11'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration] +[ 188s] 267 | if (is_ecdsa_pkcs11(key->ecdsa)) { ^ +``` +## 2、问题定位及根因分析 ## + +源代码中没有出现问题代码 +问题出在openssh-9.3p1-merged-openssl-evp.patch中 +is_ecdsa_pkcs11函数调用了一个未声明的函数,而这个函数在ssh-pkcs11.h中定义了,这就是导致这个问题的原因 +`if (key->ecdsa != NULL && is_ecdsa_pkcs11(key->ecdsa)) {` +## 3、修改建议 ## + +在ssh-rsa.c和ssh-ecdsa.c中加入头文件 +即`#include "ssh-pkcs11.h"` +就能消除这个错误 diff --git "a/\351\227\256\351\242\230\344\277\256\346\224\271\346\226\207\346\241\243/openssh.2.md" "b/\351\227\256\351\242\230\344\277\256\346\224\271\346\226\207\346\241\243/openssh.2.md" new file mode 100644 index 0000000000000000000000000000000000000000..e64567c4da6e9a24f5c020023558bc062b3c9309 --- /dev/null +++ "b/\351\227\256\351\242\230\344\277\256\346\224\271\346\226\207\346\241\243/openssh.2.md" @@ -0,0 +1,57 @@ +# openssh.2 # + +## 1、问题现象 ## +出自:https://gitee.com/src-openeuler/openssh(openEuler-24.03-LTS) + +在修复了openssh.1的问题之后,又出现了第二个问题: +``` +[234s] + setenforce 0 +[234s] setenforce:security setenforce() failed:Permission denied +``` +这意味着在尝试将 SELinux 的强制模式设置为宽容模式时,由于没有足够的权限,操作未能成功 + +## 2、问题定位及根因分析 ## + +源代码中没有出现问题代码 +spec文件中: +``` +%check +if [ -e /sys/fs/selinux/enforce ]; then + # Store the SElinux state + cat /sys/fs/selinux/enforce > selinux.tmp + setenforce 0 +fi +make tests +if [ -e /sys/fs/selinux/enforce ]; then + # Restore the SElinux state + cat selinux.tmp > /sys/fs/selinux/enforce + rm -rf selinux.tmp +fi +``` +## 3、修改建议 ## +将%check处改为: +``` +%check +if [ -e /sys/fs/selinux/enforce ]; then + # Store the SElinux state only if the file exists + if [ -w /sys/fs/selinux/enforce ] && [ -w. ]; then + cat /sys/fs/selinux/enforce > selinux.tmp + setenforce 0 + else + echo "Insufficient permissions to handle SELinux state. Skipping modification." + fi +else + echo "SELinux is not enabled or enforce file not found. Skipping modification." +fi +make tests +if [ -e /sys/fs/selinux/enforce ]; then + # Restore the SElinux state only if the file exists + if [ -w /sys/fs/selinux/enforce ] && [ -f selinux.tmp ]; then + cat selinux.tmp > /sys/fs/selinux/enforce + rm -rf selinux.tmp + else + echo "Insufficient permissions or temp file not found. Skipping restoration of SELinux state." + fi +fi +``` +目的是在尝试修改 SELinux 强制文件之前检查其是否可写。这可以防止由于权限不足而导致脚本失败 \ No newline at end of file diff --git "a/\351\227\256\351\242\230\344\277\256\346\224\271\346\226\207\346\241\243/perl-XML-LibXML.md" "b/\351\227\256\351\242\230\344\277\256\346\224\271\346\226\207\346\241\243/perl-XML-LibXML.md" new file mode 100644 index 0000000000000000000000000000000000000000..903baa6776de80047fc41472b73aaa53add7c14a --- /dev/null +++ "b/\351\227\256\351\242\230\344\277\256\346\224\271\346\226\207\346\241\243/perl-XML-LibXML.md" @@ -0,0 +1,30 @@ +# perl-XML-LibXML # + +## 1、问题现象 ## + +出自:https://gitee.com/src-openeuler/perl-XML-LibXML(openEuler-24.03-LTS) +``` +68s] perl-libxml-mm.c:142:18: +incompatible fuction pointer types passing 'void (void*, void*, mmlchar *)’(aka'void (wvoid*, void*, unsigned char t)’) to parameter of type'mmashscamner'(aka +void (*)(void *, void *, const unsigned char *)’)[-Wincompatible-function pointer types] +68s] +142 +xmlHashScan(r, PmmRegistryDumpllashScanner, NuLL); +``` +## 2、问题定位及根因分析 ## + +函数指针类型不兼容 +问题出在源码中perl-libxml-mm.c文件中PmmRegistryDumpHashScanner函数定义(也就是 void (void *, void *, unsigned char *) )与xmlHashScan 函数期望的函数指针类型 xmlHashScanner(也就是 void (*)(void *, void *, const unsigned char *) )不匹配需要修改函数定义 +`void PmmRegistryDumpHashScanner(void * payload, void * data, xmlChar * name)` +## 3、修改建议 ## + +在perl-libxml-mm.c文件中PmmRegistryDumpHashScanner函数定义部分的第三个参数前加上const + +即将 +``` +void PmmRegistryDumpHashScanner(void * payload, void * data, xmlChar * name) +``` +改为 +``` +void PmmRegistryDumpHashScanner(void * payload, void * data,const xmlChar * name) +``` \ No newline at end of file diff --git "a/\351\227\256\351\242\230\344\277\256\346\224\271\346\226\207\346\241\243/pkcs11-helper.md" "b/\351\227\256\351\242\230\344\277\256\346\224\271\346\226\207\346\241\243/pkcs11-helper.md" new file mode 100644 index 0000000000000000000000000000000000000000..e2069e17269abbc459313c82df335221eb02b059 --- /dev/null +++ "b/\351\227\256\351\242\230\344\277\256\346\224\271\346\226\207\346\241\243/pkcs11-helper.md" @@ -0,0 +1,47 @@ +# pkcs11-helper # + +## 1、问题现象 ## + +出自:https://gitee.com/src-openeuler/pkcs11-helper(openEuler-24.03-LTS) +``` +[ 101s] pkcs11h-openssl.c:1108:3: error: incompatible function pointer types passing 'int (CRYPTO_EX_DATA *, const CRYPTO_EX_DATA *, void *, int, long, void *)' (aka 'int (struct crypto_ex_data_st *, const struct crypto_ex_data_st *, void *, int, long, void *)') to parameter of type 'CRYPTO_EX_dup *' (aka 'int (*)(struct crypto_ex_data_st *, const struct crypto_ex_data_st *, void **, int, long, void *)') [-Wincompatible-function-pointer-types] +[ 101s] 1108 | __pkcs11h_openssl_ex_data_dup, +[ 101s] | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +[ 101s] /usr/include/openssl/rsa.h:444:62: note: expanded from macro 'RSA_get_ex_new_index' +[ 101s] 444 | CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_RSA, l, p, newf, dupf, freef) +[ 101s] | ^~~~ +``` +## 2、问题定位及根因分析 ## + +这个错误表明在 pkcs11h-openssl.c 文件的第 1108 行,传递的函数指针类型与期望的类型不兼容。 + +具体来说,正在尝试将函数 __pkcs11h_openssl_ex_data_dup 的指针传递给一个期望类型为` CRYPTO_EX_dup *(即 int (*)(struct crypto_ex_data_st *, const struct crypto_ex_data_st *, void **, int, long, void *))`的参数,但 __pkcs11h_openssl_ex_data_dup 的类型是` int (CRYPTO_EX_DATA *, const CRYPTO_EX_DATA *, void *, int, long, void *)(等同于 int (struct crypto_ex_data_st *, const struct crypto_ex_data_st *, void *, int, long, void *))`。 +``` +__pkcs11h_openssl_ex_data_dup ( + CRYPTO_EX_DATA *to, + CRYPTO_EX_DATA *from, + void *from_d, + int idx, + long argl, + void *argp +) +``` +即__pkcs11h_openssl_ex_data_dup函数定义的第三个参数有问题: +需要的是void ** +结果传递的是void * + +## 3、修改建议 ## + +在lib/pkcs11h-openssl.c文件中将__pkcs11h_openssl_ex_data_dup函数定义中的void *from_d, +改为void **from_d, +因为有两个该函数,是在判断条件下执行不同的函数,所以要改两次 +``` +__pkcs11h_openssl_ex_data_dup ( + CRYPTO_EX_DATA *to, + CRYPTO_EX_DATA *from, + void **from_d, + int idx, + long argl, + void *argp +) +``` diff --git "a/\351\227\256\351\242\230\344\277\256\346\224\271\346\226\207\346\241\243/python-dmidecode.1.md" "b/\351\227\256\351\242\230\344\277\256\346\224\271\346\226\207\346\241\243/python-dmidecode.1.md" new file mode 100644 index 0000000000000000000000000000000000000000..f1af826b433e184de72aa0027fb31a7afa3248fd --- /dev/null +++ "b/\351\227\256\351\242\230\344\277\256\346\224\271\346\226\207\346\241\243/python-dmidecode.1.md" @@ -0,0 +1,35 @@ +# python-dmidecode.1 # + +## 1、问题现象 ## + +出自:https://gitee.com/src-openeuler/python-dmidecode(openEuler-24.03-LTS) +``` +[ 75s] src/dmidecodemodule.c:916:28: error: incompatible function pointer types initializing 'PyCFunction' (aka 'struct _object *(*)(struct _object *, struct _object *)') with an expression of type 'PyObject *(PyObject *, PyObject *, PyObject *)' (aka 'struct _object *(struct _object *, struct _object *, struct _object *)') [-Wincompatible-function-pointer-types] +[ 75s] 916 | {(char *)"xmlapi", dmidecode_xmlapi, METH_VARARGS | METH_KEYWORDS, +[ 75s] | ^~~~~~~~~~~~~~~~ +``` +## 2、问题定位及根因分析 ## + +即不兼容的函数指针类型错误: +在第src/dmidecodemodule.c的 916 行,尝试将一个函数指针类型为`PyObject *(PyObject *, PyObject *, PyObject *)`的表达式初始化为PyCFunction类型(即struct _object *(*)(struct _object *, struct _object *))。这意味着函数的参数个数不匹配,一个接受三个参数,一个只接受两个参数。 +``` +static PyObject *dmidecode_xmlapi(PyObject *self, PyObject *args, PyObject *keywds) +``` +``` +{(char *)"xmlapi", dmidecode_xmlapi, METH_VARARGS | METH_KEYWORDS, +(char *) "Internal API for retrieving data as raw XML data"}, +``` +## 3、修改建议 ## + +首先我尝试进行封装,但是依旧报错,于是我再次尝试进行手动数据类型转换 + +即将 +``` +{(char *)"xmlapi", dmidecode_xmlapi, METH_VARARGS | METH_KEYWORDS, +(char *) "Internal API for retrieving data as raw XML data"}, +``` +改为 +``` +{"xmlapi", (PyCFunction)dmidecode_xmlapi, METH_VARARGS | METH_KEYWORDS, "Internal API for retrieving data as raw XML data"}, +``` +即可修复这个问题 \ No newline at end of file diff --git "a/\351\227\256\351\242\230\344\277\256\346\224\271\346\226\207\346\241\243/python-dmidecode.2.md" "b/\351\227\256\351\242\230\344\277\256\346\224\271\346\226\207\346\241\243/python-dmidecode.2.md" new file mode 100644 index 0000000000000000000000000000000000000000..e36b2712f83bdeb6d592f6fc8bcc15f3806aaa04 --- /dev/null +++ "b/\351\227\256\351\242\230\344\277\256\346\224\271\346\226\207\346\241\243/python-dmidecode.2.md" @@ -0,0 +1,34 @@ +# python-dmidecode.2 # + +## 1、问题现象 ## + +出自:https://gitee.com/src-openeuler/python-dmidecode(openEuler-24.03-LTS) +``` +[ 75s] src/dmidecodemodule.c:1027:72: error: incompatible function pointer types passing 'void (void *)' to parameter of type 'PyCapsule_Destructor' (aka 'void (*)(struct _object *)') [-Wincompatible-function-pointer-types] +[ 75s] 1027 | PyModule_AddObject(module, "options", PyCapsule_New(opt, NULL, destruct_options)); +[ 75s] | ^~~~~~~~~~~~~~~~ +``` +## 2、问题定位及根因分析 ## + +即这个错误表明在将一个函数指针作为PyCapsule的析构函数传递时,函数指针类型不兼容。 +具体来说,错误发生在src/dmidecodemodule.c文件的第 1027 行,尝试将一个类型为void (void *)的函数指针传递给期望类型为PyCapsule_Destructor(即void (*)(struct _object *))的参数。 +``` +void destruct_options(void *ptr) +{ +#ifdef IS_PY3K + ptr = PyCapsule_GetPointer(ptr, NULL); +#endif + options *opt = (options *) ptr; + +``` +## 3、修改建议 ## + +将函数定义由void destruct_options(void *ptr)换为void destruct_options(PyObject *capsule) { +再通过 +``` +void *ptr = PyCapsule_GetPointer(capsule, NULL); +options *opt = (options *) ptr; +``` +使该代码与原来的部分保持一致 + +即可解决问题 \ No newline at end of file diff --git "a/\351\227\256\351\242\230\344\277\256\346\224\271\346\226\207\346\241\243/python-sybil.md" "b/\351\227\256\351\242\230\344\277\256\346\224\271\346\226\207\346\241\243/python-sybil.md" new file mode 100644 index 0000000000000000000000000000000000000000..3578f682f8408fd9551c6fc1399d994cca320bbe --- /dev/null +++ "b/\351\227\256\351\242\230\344\277\256\346\224\271\346\226\207\346\241\243/python-sybil.md" @@ -0,0 +1,14 @@ +# python-sybil # + +## 1、问题现象 ## + +出自:https://gitee.com/src-openeuler/python-sybil +(openEuler-24.03-LTS)、 +``` +[ 75s] FAILED tests/test_functional.py::test_pytest - AssertionError: +[ 75s] ========================= 1 failed, 80 passed in 2.82s ========================= +[ 75s] error: Bad exit status from /var/tmp/rpm-tmp.vV5eGG (%check) +``` +## 2、问题定位及根因分析 ## + +问题为偶发性问题,十次构建未必失败一次,本地构建也成功,怀疑为obs的问题 \ No newline at end of file diff --git "a/\351\227\256\351\242\230\344\277\256\346\224\271\346\226\207\346\241\243/rarian.md" "b/\351\227\256\351\242\230\344\277\256\346\224\271\346\226\207\346\241\243/rarian.md" new file mode 100644 index 0000000000000000000000000000000000000000..75e018fa19ce3468596df039afde4e66fe105e78 --- /dev/null +++ "b/\351\227\256\351\242\230\344\277\256\346\224\271\346\226\207\346\241\243/rarian.md" @@ -0,0 +1,62 @@ +# rarian # + +## 1、问题现象 ## + +出自:https://gitee.com/src-openeuler/rarian(openEuler-24.03-LTS) +``` +[ 79s] rarian-example.c:80:1: error: type specifier missing, defaults to 'int'; ISO C99 and later do not support implicit int [-Wimplicit-int] +[ 79s] 80 | info_for_each (RrnInfoEntry *entry, void *data) +[ 79s] | ^ +[ 79s] | int +``` +## 2、问题定位及根因分析 ## + +即rarian-example.c 文件的第 80 行,定义函数时没有明确指定函数的返回类型,编译器默认认为是 int,但在 ISO C99 及更高版本中不支持这种隐式的 int 类型声明。 +``` +info_for_each (RrnInfoEntry *entry, void *data) +{ + if (entry->section) + printf ("Info page: %s\n\tPath: %s#%s\n\tComment: %s\n", + entry->doc_name, entry->base_filename, + entry->section, entry->comment); + else + printf ("Info page: %s\n\tPath: %s\n\tComment: %s\n", + entry->doc_name, entry->base_filename, + entry->comment); + return TRUE; +} + +man_for_each (RrnManEntry *entry, void *data) +{ + printf ("Man page %s\n", entry->name); + printf ("\tPath: %s\n", entry->path); + return TRUE; +} +``` +要解决这个问题,可以在函数定义处明确指定函数的返回类型。 + +## 3、修改建议 ## + +只要在函数前加一个int即可 +``` +int +info_for_each (RrnInfoEntry *entry, void *data) +{ + if (entry->section) + printf ("Info page: %s\n\tPath: %s#%s\n\tComment: %s\n", + entry->doc_name, entry->base_filename, + entry->section, entry->comment); + else + printf ("Info page: %s\n\tPath: %s\n\tComment: %s\n", + entry->doc_name, entry->base_filename, + entry->comment); + return TRUE; +} + +man_for_each (RrnManEntry *entry, void *data) +{ + printf ("Man page %s\n", entry->name); + printf ("\tPath: %s\n", entry->path); + return TRUE; +} +``` \ No newline at end of file diff --git "a/\351\227\256\351\242\230\344\277\256\346\224\271\346\226\207\346\241\243/satyr.md" "b/\351\227\256\351\242\230\344\277\256\346\224\271\346\226\207\346\241\243/satyr.md" new file mode 100644 index 0000000000000000000000000000000000000000..ee2f819909dee0be95115ae192a36631568b5cf4 --- /dev/null +++ "b/\351\227\256\351\242\230\344\277\256\346\224\271\346\226\207\346\241\243/satyr.md" @@ -0,0 +1,18 @@ +# satyr # + +## 1、问题现象 ## + +出自:https://gitee.com/src-openeuler/satyr(openEuler-24.03-LTS) +``` +FAIL: core_stacktrace +...... +FAIL: 1 +``` +## 2、问题定位及根因分析 ## + +该问题上游已经解决,obs平台上aarch是succeed +x86是fail +报错为上述问题现象 + +在本地的x86中的clang运行该程序显示构建成功 +推测为obs平台的测试代码有误 \ No newline at end of file diff --git "a/\351\227\256\351\242\230\344\277\256\346\224\271\346\226\207\346\241\243/sysstat.md" "b/\351\227\256\351\242\230\344\277\256\346\224\271\346\226\207\346\241\243/sysstat.md" new file mode 100644 index 0000000000000000000000000000000000000000..7fae5e93f42ab900d149b45d032b918c50bfd0c4 --- /dev/null +++ "b/\351\227\256\351\242\230\344\277\256\346\224\271\346\226\207\346\241\243/sysstat.md" @@ -0,0 +1,30 @@ +# sysstat # + +## 1、问题现象 ## + +出自:https://gitee.com/src-openeuler/sysstat(openEuler-24.03-LTS) +``` +[ 72s] rd_stats.c:995:4: error: non-void function 'read_tty_driver_serial' should return a value [-Wreturn-type] +[ 72s] 995 | return; +[ 72s] | ^ +``` +## 2、问题定位及根因分析 ## + +上一个人提交的patch里,return后面没有返回值 +``` ++ if ((fp = fopen(TTYAMA, "r")) == NULL) { ++ if ((fp = fopen(SERIAL, "r")) == NULL) { ++ return; ++ } ++ } +``` +## 3.解决方案 ## + +在return后面加上返回值0即可解决问题 +``` ++ if ((fp = fopen(TTYAMA, "r")) == NULL) { ++ if ((fp = fopen(SERIAL, "r")) == NULL) { ++ return 0; ++ } ++ } +``` \ No newline at end of file diff --git "a/\351\227\256\351\242\230\344\277\256\346\224\271\346\226\207\346\241\243/tpm2-tss.md" "b/\351\227\256\351\242\230\344\277\256\346\224\271\346\226\207\346\241\243/tpm2-tss.md" new file mode 100644 index 0000000000000000000000000000000000000000..fc4a1e64d9baaa82cd8895786f4faf137c758de7 --- /dev/null +++ "b/\351\227\256\351\242\230\344\277\256\346\224\271\346\226\207\346\241\243/tpm2-tss.md" @@ -0,0 +1,73 @@ +# tpm2-tss # + +## 1、问题现象 ## + +出自:https://gitee.com/src-openeuler/tpm2-tss(openEuler-24.03-LTS) + +aarch成功,x86失败 +``` +[ 1109s] ERROR: test/integration/sys-asymmetric-encrypt-decrypt.int +[ 1249s] ERROR: test/integration/sys-nv-policy-locality.int +[ 1388s] ERROR: test/integration/sys-nv-readwrite.int +[ 1528s] ERROR: test/integration/sys-hmac-auth.int +[ 1668s] ERROR: test/integration/sys-primary-rsa-2K-aes128cfb.int +[ 1808s] ERROR: test/integration/sys-create-keyedhash-sha1-hmac.int +[ 1948s] ERROR: test/integration/sys-encrypt-decrypt.int +[ 2087s] ERROR: test/integration/sys-encrypt-decrypt-2.int +[ 2228s] ERROR: test/integration/sys-evict-ctrl.int +[ 2367s] ERROR: test/integration/sys-get-random.int +[ 2507s] ERROR: test/integration/sys-stir-random.int +[ 2647s] ERROR: test/integration/sys-hierarchy-change-auth.int +........ +[29647s] # TOTAL: 260 +[29647s] # PASS: 55 +[29647s] # SKIP: 0 +[29647s] # XFAIL: 0 +[29647s] # FAIL: 0 +[29647s] # XPASS: 0 +[29647s] # ERROR: 205 +``` +总结为: +test/integration目录下全部error + +## 2、问题定位及根因分析 ## + +第一次我对比aarch和x86的日志,发现aarch与x86大部分相同,区别在于aarch的日志中会出现大量的`clang: warning: argument unused during compilation: '-fstack-clash-protection' [-Wunused-command-line-argument]`警告 +而x86的日志中从未出现过类似的警告 + +这种情况在之前的satyr包中也出现过,当时的解决方案是加入 +``` +%if "%toolchain" == "clang" + export CFLAGS="$CFLAGS -Wno-error=unused-command-line-argument" +%endif(简称为可用降级操作) +``` +即可通过,unused-command-line-argument后续会加入,所以当做社区已修复 + +而在tpm2-tss这个包里加入类似的代码却没有反应,这条修复路径就此阻塞 + +第二次我在网上搜索相关错误,找到一个很类似的情况,同样是tpm2-tss中test/integration目录下全部error,网址为:https://blog.csdn.net/jianming21/article/details/107969368 +它的解释是“其根源是相关依赖包的缺失”,于是我找到tpm2-tss的上游社区的master分支中所需的依赖,加入到spec文件中,却都失败了,这条路就此阻塞 + +第三次我怀疑之所以aarch成功而x86失败是因为aarch架构和x86架构下的clang的指令集不同,又出错的单元为unit和integration,于是我将%build下做了一个判断将integration删除,结果成功 + +## 3.解决方案 ## + +即将 +``` +%configure --disable-static --disable-silent-rules --with-udevrulesdir=%{_udevrulesdir} --with-udevrulesprefix=80- \ + --with-runstatedir=%{_rundir} --with-tmpfilesdir=%{_tmpfilesdir} --with-sysusersdir=%{_sysusersdir} \ + --enable-unit --enable-integration +``` +改为 +``` +%if "%toolchain" == "clang" +%configure --disable-static --disable-silent-rules --with-udevrulesdir=%{_udevrulesdir} --with-udevrulesprefix=80- \ + --with-runstatedir=%{_rundir} --with-tmpfilesdir=%{_tmpfilesdir} --with-sysusersdir=%{_sysusersdir} +%else +%configure --disable-static --disable-silent-rules --with-udevrulesdir=%{_udevrulesdir} --with-udevrulesprefix=80- \ + --with-runstatedir=%{_rundir} --with-tmpfilesdir=%{_tmpfilesdir} --with-sysusersdir=%{_sysusersdir} \ + --enable-unit --enable-integration + +%endif +``` +不影响ci和gcc \ No newline at end of file diff --git "a/\351\227\256\351\242\230\344\277\256\346\224\271\346\226\207\346\241\243/trace-cmd.md" "b/\351\227\256\351\242\230\344\277\256\346\224\271\346\226\207\346\241\243/trace-cmd.md" new file mode 100644 index 0000000000000000000000000000000000000000..2b47c40ff4bbeeed1997f0584072a4dac38d14f5 --- /dev/null +++ "b/\351\227\256\351\242\230\344\277\256\346\224\271\346\226\207\346\241\243/trace-cmd.md" @@ -0,0 +1,32 @@ +# trace-cmd # + +## 1、问题现象 ## + +出自:https://gitee.com/src-openeuler/trace-cmd(openEuler-24.03-LTS) +``` +[ 111s] trace-hooks.c:135:5: error: call to undeclared function 'warning'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration] +[ 111s] 135 | warning("unknown flag %c\n", flags[i]); +[ 111s] | ^ +[ 111s] trace-hooks.c:152:2: error: call to undeclared function 'warning'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration] +[ 111s] 152 | warning("Invalid hook format '%s'", arg); +[ 111s] | ^ +[ 111s] 2 errors generated. +``` +即调用了未声明的函数warning + +## 2、问题定位及根因分析 ## + +即在trace-hooks.c文件中调用了未声明的函数warning +``` +invalid_tok: + warning("Invalid hook format '%s'", arg); + return NULL; +} +``` +尝试在这个文件里加入相关定义后,别的文件又出现了同样的问题 +依次加上之后就解决了问题 + +## 3.解决方案 ## + +在相关c文件里补上warning函数定义即可 +`void warning(const char *fmt, ...); ` \ No newline at end of file diff --git "a/\351\227\256\351\242\230\344\277\256\346\224\271\346\226\207\346\241\243/vdo.md" "b/\351\227\256\351\242\230\344\277\256\346\224\271\346\226\207\346\241\243/vdo.md" new file mode 100644 index 0000000000000000000000000000000000000000..060a929676f74ab468b4305e387d05d9f0622ed7 --- /dev/null +++ "b/\351\227\256\351\242\230\344\277\256\346\224\271\346\226\207\346\241\243/vdo.md" @@ -0,0 +1,53 @@ +# vdo # + +## 1、问题现象 ## + +出自:https://gitee.com/src-openeuler/vdo +(openEuler-24.03-LTS) +``` +[ 77s] error: unknown warning option '-Wlogical-op'; did you mean '-Wlong-long'? [-Werror,-Wunknown-warning-option] +[ 77s] make[2]: *** [Makefile:137: murmurhash3.o] Error 1 +[ 77s] make[2]: Leaving directory '/home/abuild/rpmbuild/BUILD/vdo-8.2.2.2/utils/uds' +[ 77s] make[2]: Entering directory '/home/abuild/rpmbuild/BUILD/vdo-8.2.2.2/utils/uds' +[ 77s] clang -O2 -g -grecord-gcc-switches -pipe -fstack-protector-strong -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS --config /usr/lib/rpm/generic-hardened-clang.cfg -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -D_GNU_SOURCE -g -O3 -fno-omit-frame-pointer -Wall -Wcast-align -Werror -Wextra -Winit-self -Wlogical-op -Wmissing-include-dirs -Wpointer-arith -Wredundant-decls -Wunused -Wwrite-strings -DCURRENT_VERSION='"8.2.2.2"' -I. -std=gnu99 -pedantic -Wbad-function-cast -Wcast-qual -Wfloat-equal -Wformat=2 -Wmissing-declarations -Wmissing-format-attribute -Wmissing-prototypes -Wnested-externs -Wold-style-definition -Wswitch-default -c -MD -MF .deps/buffer.d.new -MP -MT buffer.o buffer.c -o buffer.o +``` +## 2、问题定位及根因分析 ## + +即utils/uds/Makefile文件和utils/vdo/Makefile文件中的-WARNS和-C_WARNS部分是clang不接受的形式 +``` +WARNS = -Wall \ + -Wcast-align \ + -Werror \ + -Wextra \ + -Winit-self \ + -Wlogical-op \ + -Wmissing-include-dirs \ + -Wpointer-arith \ + -Wredundant-decls \ + -Wunused \ + -Wwrite-strings + +C_WARNS = -Wbad-function-cast \ + -Wcast-qual \ + -Wfloat-equal \ + -Wformat=2 \ + -Wmissing-declarations \ + -Wmissing-format-attribute \ + -Wmissing-prototypes \ + -Wnested-externs \ + -Wold-style-definition \ + -Wswitch-default +``` +## 3.解决方案 ## + +于是做了一个判断,如果编译器为gcc则执行-WARNS和-C_WARNS,如果是clang则不执行,成功修复 + +即 +``` ++# Define WARNS and C_WARNS only if using gcc ++CLANG_VERSION := $(shell $(CC) --version | grep -i clang) ++ifeq ($(findstring clang, $(CLANG_VERSION)),clang) ++WARNS = ++C_WARNS = ++else +``` \ No newline at end of file