<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title>林占宇</title>
		<description>Stylish Jekyll Theme</description>
		<link>/</link>
		<atom:link href="/feed.xml" rel="self" type="application/rss+xml" />
		
			<item>
				<title>对一个GitHub仓库做本地镜像且维护修改分支 (高级进阶版)</title>
				<description>&lt;p&gt;这篇文章虽然有点AI味儿, 但它不全是AI写的, 它是能解决实际问题的可实践步骤全流程. 我只是懒得码那么多字.&lt;/p&gt;

&lt;h3 id=&quot;目标&quot;&gt;目标&lt;/h3&gt;

&lt;p&gt;对 GitHub 上的开源仓库做一个 Gitea 本地镜像, 包含所有分支, tag. 针对该仓库做的本地修改, 也能推送到本地Gitea仓库中, 还能定期更新GitHub上的提交, 合并, 升级为最新版本。&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;[!IMPORTANT]
&lt;strong&gt;关于分支名称的说明&lt;/strong&gt;：本文档中的代码示例使用了 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;&amp;lt;your_branch&amp;gt;&lt;/code&gt; 作为占位符。在实际操作时，请将其替换为你想要使用的主分支名（例如 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;master&lt;/code&gt; 或 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;develop&lt;/code&gt;）。&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h4 id=&quot;注意为什么不能直接用-git-clone---mirror&quot;&gt;注意：为什么不能直接用 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;git clone --mirror&lt;/code&gt;？&lt;/h4&gt;
&lt;p&gt;如果你使用 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;--mirror&lt;/code&gt; 克隆，你得到的是一个“裸仓库”（没有工作目录），且任何同步操作都会强制将远程的状态与本地完全对齐。这意味着&lt;strong&gt;一旦 GitHub 更新了分支列表或 Tag，你在 Gitea 上做的所有自定义提交和新开的分支都会被抹除（Overwrite）&lt;/strong&gt;。&lt;/p&gt;

&lt;p&gt;为了实现“全量镜像”+“保留修改”，我们需要采用 &lt;strong&gt;双远程 Refspec 映射法&lt;/strong&gt;。&lt;/p&gt;

&lt;hr /&gt;

&lt;h3 id=&quot;实现方案双远程工作流-dual-remote-workflow&quot;&gt;实现方案：双远程工作流 (Dual-Remote Workflow)&lt;/h3&gt;

&lt;p&gt;这种方案的核心思想是：建立一个带有完整工作目录的仓库，通过特殊的 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;refspec&lt;/code&gt; 命令将 GitHub 的分支变更批量同步到 Gitea，同时利用 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;rebase&lt;/code&gt; 保留本地修改。&lt;/p&gt;

&lt;h4 id=&quot;第一阶段环境初始化-setup&quot;&gt;第一阶段：环境初始化 (Setup)&lt;/h4&gt;

&lt;ol&gt;
  &lt;li&gt;&lt;strong&gt;克隆原始仓库（标准模式）&lt;/strong&gt;
不要用 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;--mirror&lt;/code&gt;！我们要一个能写代码的普通仓库。
    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;# 克隆 GitHub 仓库，此时 origin 指向 GitHub&lt;/span&gt;
git clone https://github.com/original-owner/repo.git ~/my-work-dir
&lt;span class=&quot;nb&quot;&gt;cd&lt;/span&gt; ~/my-work-dir

&lt;span class=&quot;c&quot;&gt;# 为了语义清晰，我们将远程名称改为 github 和 gitea&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;# 首先将原本的 origin (GitHub) 改名为 github&lt;/span&gt;
git remote rename origin github
&lt;span class=&quot;c&quot;&gt;# 然后添加你的 Gitea 作为第二个远程 (gitea)&lt;/span&gt;
git remote add gitea https://gitea.yourdomain.com/your-user/my-repo.git

&lt;span class=&quot;c&quot;&gt;# 先把当前代码推送到 Gitea 初始化仓库&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;# 注意：请将 &amp;lt;your_branch&amp;gt; 替换为你的主分支名 (如 master 或 develop)&lt;/span&gt;
git push &lt;span class=&quot;nt&quot;&gt;-u&lt;/span&gt; gitea &amp;lt;your_branch&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;    &lt;/div&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;配置状态检查&lt;/strong&gt;
执行 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;git remote -v&lt;/code&gt;，你应该看到：
    &lt;ul&gt;
      &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;github&lt;/code&gt;: 指向 &lt;strong&gt;GitHub&lt;/strong&gt; (作为原始代码源)&lt;/li&gt;
      &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;gitea&lt;/code&gt;: 指向你的 &lt;strong&gt;Gitea&lt;/strong&gt; (用于存放你的修改和镜像结果)&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ol&gt;

&lt;h4 id=&quot;第二阶段日常开发与推送-development&quot;&gt;第二阶段：日常开发与推送 (Development)&lt;/h4&gt;

&lt;p&gt;你可以像往常一样在本地创建分支并提交。这些内容只会推送到 Gitea，不会干扰 GitHub 的同步逻辑。&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;# 1. 创建新特性分支&lt;/span&gt;
git checkout &lt;span class=&quot;nt&quot;&gt;-b&lt;/span&gt; feat/my-custom-stuff

&lt;span class=&quot;c&quot;&gt;# 2. 修改代码并提交&lt;/span&gt;
git add &lt;span class=&quot;nb&quot;&gt;.&lt;/span&gt;
git commit &lt;span class=&quot;nt&quot;&gt;-m&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;feat: 我的本地特殊修改&quot;&lt;/span&gt;

&lt;span class=&quot;c&quot;&gt;# 3. 推送到 Gitea (gitea)&lt;/span&gt;
git push gitea feat/my-custom-stuff
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h4 id=&quot;第三阶段全量同步-github-的更新-the-magic-sync&quot;&gt;第三阶段：全量同步 GitHub 的更新 (The Magic Sync)&lt;/h4&gt;

&lt;p&gt;这是解决你问题的核心。当 GitHub 上有了&lt;strong&gt;新的分支、新的 Tag 或新的提交&lt;/strong&gt;时，按以下两步操作：&lt;/p&gt;

