前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >服务器升级系统后编译出现的错误总结

服务器升级系统后编译出现的错误总结

作者头像
咖啡走糖
发布2022-11-05 16:49:06
3.4K2
发布2022-11-05 16:49:06
举报
文章被收录于专栏:咖啡走糖

背景

部门用来开发的服务器之前的系统是ubuntu16.04的,已经好多年了,因为数据量庞大,更新系统怕有风险,一直没有升级。老系统局限性太多了,现在好多项目需要安装的软件版本太低,像openwrt、fenix一些工程编译所需要的最低系统环境都满足不了,所以最近终于把系统升到了ubuntu22.04,估计又可以用好几年了。

带来的问题

这个服务器主要用来编译linux内核、uboot等,升级系统后之前提交编译正常的项目都多多少少出现了点小错误,这里总结记录下,不定时更新。

1.YYLTYPE yylloc错误
代码语言:javascript
复制
/usr/bin/ld: scripts/dtc/dtc-parser.tab.o:(.bss+0x10): multiple definition of `yylloc'; scripts/dtc/dtc-lexer.lex.o:(.bss+0x0): first defined here
解决方法:

在编译源码根目录下的scripts/dtc/dtc-parser.tab.c文件中,找到YYLTYPE yylloc定义的地方,前面加上extern外部变量声明。

bug fix:

代码语言:javascript
复制
/* The lookahead symbol.  */
int yychar;

/* The semantic value of the lookahead symbol.  */
YYSTYPE yylval;
/* Location data for the lookahead symbol.  */
extern YYLTYPE yylloc
# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
  = { 1, 1, 1, 1 }
# endif
;
/* Number of syntax errors so far.  */
int yynerrs;
2.New address错误
解决方法:

找到scripts/selinux/genheaders/genheaders.c和scripts/selinux/mdp/mdp.c两个C文件,注释掉<sys/socket.h>头文件的引用;找到security/selinux/include/classmap.h头文件,添加<linux/socket.h>头文件的引用。

bug fix:

代码语言:javascript
复制
diff --git a/scripts/selinux/genheaders/genheaders.c b/scripts/selinux/genheaders/genheaders.c
index fa48fabcb..032b47a13 100644
--- a/scripts/selinux/genheaders/genheaders.c
+++ b/scripts/selinux/genheaders/genheaders.c
@@ -9,7 +9,7 @@
 #include <string.h>
 #include <errno.h>
 #include <ctype.h>
-#include <sys/socket.h>
+//#include <sys/socket.h>

 struct security_class_mapping {
        const char *name;
diff --git a/scripts/selinux/mdp/mdp.c b/scripts/selinux/mdp/mdp.c
index ffe8179f5..c1db0c488 100644
--- a/scripts/selinux/mdp/mdp.c
+++ b/scripts/selinux/mdp/mdp.c
@@ -32,7 +32,7 @@
 #include <stdlib.h>
 #include <unistd.h>
 #include <string.h>
-#include <sys/socket.h>
+//#include <sys/socket.h>

 static void usage(char *name)
 {
diff --git a/security/selinux/include/classmap.h b/security/selinux/include/classmap.h
index cc35695d9..45ef6a0c1 100644
--- a/security/selinux/include/classmap.h
+++ b/security/selinux/include/classmap.h
@@ -1,5 +1,6 @@
 /* SPDX-License-Identifier: GPL-2.0 */
 #include <linux/capability.h>
+#include <linux/socket.h>

 #define COMMON_FILE_SOCK_PERMS "ioctl", "read", "write", "create", \
     "getattr", "setattr", "lock", "relabelfrom", "relabelto", "append", "map"

版权属于:咖啡走糖

本文链接:https://cloud.tencent.com/developer/article/2152400

若无注明,本文皆咖啡走糖原创,转载时必须注明出处及本声明!

本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2022 年 07 月,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 背景
  • 带来的问题
    • 1.YYLTYPE yylloc错误
      • 解决方法:
    • 2.New address错误
      • 解决方法:
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档