<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[muduo网络库在哪吒上编译]]></title><description><![CDATA[<p dir="auto">看懂了陈硕大佬的muduo库, 才算从C++入门到现代C++(应该从C++11算起). 最喜欢大佬做库的同时顺便写本书, 踏踏实实收稿费, 谁说搞开源不赚钱?<br />
<img src="/assets/uploads/files/1631839612090-eacaeb0d-49e4-4c68-957c-0e220198f740-image.png" alt="eacaeb0d-49e4-4c68-957c-0e220198f740-image.png" class=" img-responsive img-markdown" width="390" height="527" /></p>
<p dir="auto">库地址:<br />
<a href="https://github.com/chenshuo/muduo.git" target="_blank" rel="noopener noreferrer nofollow ugc">https://github.com/chenshuo/muduo.git</a></p>
<h2>遇到的问题</h2>
<pre><code>static const int kMaxNumericSize = 48;
// 该行报错:kMaxNumericSize is large enough
static_assert(kMaxNumericSize - 10 &gt; std::numeric_limits&lt;long double&gt;::digi
                "kMaxNumericSize is large enough");
</code></pre>
<p dir="auto">于是注释上面的问题.</p>
<p dir="auto">暴力过编译后文件修改差异:</p>
<pre><code># git diff
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 6071a4e..e151a00 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,8 +1,13 @@
 cmake_minimum_required(VERSION 2.6)

+set(CMAKE_CROSSCOMPILING TRUE)
+set(CMAKE_C_COMPILER "riscv64-unknown-linux-gnu-gcc")
+set(CMAKE_CXX_COMPILER "riscv64-unknown-linux-gnu-g++")
+set(CMAKE_FIND_ROOT_PATH /home/tao/tina-d1-open/out/d1-nezha/staging_dir/toolchain)
+
 project(muduo C CXX)

-enable_testing()
+#enable_testing()

 if(NOT CMAKE_BUILD_TYPE)
   set(CMAKE_BUILD_TYPE "Release")
@@ -20,7 +25,7 @@ set(CXX_FLAGS
  -D_FILE_OFFSET_BITS=64
  -Wall
  -Wextra
- -Werror
+ # -Werror
  -Wconversion
  -Wno-unused-parameter
  -Wold-style-cast
@@ -28,7 +33,7 @@ set(CXX_FLAGS
  -Wpointer-arith
  -Wshadow
  -Wwrite-strings
- -march=native
+ # -march=native
  # -MMD
  -std=c++11
  -rdynamic
diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt
index bed84ad..1f3f021 100644
--- a/examples/CMakeLists.txt
+++ b/examples/CMakeLists.txt
@@ -34,7 +34,7 @@ else()
   add_subdirectory(curl EXCLUDE_FROM_ALL)
 endif()

-if(PROTOBUF_FOUND)
+if(FALSE)
   add_subdirectory(ace/logging)
   add_subdirectory(protobuf)
 else()
diff --git a/muduo/base/CMakeLists.txt b/muduo/base/CMakeLists.txt
index 96e2d02..7ff4597 100644
--- a/muduo/base/CMakeLists.txt
+++ b/muduo/base/CMakeLists.txt
@@ -30,5 +30,5 @@ file(GLOB HEADERS "*.h")
 install(FILES ${HEADERS} DESTINATION include/muduo/base)

 if(MUDUO_BUILD_EXAMPLES)
-  add_subdirectory(tests)
+    #  add_subdirectory(tests)
 endif()
diff --git a/muduo/base/LogStream.cc b/muduo/base/LogStream.cc
index cafd5b8..518e742 100644
--- a/muduo/base/LogStream.cc
+++ b/muduo/base/LogStream.cc
@@ -223,14 +223,14 @@ void FixedBuffer&lt;SIZE&gt;::cookieEnd()

 void LogStream::staticCheck()
 {
-  static_assert(kMaxNumericSize - 10 &gt; std::numeric_limits&lt;double&gt;::digits10,
-                "kMaxNumericSize is large enough");
-  static_assert(kMaxNumericSize - 10 &gt; std::numeric_limits&lt;long double&gt;::digits10,
-                "kMaxNumericSize is large enough");
-  static_assert(kMaxNumericSize - 10 &gt; std::numeric_limits&lt;long&gt;::digits10,
-                "kMaxNumericSize is large enough");
-  static_assert(kMaxNumericSize - 10 &gt; std::numeric_limits&lt;long long&gt;::digits10,
-                "kMaxNumericSize is large enough");
+  //static_assert(kMaxNumericSize - 10 &gt; std::numeric_limits&lt;double&gt;::digits10,
+  //              "kMaxNumericSize is large enough");
+  //static_assert(kMaxNumericSize - 10 &gt; std::numeric_limits&lt;long double&gt;::digits10,
+  //              "kMaxNumericSize is large enough");
+  //static_assert(kMaxNumericSize - 10 &gt; std::numeric_limits&lt;long&gt;::digits10,
+  //              "kMaxNumericSize is large enough");
+  //static_assert(kMaxNumericSize - 10 &gt; std::numeric_limits&lt;long long&gt;::digits10,
+  //              "kMaxNumericSize is large enough");
 }

 template&lt;typename T&gt;
diff --git a/muduo/net/CMakeLists.txt b/muduo/net/CMakeLists.txt
index 7510d87..28cfffe 100644
--- a/muduo/net/CMakeLists.txt
+++ b/muduo/net/CMakeLists.txt
@@ -60,10 +60,10 @@ if(MUDUO_BUILD_EXAMPLES)
   add_subdirectory(tests)
 endif()

-if(PROTOBUF_FOUND)
-  add_subdirectory(protobuf)
-  add_subdirectory(protorpc)
+if(FALSE)
+    add_subdirectory(protobuf)
+    add_subdirectory(protorpc)
 else()
-  add_subdirectory(protobuf EXCLUDE_FROM_ALL)
-  add_subdirectory(protorpc EXCLUDE_FROM_ALL)
+    add_subdirectory(protobuf EXCLUDE_FROM_ALL)
+    add_subdirectory(protorpc EXCLUDE_FROM_ALL)
 endif()
</code></pre>
<p dir="auto">过编~RPC走起, TCP应用走起</p>
]]></description><link>https://bbs.aw-ol.com/topic/431/muduo网络库在哪吒上编译</link><generator>RSS for Node</generator><lastBuildDate>Sun, 19 Apr 2026 05:43:30 GMT</lastBuildDate><atom:link href="https://bbs.aw-ol.com/topic/431.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 17 Sep 2021 01:15:30 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to muduo网络库在哪吒上编译 on Sat, 09 Oct 2021 07:48:09 GMT]]></title><description><![CDATA[<p dir="auto">muduo库依赖几个BOOST头文件, 单纯就是头文件而已.<br />
下载boost_1.75.0无需编译即可.</p>
]]></description><link>https://bbs.aw-ol.com/post/2141</link><guid isPermaLink="true">https://bbs.aw-ol.com/post/2141</guid><dc:creator><![CDATA[aldfaaa]]></dc:creator><pubDate>Sat, 09 Oct 2021 07:48:09 GMT</pubDate></item></channel></rss>