&lt;h5 id=&quot;1-获取-github-的所有变更包括新分支和-tag&quot;&gt;1. 获取 GitHub 的所有变更（包括新分支和 Tag）&lt;/h5&gt;
&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;# 拉取 github 的所有更新到本地的远程跟踪引用中&lt;/span&gt;
git fetch github &lt;span class=&quot;nt&quot;&gt;--tags&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h5 id=&quot;2-将-github-的所有分支投影到-gitea-上&quot;&gt;2. 将 GitHub 的所有分支“投影”到 Gitea 上&lt;/h5&gt;
&lt;p&gt;这是最关键的一步。我们利用 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;refspec&lt;/code&gt; 直接把 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;github&lt;/code&gt; 下的所有分支推送到 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;gitea&lt;/code&gt;，而&lt;strong&gt;不会覆盖你正在工作的本地分支&lt;/strong&gt;（因为它们在不同的命名空间下）。&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;# 魔法命令：将所有 github 的远程跟踪分支 推送为 gitea 的 heads 分支&lt;/span&gt;
git push gitea &lt;span class=&quot;s1&quot;&gt;&apos;refs/remotes/github/*:refs/heads/*&apos;&lt;/span&gt;

&lt;span class=&quot;c&quot;&gt;# 如果恰巧你本地有了一个同名的分支, 那就用这个命令完成推送.&lt;/span&gt;
git push gitea &lt;span class=&quot;s1&quot;&gt;&apos;+refs/remotes/github/*:refs/heads/*&apos;&lt;/span&gt;

&lt;span class=&quot;c&quot;&gt;# 同时同步所有的 Tag 到 Gitea&lt;/span&gt;
git push gitea &lt;span class=&quot;nt&quot;&gt;--tags&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;&lt;strong&gt;效果&lt;/strong&gt;：GitHub 上新开的 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;feature-x&lt;/code&gt; 之后，会自动出现在 Gitea 的分支列表里。而你本地正在开发的 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;feat/my-custom-stuff&lt;/code&gt; 不会受到任何影响。&lt;/p&gt;

&lt;h4 id=&quot;第四阶段将-github-更新合并进你的工作-rebase&quot;&gt;第四阶段：将 GitHub 更新合并进你的工作 (Rebase)&lt;/h4&gt;

&lt;p&gt;同步完镜像后，你需要把你本地的修改“垫”在 GitHub 最新代码之上，以保持历史整洁且不产生冲突。&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;# 1. 切换到你正在工作的分支&lt;/span&gt;
git checkout feat/my-custom-stuff

&lt;span class=&quot;c&quot;&gt;# 2. 使用 rebase 将 github 最新的提交合并进来&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;# 注意：请将 &amp;lt;your_branch&amp;gt; 替换为你的主分支名 (如 master 或 develop)&lt;/span&gt;
git rebase github/&amp;lt;your_branch&amp;gt;

&lt;span class=&quot;c&quot;&gt;# [如果发生冲突]&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;# 手动解决文件中的 &amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt; HEAD -&amp;gt; ======= -&amp;gt; &amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; 标记&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;# git add &amp;lt;resolved-file&amp;gt;&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;# git rebase --continue&lt;/span&gt;

&lt;span class=&quot;c&quot;&gt;# 3. 更新 Gitea (由于重写了历史，需要使用 force-with-lease)&lt;/span&gt;
git push gitea feat/my-custom-stuff &lt;span class=&quot;nt&quot;&gt;--force-with-lease&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;hr /&gt;

&lt;h3 id=&quot;总结避坑指南与最佳实践&quot;&gt;总结：避坑指南与最佳实践&lt;/h3&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th style=&quot;text-align: left&quot;&gt;问题&lt;/th&gt;
      &lt;th style=&quot;text-align: left&quot;&gt;对策&lt;/th&gt;
      &lt;th style=&quot;text-align: left&quot;&gt;命令 / 原理&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;&lt;strong&gt;GitHub 新加了分支，Gitea 没显示？&lt;/strong&gt;&lt;/td&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;使用 Refspec 批量推送&lt;/td&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;git push gitea &apos;refs/remotes/github/*:refs/heads/*&apos;&lt;/code&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;&lt;strong&gt;本地提交被 GitHub 更新覆盖了？&lt;/strong&gt;&lt;/td&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;不要用 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;--mirror&lt;/code&gt;，使用 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;rebase&lt;/code&gt;&lt;/td&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;git rebase github/&amp;lt;your_branch&amp;gt;&lt;/code&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;&lt;strong&gt;强制推送太危险怎么办？&lt;/strong&gt;&lt;/td&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;使用更安全的 force 模式&lt;/td&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;git push --force-with-lease&lt;/code&gt; (它会检查远程是否有你不知道的新提交)&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;h4 id=&quot;-高级技巧自动化同步脚本&quot;&gt;💡 高级技巧：自动化同步脚本&lt;/h4&gt;

&lt;p&gt;你可以把第三阶段的操作写成一个简单的 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.sh&lt;/code&gt; 脚本，每天定时运行（Crontab），实现真正的“自动镜像”：&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;#!/bin/bash&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;# sync_mirror.sh&lt;/span&gt;

&lt;span class=&quot;nb&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;🚀 Starting Sync: GitHub -&amp;gt; Gitea&quot;&lt;/span&gt;

&lt;span class=&quot;c&quot;&gt;# 1. 获取上游所有内容&lt;/span&gt;
git fetch github &lt;span class=&quot;nt&quot;&gt;--tags&lt;/span&gt;

&lt;span class=&quot;c&quot;&gt;# 2. 同步分支到 Gitea (不影响本地 working tree)&lt;/span&gt;
git push gitea &lt;span class=&quot;s1&quot;&gt;&apos;refs/remotes/github/*:refs/heads/*&apos;&lt;/span&gt;

&lt;span class=&quot;c&quot;&gt;# 3. 同步 Tag 到 Gitea&lt;/span&gt;
git push gitea &lt;span class=&quot;nt&quot;&gt;--tags&lt;/span&gt;

&lt;span class=&quot;nb&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;✅ Sync Complete!&quot;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;这样，你就拥有了一个&lt;strong&gt;既能全量同步 GitHub 所有动态、又能完美保护本地修改&lt;/strong&gt;的专业级镜像仓库。&lt;/p&gt;
</description>
				<pubDate>Wed, 24 Jun 2026 00:00:00 +0000</pubDate>
				<link>/git/2026/06/24/git-repo-mirror.html</link>
				<guid isPermaLink="true">/git/2026/06/24/git-repo-mirror.html</guid>
			</item>
		
			<item>
				<title>UE5 中编译使用 Protobuf</title>
				<description>&lt;h3 id=&quot;ue-中第三方库的编译&quot;&gt;UE 中第三方库的编译&lt;/h3&gt;

&lt;p&gt;编译主要得有 -fPIC 参数, 生编译器产生位置无关代码(Positio Independent Code)&lt;/p&gt;

&lt;p&gt;产生的代码没有绝对地址, 全部使用相对地址, 故代码可以被加载到内存的任意位置, 都可以正确执行.&lt;/p&gt;

&lt;h4 id=&quot;windows-编译&quot;&gt;Windows 编译&lt;/h4&gt;

&lt;h4 id=&quot;linux-编译&quot;&gt;Linux 编译&lt;/h4&gt;

&lt;p&gt;编译器的选择:&lt;/p&gt;

&lt;p&gt;Linux下的编译器有GCC和clang可以选择, 由于UE使用的是自带的 clang 编译器, 所以我们也在系统中安装 clang 吧!&lt;/p&gt;

&lt;p&gt;直接编译放入UE工程后, 编译链接时会报错如下:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-log&quot;&gt;[25/114] Link (lld) libUnrealEditor-MineNet.so                                                                                                                                                                                                                                               [453/1851]
ld.lld: error: undefined symbol: std::allocator&amp;lt;char&amp;gt;::allocator()                                                                                                                                                                                                                                     
&amp;gt;&amp;gt;&amp;gt; referenced by arenastring.cc                                                                                                                                                                                                                                                                       
&amp;gt;&amp;gt;&amp;gt;               arenastring.cc.o:(google::protobuf::internal::LazyString::Init[abi:cxx11]() const) in archive /mnt/disk/jenkins/workspace/Dev-MineMind-Linux/Source/ThirdParty/Protobuf/3.21.7/lib/libprotobuf.a                                                                                     
&amp;gt;&amp;gt;&amp;gt; referenced by arenastring.cc                                                                                                                                                                                                                                                                       
&amp;gt;&amp;gt;&amp;gt;               arenastring.cc.o:(google::protobuf::internal::(anonymous namespace)::CreateString(std::__cxx11::basic_string&amp;lt;char, std::char_traits&amp;lt;char&amp;gt;, std::allocator&amp;lt;char&amp;gt;&amp;gt; const&amp;amp;)) in archive /mnt/disk/jenkins/workspace/Dev-MineMind-Linux/Source/ThirdParty/Protobuf/3.21.7/lib/libprotobuf
.a                                                                                                                                                                                                                                                                                                     
&amp;gt;&amp;gt;&amp;gt; referenced by arenastring.cc                                                                                                                   
&amp;gt;&amp;gt;&amp;gt;               arenastring.cc.o:(std::__cxx11::basic_string&amp;lt;char, std::char_traits&amp;lt;char&amp;gt;, std::allocator&amp;lt;char&amp;gt;&amp;gt;* google::protobuf::Arena::Create&amp;lt;std::__cxx11::basic_string&amp;lt;char, std::char_traits&amp;lt;char&amp;gt;, std::allocator&amp;lt;char&amp;gt;&amp;gt;, char const*, unsigned long&amp;gt;(google::protobuf::Arena*, char const*&amp;amp;&amp;amp;
, unsigned long&amp;amp;&amp;amp;)) in archive /mnt/disk/jenkins/workspace/Dev-MineMind-Linux/Source/ThirdParty/Protobuf/3.21.7/lib/libprotobuf.a                                                                                                                                                                      
&amp;gt;&amp;gt;&amp;gt; referenced 180 more times                                                                                                                                                                                                                                                                          
&amp;gt;&amp;gt;&amp;gt; did you mean: std::allocator&amp;lt;int&amp;gt;::allocator()                                                                                                                                                                                                                                                     
&amp;gt;&amp;gt;&amp;gt; defined in: /mnt/disk/jenkins/workspace/Dev-MineMind-Linux/Source/ThirdParty/Protobuf/3.21.7/lib/libprotobuf.a(descriptor.cc.o)                                                                                                                                                                    
ld.lld: error: undefined symbol: std::string::empty() const                                                                                                                                                                                                                                            
&amp;gt;&amp;gt;&amp;gt; referenced by miniodata.pb.cc                                                                                                                                                                                                                                                                      
&amp;gt;&amp;gt;&amp;gt;               miniodata.pb.cc.o:(FNetMSG::FNetMSG(FNetMSG const&amp;amp;)) in archive /mnt/disk/jenkins/workspace/Dev-MineMind-Linux/Source/ThirdParty/Protocol/lib/libProtocol.a
&amp;gt;&amp;gt;&amp;gt; referenced by miniodata.pb.cc
&amp;gt;&amp;gt;&amp;gt;               miniodata.pb.cc.o:(FNetMSG::_InternalSerialize(unsigned char*, google::protobuf::io::EpsCopyOutputStream*) const) in archive /mnt/disk/jenkins/workspace/Dev-MineMind-Linux/Source/ThirdParty/Protocol/lib/libProtocol.a
&amp;gt;&amp;gt;&amp;gt; referenced by miniodata.pb.cc
&amp;gt;&amp;gt;&amp;gt;               miniodata.pb.cc.o:(FNetMSG::ByteSizeLong() const) in archive /mnt/disk/jenkins/workspace/Dev-MineMind-Linux/Source/ThirdParty/Protocol/lib/libProtocol.a
&amp;gt;&amp;gt;&amp;gt; referenced 73 more times
ld.lld: error: undefined symbol: std::ios_base::Init::Init()
&amp;gt;&amp;gt;&amp;gt; referenced by arena.cc
&amp;gt;&amp;gt;&amp;gt;               arena.cc.o:(__static_initialization_and_destruction_0(int, int)) in archive /mnt/disk/jenkins/workspace/Dev-MineMind-Linux/Source/ThirdParty/Protobuf/3.21.7/lib/libprotobuf.a
&amp;gt;&amp;gt;&amp;gt; referenced by generated_message_util.cc
&amp;gt;&amp;gt;&amp;gt;               generated_message_util.cc.o:(__static_initialization_and_destruction_0(int, int)) in archive /mnt/disk/jenkins/workspace/Dev-MineMind-Linux/Source/ThirdParty/Protobuf/3.21.7/lib/libprotobuf.a
&amp;gt;&amp;gt;&amp;gt; referenced by repeated_field.cc
&amp;gt;&amp;gt;&amp;gt;               repeated_field.cc.o:(__static_initialization_and_destruction_0(int, int)) in archive /mnt/disk/jenkins/workspace/Dev-MineMind-Linux/Source/ThirdParty/Protobuf/3.21.7/lib/libprotobuf.a
&amp;gt;&amp;gt;&amp;gt; referenced 35 more times
ld.lld: error: undefined symbol: std::ios_base::Init::~Init()
&amp;gt;&amp;gt;&amp;gt; referenced by arena.cc
&amp;gt;&amp;gt;&amp;gt;               arena.cc.o:(__static_initialization_and_destruction_0(int, int)) in archive /mnt/disk/jenkins/workspace/Dev-MineMind-Linux/Source/ThirdParty/Protobuf/3.21.7/lib/libprotobuf.a
&amp;gt;&amp;gt;&amp;gt; referenced by generated_message_util.cc
&amp;gt;&amp;gt;&amp;gt;               generated_message_util.cc.o:(__static_initialization_and_destruction_0(int, int)) in archive /mnt/disk/jenkins/workspace/Dev-MineMind-Linux/Source/ThirdParty/Protobuf/3.21.7/lib/libprotobuf.a
&amp;gt;&amp;gt;&amp;gt; referenced by repeated_field.cc
&amp;gt;&amp;gt;&amp;gt;               repeated_field.cc.o:(__static_initialization_and_destruction_0(int, int)) in archive /mnt/disk/jenkins/workspace/Dev-MineMind-Linux/Source/ThirdParty/Protobuf/3.21.7/lib/libprotobuf.a
&amp;gt;&amp;gt;&amp;gt; referenced 35 more times
ld.lld: error: undefined symbol: google::protobuf::internal::ArenaStringPtr::Set(std::__1::basic_string&amp;lt;char, std::__1::char_traits&amp;lt;char&amp;gt;, std::__1::allocator&amp;lt;char&amp;gt;&amp;gt; const&amp;amp;, google::protobuf::Arena*)
&amp;gt;&amp;gt;&amp;gt; referenced by arenastring.h:409 (/mnt/disk/jenkins/workspace/Dev-MineMind-Linux/Source/ThirdParty/Protobuf/3.21.7/include/google/protobuf/arenastring.h:409)
&amp;gt;&amp;gt;&amp;gt;               /mnt/disk/jenkins/workspace/Dev-MineMind-Linux/Intermediate/Build/Linux/x64/UnrealEditor/Development/MineNet/NetworkMngr.cpp.o:(UNetworkMngr::SendMSG(MineUIData&amp;amp;, TDelegate&amp;lt;void (MineUIData const&amp;amp;), FDefaultDelegateUserPolicy&amp;gt; const&amp;amp;))
&amp;gt;&amp;gt;&amp;gt; referenced by arenastring.h:409 (/mnt/disk/jenkins/workspace/Dev-MineMind-Linux/Source/ThirdParty/Protobuf/3.21.7/include/google/protobuf/arenastring.h:409)
&amp;gt;&amp;gt;&amp;gt;               /mnt/disk/jenkins/workspace/Dev-MineMind-Linux/Intermediate/Build/Linux/x64/UnrealEditor/Development/MineNet/NetworkMngr.cpp.o:(UNetworkMngr::SendRequest(FString const&amp;amp;, TDelegate&amp;lt;void (bool, MineInfo const&amp;amp;), FDefaultDelegateUserPolicy&amp;gt; const&amp;amp;))
&amp;gt;&amp;gt;&amp;gt; referenced by arenastring.h:409 (/mnt/disk/jenkins/workspace/Dev-MineMind-Linux/Source/ThirdParty/Protobuf/3.21.7/include/google/protobuf/arenastring.h:409)
&amp;gt;&amp;gt;&amp;gt;               /mnt/disk/jenkins/workspace/Dev-MineMind-Linux/Intermediate/Build/Linux/x64/UnrealEditor/Development/MineNet/NetworkMngr.cpp.o:(UNetworkMngr::SendRequest(FString const&amp;amp;, TDelegate&amp;lt;void (bool, FString const&amp;amp;), FDefaultDelegateUserPolicy&amp;gt; const&amp;amp;))
&amp;gt;&amp;gt;&amp;gt; referenced 5 more times
ld.lld: error: undefined symbol: std::__cxx11::basic_string&amp;lt;char, std::char_traits&amp;lt;char&amp;gt;, std::allocator&amp;lt;char&amp;gt;&amp;gt;::~basic_string()
&amp;gt;&amp;gt;&amp;gt; referenced by generated_message_util.cc
&amp;gt;&amp;gt;&amp;gt;               generated_message_util.cc.o:(google::protobuf::internal::DestroyString(void const*)) in archive /mnt/disk/jenkins/workspace/Dev-MineMind-Linux/Source/ThirdParty/Protobuf/3.21.7/lib/libprotobuf.a
&amp;gt;&amp;gt;&amp;gt; referenced by extension_set.cc
&amp;gt;&amp;gt;&amp;gt;               extension_set.cc.o:(google::protobuf::internal::(anonymous namespace)::Register(google::protobuf::internal::ExtensionInfo const&amp;amp;)) in archive /mnt/disk/jenkins/workspace/Dev-MineMind-Linux/Source/ThirdParty/Protobuf/3.21.7/lib/libprotobuf.a
&amp;gt;&amp;gt;&amp;gt; referenced by extension_set.cc
&amp;gt;&amp;gt;&amp;gt;               extension_set.cc.o:(google::protobuf::internal::(anonymous namespace)::Register(google::protobuf::internal::ExtensionInfo const&amp;amp;)) in archive /mnt/disk/jenkins/workspace/Dev-MineMind-Linux/Source/ThirdParty/Protobuf/3.21.7/lib/libprotobuf.a
&amp;gt;&amp;gt;&amp;gt; referenced 1497 more times
ld.lld: error: undefined symbol: google::protobuf::internal::ArenaStringPtr::Set(std::string const&amp;amp;, google::protobuf::Arena*)
&amp;gt;&amp;gt;&amp;gt; referenced by miniodata.pb.cc
&amp;gt;&amp;gt;&amp;gt;               miniodata.pb.cc.o:(FNetMSG::FNetMSG(FNetMSG const&amp;amp;)) in archive /mnt/disk/jenkins/workspace/Dev-MineMind-Linux/Source/ThirdParty/Protocol/lib/libProtocol.a
&amp;gt;&amp;gt;&amp;gt; referenced by miniodata.pb.cc
&amp;gt;&amp;gt;&amp;gt;               miniodata.pb.cc.o:(FNetMSG::MergeImpl(google::protobuf::Message&amp;amp;, google::protobuf::Message const&amp;amp;)) in archive /mnt/disk/jenkins/workspace/Dev-MineMind-Linux/Source/ThirdParty/Protocol/lib/libProtocol.a
&amp;gt;&amp;gt;&amp;gt; referenced by miniodata.pb.cc
&amp;gt;&amp;gt;&amp;gt;               miniodata.pb.cc.o:(FNetCMD::FNetCMD(FNetCMD const&amp;amp;)) in archive /mnt/disk/jenkins/workspace/Dev-MineMind-Linux/Source/ThirdParty/Protocol/lib/libProtocol.a
&amp;gt;&amp;gt;&amp;gt; referenced 35 more times

&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;如何来分析这个问题?&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;首先要观察 libprotobuf.a 和 引用该静态库的 MineNet/XXX.o&lt;/li&gt;
&lt;/ol&gt;

&lt;div class=&quot;language-shell highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;# &lt;/span&gt;
nm &lt;span class=&quot;nt&quot;&gt;-C&lt;/span&gt; Source/ThirdParty/Protobuf/3.21.7/lib/libprotobuf.a | &lt;span class=&quot;nb&quot;&gt;grep&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;basic_string&quot;&lt;/span&gt; | &lt;span class=&quot;nb&quot;&gt;head&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;# 得到结果表示使用 libc++ 编译的&lt;/span&gt;
nm &lt;span class=&quot;nt&quot;&gt;-C&lt;/span&gt; Source/ThirdParty/Protobuf/3.21.7/lib/libprotobuf.a | c++filt | &lt;span class=&quot;nb&quot;&gt;grep&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;std::__1&quot;&lt;/span&gt; | &lt;span class=&quot;nb&quot;&gt;head&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;# 得到结果表示使用 libstdc++ 编译的&lt;/span&gt;
nm &lt;span class=&quot;nt&quot;&gt;-C&lt;/span&gt; Source/ThirdParty/Protobuf/3.21.7/lib/libprotobuf.a | c++filt | &lt;span class=&quot;nb&quot;&gt;grep&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;std::__cxx11&quot;&lt;/span&gt; | &lt;span class=&quot;nb&quot;&gt;head&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;# 检查 UE5 编译后用的是哪种方式&lt;/span&gt;
nm &lt;span class=&quot;nt&quot;&gt;-C&lt;/span&gt; Intermediate/Build/Linux/x64/MineMindClient/Development/MineNet/MineNet.cpp.o | c++filt | &lt;span class=&quot;nb&quot;&gt;grep&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;std::__1&quot;&lt;/span&gt; | &lt;span class=&quot;nb&quot;&gt;head&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;通过以上命令我确定了我自编的UE5是使用了 clang + libc++ 的方式.&lt;/p&gt;

&lt;p&gt;所以只需要让 Protobuf 编译的和 UE 的方式相同了即可.&lt;/p&gt;

&lt;div class=&quot;language-shell highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;apt &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;clang
&lt;span class=&quot;c&quot;&gt;# 使用 libc++ &lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;apt &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;libc++-dev libc++abi-dev

&lt;span class=&quot;nb&quot;&gt;export &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;CC&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;clang
&lt;span class=&quot;nb&quot;&gt;export &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;CXX&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;clang++

cmake &lt;span class=&quot;nt&quot;&gt;-B&lt;/span&gt; build &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;-DCMAKE_POSITION_INDEPENDENT_CODE&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;ON &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;-Dprotobuf_BUILD_TESTS&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;OFF &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;-DCMAKE_CXX_FLAGS&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;-stdlib=libc++ -fPIC -DGOOGLE_PROTOBUF_INTERNAL_DONATE_STEAL_INLINE=1&quot;&lt;/span&gt; &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;-DCMAKE_CXX_COMPILER&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;clang++ &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;-DCMAKE_C_COMPILER&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;clang &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
 &lt;span class=&quot;nt&quot;&gt;-DCMAKE_INSTALL_PREFIX&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&amp;lt;YourWorkspace&amp;gt;/Source/ThirdParty/Protobuf/3.21.7

cmake &lt;span class=&quot;nt&quot;&gt;--build&lt;/span&gt; build &lt;span class=&quot;nt&quot;&gt;--config&lt;/span&gt; Release &lt;span class=&quot;nt&quot;&gt;--target&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;install&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-j8&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

</description>
				<pubDate>Thu, 23 Oct 2025 00:00:00 +0000</pubDate>
				<link>/unreal/2025/10/23/UE5_Protobuf.html</link>
				<guid isPermaLink="true">/unreal/2025/10/23/UE5_Protobuf.html</guid>
			</item>
		
			<item>
				<title>Ubuntu22.04 设置无法打开</title>
				<description>&lt;h3 id=&quot;记录一次ubuntu下设置打不开的奇怪问题&quot;&gt;记录一次Ubuntu下设置打不开的奇怪问题&lt;/h3&gt;
&lt;div class=&quot;language-shell highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$DISPLAY&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$XDG_SESSION_TYPE&lt;/span&gt;
gnome-control-center &lt;span class=&quot;nt&quot;&gt;--verbose&lt;/span&gt;
:0
wayland
总线错误 &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;核心已转储&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;尝试重新安装 gnome-control-center, gnome-desktop 之类均未能修复, 只好挂上GDB看看了&lt;/p&gt;

&lt;div class=&quot;language-shell highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;gdb gnome-control-center
GNU gdb &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;Ubuntu 12.1-0ubuntu1~22.04.2&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; 12.1
Copyright &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;C&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; 2022 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later &amp;lt;http://gnu.org/licenses/gpl.html&amp;gt;
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type &lt;span class=&quot;s2&quot;&gt;&quot;show copying&quot;&lt;/span&gt; and &lt;span class=&quot;s2&quot;&gt;&quot;show warranty&quot;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;for &lt;/span&gt;details.
This GDB was configured as &lt;span class=&quot;s2&quot;&gt;&quot;x86_64-linux-gnu&quot;&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;.&lt;/span&gt;
Type &lt;span class=&quot;s2&quot;&gt;&quot;show configuration&quot;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;for &lt;/span&gt;configuration details.
For bug reporting instructions, please see:
&amp;lt;https://www.gnu.org/software/gdb/bugs/&amp;gt;.
Find the GDB manual and other documentation resources online at:
    &amp;lt;http://www.gnu.org/software/gdb/documentation/&amp;gt;.

For &lt;span class=&quot;nb&quot;&gt;help&lt;/span&gt;, &lt;span class=&quot;nb&quot;&gt;type&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;help&quot;&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;.&lt;/span&gt;
Type &lt;span class=&quot;s2&quot;&gt;&quot;apropos word&quot;&lt;/span&gt; to search &lt;span class=&quot;k&quot;&gt;for &lt;/span&gt;commands related to &lt;span class=&quot;s2&quot;&gt;&quot;word&quot;&lt;/span&gt;...
Registered pretty printers &lt;span class=&quot;k&quot;&gt;for &lt;/span&gt;UE classes
Registered pretty printers &lt;span class=&quot;k&quot;&gt;for &lt;/span&gt;UE classes
Registered pretty printers &lt;span class=&quot;k&quot;&gt;for &lt;/span&gt;UE classes
Reading symbols from gnome-control-center...
&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;No debugging symbols found &lt;span class=&quot;k&quot;&gt;in &lt;/span&gt;gnome-control-center&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;gdb&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; r
Starting program: /usr/bin/gnome-control-center 

Program received signal SIGBUS, Bus error.
memset &lt;span class=&quot;o&quot;&gt;()&lt;/span&gt; at ../sysdeps/x86_64/multiarch/memset-vec-unaligned-erms.S:283
283	../sysdeps/x86_64/multiarch/memset-vec-unaligned-erms.S: 没有那个文件或目录.
&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;gdb&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; l
278	&lt;span class=&quot;k&quot;&gt;in&lt;/span&gt; ../sysdeps/x86_64/multiarch/memset-vec-unaligned-erms.S
&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;gdb&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; c
Continuing.

Program terminated with signal SIGBUS, Bus error.
The program no longer exists.
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;那么我们发现 memset 这个函数 Crash 了. 我们检查更底层的gnome依赖的文件是否出现了损坏或异常.&lt;/p&gt;

&lt;div class=&quot;language-shell highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;apt update
&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;apt &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;debsums
&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;debsums &lt;span class=&quot;nt&quot;&gt;-s&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;图形驱动和渲染相关库损坏&quot;&gt;图形驱动和渲染相关库损坏：&lt;/h3&gt;
&lt;div class=&quot;language-shell highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;debsums &lt;span class=&quot;nt&quot;&gt;-s&lt;/span&gt;
debsums: changed file /usr/lib/firefox/libxul.so &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;from firefox package&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
debsums: changed file /usr/lib/x86_64-linux-gnu/dri/kms_swrast_dri.so &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;from libgl1-mesa-dri:amd64 package&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
debsums: changed file /usr/lib/x86_64-linux-gnu/dri/r600_dri.so &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;from libgl1-mesa-dri:amd64 package&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
debsums: changed file /usr/lib/x86_64-linux-gnu/dri/radeonsi_dri.so &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;from libgl1-mesa-dri:amd64 package&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
debsums: changed file /usr/lib/x86_64-linux-gnu/dri/swrast_dri.so &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;from libgl1-mesa-dri:amd64 package&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
debsums: changed file /usr/lib/x86_64-linux-gnu/dri/virtio_gpu_dri.so &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;from libgl1-mesa-dri:amd64 package&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
debsums: changed file /usr/lib/x86_64-linux-gnu/dri/vmwgfx_dri.so &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;from libgl1-mesa-dri:amd64 package&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
debsums: changed file /usr/lib/i386-linux-gnu/dri/kms_swrast_dri.so &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;from libgl1-mesa-dri:i386 package&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
debsums: changed file /usr/lib/i386-linux-gnu/dri/r600_dri.so &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;from libgl1-mesa-dri:i386 package&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
debsums: changed file /usr/lib/i386-linux-gnu/dri/radeonsi_dri.so &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;from libgl1-mesa-dri:i386 package&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
debsums: changed file /usr/lib/i386-linux-gnu/dri/swrast_dri.so &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;from libgl1-mesa-dri:i386 package&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
debsums: changed file /usr/lib/i386-linux-gnu/dri/virtio_gpu_dri.so &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;from libgl1-mesa-dri:i386 package&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
debsums: changed file /usr/lib/i386-linux-gnu/dri/vmwgfx_dri.so &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;from libgl1-mesa-dri:i386 package&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
debsums: changed file /usr/lib/x86_64-linux-gnu/libLLVM-13.so.1 &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;from libllvm13:amd64 package&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
debsums: changed file /usr/lib/x86_64-linux-gnu/libLLVM-14.so.1 &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;from libllvm14:amd64 package&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
debsums: changed file /usr/lib/x86_64-linux-gnu/libLLVM-15.so.1 &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;from libllvm15:amd64 package&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
debsums: changed file /usr/lib/x86_64-linux-gnu/libQt5WebEngineCore.so.5.15.9 &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;from libqt5webenginecore5:amd64 package&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
debsums: changed file /usr/lib/x86_64-linux-gnu/libwebkit2gtk-4.0.so.37.72.6 &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;from libwebkit2gtk-4.0-37:amd64 package&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
debsums: changed file /lib/systemd/system/logrotate.timer &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;from logrotate package&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
debsums: changed file /usr/lib/x86_64-linux-gnu/dri/r600_drv_video.so &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;from mesa-va-drivers:amd64 package&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
debsums: changed file /usr/lib/x86_64-linux-gnu/dri/radeonsi_drv_video.so &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;from mesa-va-drivers:amd64 package&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
debsums: changed file /usr/lib/x86_64-linux-gnu/dri/virtio_gpu_drv_video.so &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;from mesa-va-drivers:amd64 package&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
debsums: changed file /usr/lib/x86_64-linux-gnu/vdpau/libvdpau_r600.so.1.0.0 &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;from mesa-vdpau-drivers:amd64 package&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
debsums: changed file /usr/lib/x86_64-linux-gnu/vdpau/libvdpau_radeonsi.so.1.0.0 &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;from mesa-vdpau-drivers:amd64 package&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
debsums: changed file /usr/lib/x86_64-linux-gnu/vdpau/libvdpau_virtio_gpu.so.1.0.0 &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;from mesa-vdpau-drivers:amd64 package&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
debsums: changed file /usr/share/misc/pci.ids &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;from pci.ids package&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
debsums: changed file /usr/lib/thunderbird/libxul.so &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;from thunderbird package&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
debsums: changed file /usr/lib/thunderbird/omni.ja &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;from thunderbird package&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;重装受损核心库&quot;&gt;重装受损核心库&lt;/h3&gt;
&lt;div class=&quot;language-shell highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;apt &lt;span class=&quot;nb&quot;&gt;install&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--reinstall&lt;/span&gt; &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
libgl1-mesa-dri:amd64 &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
libgl1-mesa-dri:i386 &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
mesa-va-drivers:amd64 &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
mesa-vdpau-drivers:amd64 &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
libllvm13:amd64 &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
libllvm14:amd64 &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
libllvm15:amd64 &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
libwebkit2gtk-4.0-37:amd64 &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
libqt5webenginecore5:amd64 &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
logrotate &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
firefox &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
thunderbird &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
pci.ids
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;h3 id=&quot;再次尝试&quot;&gt;再次尝试&lt;/h3&gt;
&lt;div class=&quot;language-shell highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;gdb gnome-control-center
run
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;成功了!&lt;/p&gt;

</description>
				<pubDate>Tue, 20 May 2025 00:00:00 +0000</pubDate>
				<link>/ubuntu/2025/05/20/gnome-control-center.html</link>
				<guid isPermaLink="true">/ubuntu/2025/05/20/gnome-control-center.html</guid>
			</item>
		
			<item>
				<title>gitea 的烦人认证</title>
				<description>&lt;p&gt;gitea 默认启用了SSH的RSA密钥使用3072的长度&lt;/p&gt;

&lt;p&gt;在 custom/conf/app.ini 中添加下面的内容使其能使用正常的 RAS 密钥&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-ini&quot; data-lang=&quot;ini&quot;&gt;&lt;span class=&quot;nn&quot;&gt;[ssh.minimum_key_sizes]&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;RSA&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;2047&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;git 检查哪里出现了问题&lt;/p&gt;

&lt;p&gt;GIT_SSH_COMMAND=”ssh -v “ git clone you-repo-addr&lt;/p&gt;
</description>
				<pubDate>Wed, 05 Jun 2024 00:00:00 +0000</pubDate>
				<link>/git/2024/06/05/git-ssh.html</link>
				<guid isPermaLink="true">/git/2024/06/05/git-ssh.html</guid>
			</item>
		
			<item>
				<title>vscode 不能代码跳转</title>
				<description>&lt;h4 id=&quot;vscode无法代码跳转的修复&quot;&gt;VSCode无法代码跳转的修复&lt;/h4&gt;

&lt;p&gt;最近 VSCode 中Python代码无法跳转了,恰巧近期还修改了一些工作区配置,这下还以为是自己改错了什么配置各种回退折腾.无果.&lt;/p&gt;

&lt;p&gt;今天突然想起vscode的这个自动升级是不是有问题.把这个1.85.1版本的vscode回退到1.79.2后果然代码跳转恢复好用了.&lt;/p&gt;

</description>
				<pubDate>Tue, 19 Dec 2023 00:00:00 +0000</pubDate>
				<link>/vscode/2023/12/19/vscode.html</link>
				<guid isPermaLink="true">/vscode/2023/12/19/vscode.html</guid>
			</item>
		
			<item>
				<title>Armbian 上编译 synergy-core</title>
				<description>
&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;apt &lt;span class=&quot;nt&quot;&gt;-y&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;qtcreator qtbase5-dev cmake make g++ xorg-dev libssl-dev libx11-dev libsodium-dev libgl1-mesa-glx libegl1-mesa libcurl4-openssl-dev libavahi-compat-libdnssd-dev qtdeclarative5-dev libqt5svg5-dev libsystemd-dev
&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;apt &lt;span class=&quot;nb&quot;&gt;install&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-y&lt;/span&gt; qttools5-dev libnotify-dev libgdk-pixbuf2.0-dev libglib2.0-dev 

&lt;span class=&quot;c&quot;&gt;# cmake 常规套路&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;cd &lt;/span&gt;build
cmake ..
make
&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;make &lt;span class=&quot;nb&quot;&gt;install&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

</description>
				<pubDate>Sun, 05 Nov 2023 00:00:00 +0000</pubDate>
				<link>/synergy/2023/11/05/synergy.html</link>
				<guid isPermaLink="true">/synergy/2023/11/05/synergy.html</guid>
			</item>
		
			<item>
				<title>数学统计的实际意义</title>
				<description>&lt;h2 id=&quot;标准差&quot;&gt;标准差&lt;/h2&gt;

&lt;p&gt;标准差是指一组数据的离散程度或变化量的一种度量，通常用符号 σ 表示。标准差越大，说明数据的离散程度越高，反之则说明数据越接近平均值。标准差的计算公式如下：&lt;/p&gt;

\[\sigma=\sqrt{\frac{1}{N}\sum_{i=1}^{N}(x_i-\mu)^2}\]

&lt;p&gt;其中，$\sigma$ 表示标准差，$x_i$ 表示第 $i$ 个数据点，$\mu$ 表示数据的均值，$n$ 表示数据点的数量。&lt;/p&gt;

&lt;p&gt;在实际应用中，标准差经常用于衡量数据的稳定性和风险程度，例如在金融领域中，投资者经常使用标准差来评估股票或基金的风险水平。标准差还可以用于判断数据是否符合正态分布。如果一组数据符合正态分布，那么其约 68% 的数据会落在平均值的一个标准差内，约 95% 的数据会落在平均值的两个标准差内，约 99.7% 的数据会落在平均值的三个标准差内。&lt;/p&gt;

&lt;h2 id=&quot;残差&quot;&gt;残差&lt;/h2&gt;

&lt;p&gt;在统计学中，残差指的是一个实际观测值与对应的模型预测值之间的差异。也就是说，它是实际值与预测值之间的偏差，表示了模型未能解释的部分。如果一个模型能够完全解释实际观测值的变异，那么其残差将为零。&lt;/p&gt;

&lt;p&gt;在机器学习中，残差可以用来评估模型的性能和预测精度。更准确地说，残差是在训练模型时用来计算误差的。模型的目标是最小化残差的平方和，这个值也被称为损失函数。最小化损失函数的过程就是模型的训练过程，即找到最优的模型参数，使得预测值和实际值之间的差异最小化。&lt;/p&gt;

&lt;p&gt;在回归分析中，残差可以用来检验回归模型的适当性和是否符合假设。如果残差的方差不均匀或存在自相关性，那么就可能需要对模型进行调整。&lt;/p&gt;
</description>
				<pubDate>Wed, 12 Apr 2023 00:00:00 +0000</pubDate>
				<link>/math/2023/04/12/statistics.html</link>
				<guid isPermaLink="true">/math/2023/04/12/statistics.html</guid>
			</item>
		
			<item>
				<title>用Cython来加速numpy数据操作</title>
				<description>&lt;p&gt;Cython是可以方便地用类Python语法代码编译生成C代码,&lt;strong&gt;免除多平台下复杂的C++工程配置&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Python中往往使用numpy来处理大量数值,对其计算时避免不了使用循环.循环数值计算再合并GIL造成的严重的CPU性能损耗.&lt;/p&gt;

&lt;p&gt;那么把 numpy 数据对象转为 C 数组然后执行无GIL的本地编译计算.&lt;/p&gt;

&lt;h5 id=&quot;step-1--nparray-convert-to-c-array&quot;&gt;Step 1 . np.array convert to C array&lt;/h5&gt;

&lt;p&gt;def const c_type[:] view = ndarray&lt;/p&gt;

&lt;p&gt;这个视图操作会产生 memroy copy.&lt;/p&gt;

&lt;p&gt;ndarray.data
ndarray.ctypes.data&lt;/p&gt;

&lt;h5 id=&quot;step-2--c-ptr---c-array&quot;&gt;Step 2 . C ptr -&amp;gt; C array&lt;/h5&gt;

&lt;p&gt;很简单 &amp;amp;view[0] 即可得到地址&lt;/p&gt;

&lt;h5 id=&quot;step-3--numerical-calculation&quot;&gt;Step 3 . numerical calculation&lt;/h5&gt;

&lt;p&gt;val = ptr[0] + ptr[1]&lt;/p&gt;

&lt;h5 id=&quot;step-4--测试&quot;&gt;Step 4 . 测试&lt;/h5&gt;

&lt;p&gt;必须要有完备的单元测试对数值结果进行对比测试&lt;/p&gt;

&lt;h4 id=&quot;不得不提的一些问题&quot;&gt;不得不提的一些问题&lt;/h4&gt;

&lt;h5 id=&quot;1-数据类型问题&quot;&gt;1. 数据类型问题&lt;/h5&gt;

&lt;p&gt;目前还没有找到 numpy data buffer 直接调用对应 C++ template 函数的方法&lt;/p&gt;

</description>
				<pubDate>Fri, 12 Aug 2022 00:00:00 +0000</pubDate>
				<link>/cython/2022/08/12/cython.html</link>
				<guid isPermaLink="true">/cython/2022/08/12/cython.html</guid>
			</item>
		
			<item>
				<title>Linux 开发中使用VSCode连接进程PID调试</title>
				<description>&lt;p&gt;VScode连接 Python 进程调试时出现 “timed out waiting for debug server to connect” 提示, 连接失败.&lt;/p&gt;

&lt;hr /&gt;

&lt;h4 id=&quot;设置为许可模式&quot;&gt;设置为许可模式&lt;/h4&gt;

&lt;p&gt;修改 /etc/sysctl.d/10-ptrace.conf 文件中的 ptrace 的值&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-conf&quot; data-lang=&quot;conf&quot;&gt;&lt;span class=&quot;n&quot;&gt;kernel&lt;/span&gt;.&lt;span class=&quot;n&quot;&gt;yama&lt;/span&gt;.&lt;span class=&quot;n&quot;&gt;ptrace_scope&lt;/span&gt; = &lt;span class=&quot;m&quot;&gt;0&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;重新加载该文件&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;sysctl &lt;span class=&quot;nt&quot;&gt;-p&lt;/span&gt; /etc/sysctl.d/10-ptrace.conf&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;这样操作后 F5 启动调试即可通过PID连接相应进程进行调试了.&lt;/p&gt;

</description>
				<pubDate>Sun, 07 Nov 2021 00:00:00 +0000</pubDate>
				<link>/vscode/2021/11/07/VScodePythonDebug.html</link>
				<guid isPermaLink="true">/vscode/2021/11/07/VScodePythonDebug.html</guid>
			</item>
		
			<item>
				<title>Linux 开发中查看日志</title>
				<description>&lt;h4 id=&quot;多日志文件查看&quot;&gt;多日志文件查看&lt;/h4&gt;
&lt;p&gt;tail -f log/*.log&lt;/p&gt;

</description>
				<pubDate>Wed, 20 Oct 2021 00:00:00 +0000</pubDate>
				<link>/log/2021/10/20/watch_log.html</link>
				<guid isPermaLink="true">/log/2021/10/20/watch_log.html</guid>
			</item>
		
	</channel>
</rss>
