Android C/CPP log

本文深入探讨了Android系统中Tombstone机制的工作原理。详细介绍了如何通过UNIX Domain Socket进行调试日志的获取,包括服务器端和服务端的具体实现流程。此外,还分析了当应用程序崩溃时,系统如何捕获信号并生成详细的崩溃日志。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Android use UNIX Domain Socket for get debug log.

usually name "tombstone_0X" and so on in /data/log/logcat/


1. Server

 First , it has a socket server. it's a executable program.

The code was in "system/core/debuggerd/debuggerd.c" 

in the main, it open a IPC socket

int main()
{
    int s;
    struct sigaction act;
    int logsocket = -1;

    logsocket = socket_local_client("logd",
            ANDROID_SOCKET_NAMESPACE_ABSTRACT, SOCK_DGRAM);
    if(logsocket < 0) {
        logsocket = -1;
    } else {
        fcntl(logsocket, F_SETFD, FD_CLOEXEC);
    }

    act.sa_handler = SIG_DFL;
    sigemptyset(&act.sa_mask);
    sigaddset(&act.sa_mask,SIGCHLD);
    act.sa_flags = SA_NOCLDWAIT;
    sigaction(SIGCHLD, &act, 0);

    s = socket_local_server("android:debuggerd",
            ANDROID_SOCKET_NAMESPACE_ABSTRACT, SOCK_STREAM);
    if(s < 0) return -1;
    fcntl(s, F_SETFD, FD_CLOEXEC);

    LOG("debuggerd: " __DATE__ " " __TIME__ "\n");

    for(;;) {
        struct sockaddr addr;
        socklen_t alen;
        int fd;

        alen = sizeof(addr);
        fd = accept(s, &addr, &alen);
        if(fd < 0) continue;

        fcntl(fd, F_SETFD, FD_CLOEXEC);

        handle_crashing_process(fd);
    }
    return 0;
}

when a program crashed, the socket will be connected and the function handle_crashing_process(fd) will be called.

and the log is generated in this function.


2. Client

how could a crashed program connect to the server?

Since every crashed program will receive a signal from the system, so we use "signal" register a signal handle function to the client.

So we can do something before the program die.

the code is "boinic/linker/Debugger.c"

void debugger_init()
{
    signal(SIGILL, debugger_signal_handler);
    signal(SIGABRT, debugger_signal_handler);
    signal(SIGBUS, debugger_signal_handler);
    signal(SIGFPE, debugger_signal_handler);
    signal(SIGSEGV, debugger_signal_handler);
    signal(SIGSTKFLT, debugger_signal_handler);
    signal(SIGPIPE, debugger_signal_handler);
}

and in the "debugger_signal_handler" , we will send our pid to the server

void debugger_signal_handler(int n)
{
    unsigned tid;
    int s;

    /* avoid picking up GC interrupts */
    signal(SIGUSR1, SIG_IGN);

    tid = gettid();
    s = socket_abstract_client("android:debuggerd", SOCK_STREAM);

    if(s >= 0) {
        /* debugger knows our pid from the credentials on the
         * local socket but we need to tell it our tid.  It
         * is paranoid and will verify that we are giving a tid
         * that's actually in our process
         */
        int  ret;

        RETRY_ON_EINTR(ret, write(s, &tid, sizeof(unsigned)));
        if (ret == sizeof(unsigned)) {
            /* if the write failed, there is no point to read on
             * the file descriptor. */
            RETRY_ON_EINTR(ret, read(s, &tid, 1));
            notify_gdb_of_libraries();
        }
        close(s);
    }

    /* remove our net so we fault for real when we return */
    signal(n, SIG_IGN);
}


3. how is the log file produced

in the client, we just write out tid to the server, of course the log is generated by the server.

in it's "handle_crashing_process" function.

static void handle_crashing_process(int fd)
{
.....
 for(;;) {
        n = waitpid(tid, &status, __WALL);


        if(n < 0) {
            if(errno == EAGAIN) continue;
            LOG("waitpid failed: %s\n", strerror(errno));
            goto done;
        }


        LOG("waitpid: n=%d status=%08x\n", n, status);


        if(WIFSTOPPED(status)){
            n = WSTOPSIG(status);
            switch(n) {
            case SIGSTOP:
                LOG("stopped -- continuing\n");
                n = ptrace(PTRACE_CONT, tid, 0, 0);
                if(n) {
                    LOG("ptrace failed: %s\n", strerror(errno));
                    goto done;
                }
                continue;


            case SIGILL:
            case SIGABRT:
            case SIGBUS:
            case SIGFPE:
            case SIGSEGV:
            case SIGSTKFLT: {
                LOG("stopped -- fatal signal\n");
                need_cleanup = engrave_tombstone(cr.pid, tid, debug_uid, n);
                kill(tid, SIGSTOP);
                goto done;
            }


            default:
                LOG("stopped -- unexpected signal\n");
                goto done;
            }
        } else {
            LOG("unexpected waitpid response\n");
            goto done;
        }
    }
...
}

it was done int the "engrave_tombstone"

the function did a lot of things, and we will discuss the detail later.

FAILED: cpp/inspireface/CMakeFiles/InspireFace.dir/c_api/inspireface.cc.o D:\android\Android\Sdk\ndk\25.2.9519653\toolchains\llvm\prebuilt\windows-x86_64\bin\clang++.exe --target=aarch64-none-linux-android21 --sysroot=D:/android/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/sysroot -DFEATURE_BLOCK_ENABLE_OPENCV -DINFERENCE_WRAPPER_ENABLE_MNN -DISF_BUILD_SHARED_LIBS -DInspireFace_EXPORTS -DSODIUM_STATIC -ID:/insightface-master/insightface-master/cpp-package/inspireface/3rdparty/InspireCV/3rdparty/Eigen-3.4.0-Headers -ID:/insightface-master/insightface-master/cpp-package/inspireface/cpp/inspireface/. -ID:/insightface-master/insightface-master/cpp-package/inspireface/3rdparty/MNN/include -ID:/insightface-master/insightface-master/cpp-package/inspireface/cpp/inspireface/libsodium-cmake-master/libsodium/src/libsodium/include -ID:/insightface-master/insightface-master/cpp-package/inspireface/cpp/inspireface/libcorrect/include -ID:/insightface-master/insightface-master/cpp-package/inspireface/cpp/inspireface/include/inspireface -ID:/insightface-master/insightface-master/cpp-package/inspireface/3rdparty/yaml-cpp/include -ID:/insightface-master/insightface-master/cpp-package/inspireface/3rdparty/inspireface-precompile-lite/sqlite -ID:/insightface-master/insightface-master/cpp-package/inspireface/3rdparty/InspireCV/include -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security -g0 -std=c++14 -O3 -O3 -mfpu=neon -O3 -DNDEBUG -fPIC -fvisibility=hidden -fvisibility-inlines-hidden -MD -MT cpp/inspireface/CMakeFiles/InspireFace.dir/c_api/inspireface.cc.o -MF cpp\inspireface\CMakeFiles\InspireFace.dir\c_api\inspireface.cc.o.d -o cpp/inspireface/CMakeFiles/InspireFace.dir/c_api/inspireface.cc.o -c D:/insightface-master/insightface-master/cpp-package/inspireface/cpp/inspireface/c_api/inspireface.cc clang++: warning: argument unused during compilation: '-mfpu=neon' [-Wunused-command-line-argument] In file included from D:/insightface-master/insightface-master/cpp-package/inspireface/cpp/inspireface/c_api/inspireface.cc:8: In file included from D:/insightface-master/insightface-master/cpp-package/inspireface/cpp/inspireface/c_api/inspireface_internal.h:9: In file included from D:/insightface-master/insightface-master/cpp-package/inspireface/cpp/inspireface/./engine/face_session.h:13: In file included from D:/insightface-master/insightface-master/cpp-package/inspireface/cpp/inspireface/./track_module/face_track_module.h:9: In file included from D:/insightface-master/insightface-master/cpp-package/inspireface/cpp/inspireface/./track_module/face_detect/face_detect_adapt.h:10: In file included from D:/insightface-master/insightface-master/cpp-package/inspireface/cpp/inspireface/./middleware/any_net_adapter.h:15: In file included from D:/insightface-master/insightface-master/cpp-package/inspireface/cpp/inspireface/./middleware/model_archive/inspire_archive.h:15: D:/insightface-master/insightface-master/cpp-package/inspireface/cpp/inspireface/./track_module/landmark/landmark_param.h:13:15: warning: anonymous non-C-compatible type given name for linkage purposes by typedef declaration; add a tag name here [-Wnon-c-typedef-for-linkage] typedef struct { ^ SemanticIndex D:/insightface-master/insightface-master/cpp-package/inspireface/cpp/inspireface/./track_module/landmark/landmark_param.h:14:31: note: type is not C-compatible due to this default member initializer int32_t left_eye_center = 67; ^~ D:/insightface-master/insightface-master/cpp-package/inspireface/cpp/inspireface/./track_module/landmark/landmark_param.h:23:3: note: type is given name 'SemanticIndex' for linkage purposes by this typedef declaration } SemanticIndex; ^ In file included from D:/insightface-master/insightface-master/cpp-package/inspireface/cpp/inspireface/c_api/inspireface.cc:8: In file included from D:/insightface-master/insightface-master/cpp-package/inspireface/cpp/inspireface/c_api/inspireface_internal.h:9: In file included from D:/insightface-master/insightface-master/cpp-package/inspireface/cpp/inspireface/./engine/face_session.h:13: In file included from D:/insightface-master/insightface-master/cpp-package/inspireface/cpp/inspireface/./track_module/face_track_module.h:16: D:/insightface-master/insightface-master/cpp-package/inspireface/cpp/inspireface/./track_module/tracker_optional/bytetrack/BYTETracker.h:33:141: warning: implicit conversion from 'long' to 'float' changes value from 9223372036854775807 to 9223372036854775808 [-Wimplicit-const-int-float-conversion] double lapjv(const vector<vector<float> > &cost, vector<int> &rowsol, vector<int> &colsol, bool extend_cost = false, float cost_limit = LONG_MAX, ~ ^~~~~~~~ D:/android/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/lib64/clang/14.0.7/include/limits.h:47:19: note: expanded from macro 'LONG_MAX' #define LONG_MAX __LONG_MAX__ ^~~~~~~~~~~~ <built-in>:84:22: note: expanded from here #define __LONG_MAX__ 9223372036854775807L ^~~~~~~~~~~~~~~~~~~~ D:/insightface-master/insightface-master/cpp-package/inspireface/cpp/inspireface/c_api/inspireface.cc:117:20: error: use of undeclared identifier 'token' result->size = token.size(); ^ D:/insightface-master/insightface-master/cpp-package/inspireface/cpp/inspireface/c_api/inspireface.cc:118:37: error: use of undeclared identifier 'token' result->data = (uint8_t*)malloc(token.size()); ^ D:/insightface-master/insightface-master/cpp-package/inspireface/cpp/inspireface/c_api/inspireface.cc:119:26: error: use of undeclared identifier 'token' memcpy(result->data, token.data(), token.size()); ^ D:/insightface-master/insightface-master/cpp-package/inspireface/cpp/inspireface/c_api/inspireface.cc:119:40: error: use of undeclared identifier 'token' memcpy(result->data, token.data(), token.size()); ^ 2 warnings and 4 errors generated. [545/568] Building CXX object cpp/inspireface/CMakeFiles/InspireFace.dir/track_module/face_track_module.cpp.o clang++: warning: argument unused during compilation: '-mfpu=neon' [-Wunused-command-line-argument] In file included from D:/insightface-master/insightface-master/cpp-package/inspireface/cpp/inspireface/track_module/face_track_module.cpp:6: In file included from D:/insightface-master/insightface-master/cpp-package/inspireface/cpp/inspireface/track_module/face_track_module.h:9: In file included from D:/insightface-master/insightface-master/cpp-package/inspireface/cpp/inspireface/track_module/face_detect/face_detect_adapt.h:10: In file included from D:/insightface-master/insightface-master/cpp-package/inspireface/cpp/inspireface/./middleware/any_net_adapter.h:15: In file included from D:/insightface-master/insightface-master/cpp-package/inspireface/cpp/inspireface/./middleware/model_archive/inspire_archive.h:15: D:/insightface-master/insightface-master/cpp-package/inspireface/cpp/inspireface/./track_module/landmark/landmark_param.h:13:15: warning: anonymous non-C-compatible type given name for linkage purposes by typedef declaration; add a tag name here [-Wnon-c-typedef-for-linkage] typedef struct { ^ SemanticIndex D:/insightface-master/insightface-master/cpp-package/inspireface/cpp/inspireface/./track_module/landmark/landmark_param.h:14:31: note: type is not C-compatible due to this default member initializer int32_t left_eye_center = 67; ^~ D:/insightface-master/insightface-master/cpp-package/inspireface/cpp/inspireface/./track_module/landmark/landmark_param.h:23:3: note: type is given name 'SemanticIndex' for linkage purposes by this typedef declaration } SemanticIndex; ^ In file included from D:/insightface-master/insightface-master/cpp-package/inspireface/cpp/inspireface/track_module/face_track_module.cpp:6: In file included from D:/insightface-master/insightface-master/cpp-package/inspireface/cpp/inspireface/track_module/face_track_module.h:16: D:/insightface-master/insightface-master/cpp-package/inspireface/cpp/inspireface/track_module/tracker_optional/bytetrack/BYTETracker.h:33:141: warning: implicit conversion from 'long' to 'float' changes value from 9223372036854775807 to 9223372036854775808 [-Wimplicit-const-int-float-conversion] double lapjv(const vector<vector<float> > &cost, vector<int> &rowsol, vector<int> &colsol, bool extend_cost = false, float cost_limit = LONG_MAX, ~ ^~~~~~~~ D:/android/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/lib64/clang/14.0.7/include/limits.h:47:19: note: expanded from macro 'LONG_MAX' #define LONG_MAX __LONG_MAX__ ^~~~~~~~~~~~ <built-in>:84:22: note: expanded from here #define __LONG_MAX__ 9223372036854775807L ^~~~~~~~~~~~~~~~~~~~ 2 warnings generated. [546/568] Building CXX object cpp/inspireface/CMakeFiles/I...track_module/tracker_optional/bytetrack/kalmanFilter.cpp.o clang++: warning: argument unused during compilation: '-mfpu=neon' [-Wunused-command-line-argument] [547/568] Building C object cpp/inspireface/CMakeFiles/Ins...__/3rdparty/inspireface-precompile-lite/sqlite/sqlite3.c.o ninja: build stopped: subcommand failed. Build-AndroidArch : Ninja 编译失败! 所在位置 D:\insightface-master\insightface-master\cpp-package\inspireface\command\build_android.ps1:247 字符: 1 + Build-AndroidArch "arm64-v8a" 21 + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Build-AndroidArch
最新发布
08-09
. ├── config.ini ├── demo2example ├── loglib │   ├── ccdeclare.h │   ├── cclog.h │   └── ccsingleton.h ├── makefile ├── source │   ├── getconfig.cpp │   ├── getconfig.h │   ├── subtitdspi.cpp │   ├── subtitdspi.h │   ├── testtitdapi.cpp │   ├── titdapi_req.cpp │   ├── titdapi_req.h │   ├── user.cpp │   ├── user.h │   ├── user_input.cpp │   ├── user_other.cpp │   └── user_prog.cpp ├── spdlog │   └── v1.9.2 │   └── include │   └── spdlog │   ├── async.h │   ├── async_logger.h │   ├── async_logger-inl.h │   ├── cfg │   │   ├── argv.h │   │   ├── env.h │   │   ├── helpers.h │   │   └── helpers-inl.h │   ├── common.h │   ├── common-inl.h │   ├── details │   │   ├── backtracer.h │   │   ├── backtracer-inl.h │   │   ├── circular_q.h │   │   ├── console_globals.h │   │   ├── file_helper.h │   │   ├── file_helper-inl.h │   │   ├── fmt_helper.h │   │   ├── log_msg_buffer.h │   │   ├── log_msg_buffer-inl.h │   │   ├── log_msg.h │   │   ├── log_msg-inl.h │   │   ├── mpmc_blocking_q.h │   │   ├── null_mutex.h │   │   ├── os.h │   │   ├── os-inl.h │   │   ├── periodic_worker.h │   │   ├── periodic_worker-inl.h │   │   ├── registry.h │   │   ├── registry-inl.h │   │   ├── synchronous_factory.h │   │   ├── tcp_client.h │   │   ├── tcp_client-windows.h │   │   ├── thread_pool.h │   │   ├── thread_pool-inl.h │   │   ├── udp_client.h │   │   ├── udp_client-windows.h │   │   └── windows_include.h │   ├── fmt │   │   ├── bin_to_hex.h │   │   ├── bundled │   │   │   ├── args.h │   │   │   ├── chrono.h │   │   │   ├── color.h │   │   │   ├── compile.h │   │   │   ├── core.h │   │   │   ├── fmt.license.rst │   │   │   ├── format.h │   │   │   ├── format-inl.h │   │   │   ├── locale.h │   │   │   ├── os.h │   │   │   ├── ostream.h │   │   │   ├── printf.h │   │   │   ├── ranges.h │   │   │   └── xchar.h │   │   ├── chrono.h │   │   ├── compile.h │   │   ├── fmt.h │   │   ├── ostr.h │   │   ├── ranges.h │   │   └── xchar.h │   ├── formatter.h │   ├── fwd.h │   ├── logger.h │   ├── logger-inl.h │   ├── pattern_formatter.h │   ├── pattern_formatter-inl.h │   ├── sinks │   │   ├── android_sink.h │   │   ├── ansicolor_sink.h │   │   ├── ansicolor_sink-inl.h │   │   ├── base_sink.h │   │   ├── base_sink-inl.h │   │   ├── basic_file_sink.h │   │   ├── basic_file_sink-inl.h │   │   ├── daily_file_sink.h │   │   ├── dist_sink.h │   │   ├── dup_filter_sink.h │   │   ├── hourly_file_sink.h │   │   ├── mongo_sink.h │   │   ├── msvc_sink.h │   │   ├── null_sink.h │   │   ├── ostream_sink.h │   │   ├── qt_sinks.h │   │   ├── ringbuffer_sink.h │   │   ├── rotating_file_sink.h │   │   ├── rotating_file_sink-inl.h │   │   ├── sink.h │   │   ├── sink-inl.h │   │   ├── stdout_color_sinks.h │   │   ├── stdout_color_sinks-inl.h │   │   ├── stdout_sinks.h │   │   ├── stdout_sinks-inl.h │   │   ├── syslog_sink.h │   │   ├── systemd_sink.h │   │   ├── tcp_sink.h │   │   ├── udp_sink.h │   │   ├── wincolor_sink.h │   │   ├── wincolor_sink-inl.h │   │   └── win_eventlog_sink.h │   ├── spdlog.h │   ├── spdlog-inl.h │   ├── stopwatch.h │   ├── tweakme.h │   └── version.h └── userconfig.ini 这是demo2的树形结构,makefile文件如下:#获取.cpp文件 SrcFiles=$(wildcard source/*.cpp spdlog/*.cpp) #使用替换函数获取.o文件 ObjFiles=$(patsubst %.cpp,%.o,$(SrcFiles)) #生成的可执行文件 all:tiexample #目标文件依赖于.o文件 tiexample:$(ObjFiles) g++ -o $@ -I ../../lib -I ./spdlog/v1.9.2/include -I ./loglib -I ./source $(SrcFiles) -Wl,-rpath=../../lib -L ../../lib -l titdapi -lpthread #.o文件依赖于.cpp文件,通配使用,一条就够 %.o:%.cpp g++ -c -I ../../lib -I ./spdlog/v1.9.2/include -I ./loglib -I ./source $< rm *.o ,在demo2目录下输入make,得到的警告信息如下:./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:298:32: 错误:在文件层将‘is_big_endian’声明为‘auto’ inline auto is_big_endian() -> bool { ^ ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:298:32: 错误:trailing return type only available with -std=c++11 or -std=gnu++11 In file included from ./spdlog/v1.9.2/include/spdlog/fmt/bundled/core.h:3234:0, from ./spdlog/v1.9.2/include/spdlog/fmt/fmt.h:24, from ./spdlog/v1.9.2/include/spdlog/common.h:45, from ./spdlog/v1.9.2/include/spdlog/spdlog.h:12, from ./loglib/cclog.h:8, from ./loglib/ccdeclare.h:7, from source/subtitdspi.h:8, from source/user.h:4, from source/user_prog.cpp:1: ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:317:24: 警告:defaulted and deleted functions only available with -std=c++11 or -std=gnu++11 [默认启用] fallback_uintptr() = default; ^ ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h: 在构造函数‘fmt::v8::detail::fallback_uintptr::fallback_uintptr(const void*)’中: ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:319:13: 错误:‘bit_cast’在此作用域中尚未声明 *this = bit_cast<fallback_uintptr>(p); ^ ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:319:38: 错误:expected primary-expression before ‘>’ token *this = bit_cast<fallback_uintptr>(p); ^ ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:320:35: 错误:‘is_big_endian’在此作用域中尚未声明 if (const_check(is_big_endian())) { ^ ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:320:36: 错误:‘const_check’在此作用域中尚未声明 if (const_check(is_big_endian())) { ^ ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h: 在全局域: ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:327:7: 错误:expected nested-name-specifier before ‘uintptr_t’ using uintptr_t = ::uintptr_t; ^ ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:327:17: 错误:expected ‘;’ before ‘=’ token using uintptr_t = ::uintptr_t; ^ ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:327:17: 错误:expected unqualified-id before ‘=’ token ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:328:42: 错误:ISO C++ 不允许声明无类型的‘to_uintptr’ [-fpermissive] inline auto to_uintptr(const void* p) -> uintptr_t { ^ ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:328:42: 错误:在文件层将‘to_uintptr’声明为‘auto’ ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:328:42: 错误:trailing return type only available with -std=c++11 or -std=gnu++11 ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:340:23: 错误:‘constexpr’不是一个类型名 template <typename T> constexpr auto max_value() -> T { ^ ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:340:23: 附注:C++11 ‘constexpr’ only available with -std=c++11 or -std=gnu++11 ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:343:23: 错误:‘constexpr’不是一个类型名 template <typename T> constexpr auto num_bits() -> int { ^ ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:343:23: 附注:C++11 ‘constexpr’ only available with -std=c++11 or -std=gnu++11 ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:347:13: 错误:‘constexpr’不是一个类型名 template <> constexpr auto num_bits<int128_t>() -> int { return 128; } ^ ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:347:13: 附注:C++11 ‘constexpr’ only available with -std=c++11 or -std=gnu++11 ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:348:13: 错误:‘constexpr’不是一个类型名 template <> constexpr auto num_bits<uint128_t>() -> int { return 128; } ^ ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:348:13: 附注:C++11 ‘constexpr’ only available with -std=c++11 or -std=gnu++11 ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:349:13: 错误:‘constexpr’不是一个类型名 template <> constexpr auto num_bits<fallback_uintptr>() -> int { ^ ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:349:13: 附注:C++11 ‘constexpr’ only available with -std=c++11 or -std=gnu++11 ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:363:1: 错误:expected unqualified-id before ‘using’ using iterator_t = decltype(std::begin(std::declval<T&>())); ^ ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:364:23: 错误:expected unqualified-id before ‘using’ template <typename T> using sentinel_t = decltype(std::end(std::declval<T&>())); ^ ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:368:57: 错误:ISO C++ 不允许声明无类型的‘get_data’ [-fpermissive] inline auto get_data(std::basic_string<Char>& s) -> Char* { ^ ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:368:57: 错误:在文件层将‘get_data’声明为‘auto’ ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:368:57: 错误:trailing return type only available with -std=c++11 or -std=gnu++11 ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:372:69: 错误:ISO C++ 不允许声明无类型的‘get_data’ [-fpermissive] inline auto get_data(Container& c) -> typename Container::value_type* { ^ ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:372:69: 错误:在文件层将‘get_data’声明为‘auto’ ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:372:69: 错误:trailing return type only available with -std=c++11 or -std=gnu++11 ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:384:23: 错误:expected unqualified-id before ‘using’ template <typename T> using checked_ptr = T*; ^ ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:385:23: 错误:‘constexpr’不是一个类型名 template <typename T> constexpr auto make_checked(T* p, size_t) -> T* { ^ ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:385:23: 附注:C++11 ‘constexpr’ only available with -std=c++11 or -std=gnu++11 In file included from ./spdlog/v1.9.2/include/spdlog/fmt/fmt.h:24:0, from ./spdlog/v1.9.2/include/spdlog/common.h:45, from ./spdlog/v1.9.2/include/spdlog/spdlog.h:12, from ./loglib/cclog.h:8, from ./loglib/ccdeclare.h:7, from source/subtitdspi.h:8, from source/user.h:4, from source/user_prog.cpp:1: ./spdlog/v1.9.2/include/spdlog/fmt/bundled/core.h:344:30: 错误:‘enable_if_t’未声明 # define FMT_ENABLE_IF(...) enable_if_t<(__VA_ARGS__), int> = 0 ^ ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:392:31: 附注:in expansion of macro ‘FMT_ENABLE_IF’ template <typename Container, FMT_ENABLE_IF(is_contiguous<Container>::value)> ^ ./spdlog/v1.9.2/include/spdlog/fmt/bundled/core.h:344:41: 错误:expected ‘>’ before ‘<’ token # define FMT_ENABLE_IF(...) enable_if_t<(__VA_ARGS__), int> = 0 ^ ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:392:31: 附注:in expansion of macro ‘FMT_ENABLE_IF’ template <typename Container, FMT_ENABLE_IF(is_contiguous<Container>::value)> ^ In file included from ./spdlog/v1.9.2/include/spdlog/fmt/bundled/core.h:3234:0, from ./spdlog/v1.9.2/include/spdlog/fmt/fmt.h:24, from ./spdlog/v1.9.2/include/spdlog/common.h:45, from ./spdlog/v1.9.2/include/spdlog/spdlog.h:12, from ./loglib/cclog.h:8, from ./loglib/ccdeclare.h:7, from source/subtitdspi.h:8, from source/user.h:4, from source/user_prog.cpp:1: ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:398:8: 错误:expected type-specifier before ‘checked_ptr’ -> checked_ptr<typename Container::value_type> { ^ ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:398:8: 错误:expected initializer before ‘checked_ptr’ ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:406:21: 错误:ISO C++ 不允许声明无类型的‘reserve’ [-fpermissive] inline auto reserve(buffer_appender<T> it, size_t n) -> buffer_appender<T> { ^ ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:406:21: 错误:在文件层将‘reserve’声明为‘auto’ ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:406:21: 错误:‘fmt::v8::detail::reserve’声明为‘inline’变量 ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:406:21: 错误:‘int fmt::v8::detail::reserve’声明为模板 ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:406:21: 错误:‘buffer_appender’在此作用域中尚未声明 ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:406:38: 错误:expected primary-expression before ‘>’ token inline auto reserve(buffer_appender<T> it, size_t n) -> buffer_appender<T> { ^ ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:406:40: 错误:‘it’在此作用域中尚未声明 inline auto reserve(buffer_appender<T> it, size_t n) -> buffer_appender<T> { ^ ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:406:51: 错误:expected primary-expression before ‘n’ inline auto reserve(buffer_appender<T> it, size_t n) -> buffer_appender<T> { ^ ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:413:1: 错误:‘constexpr’不是一个类型名 constexpr auto reserve(Iterator& it, size_t) -> Iterator& { ^ ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:413:1: 附注:C++11 ‘constexpr’ only available with -std=c++11 or -std=gnu++11 ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:418:1: 错误:expected unqualified-id before ‘using’ using reserve_iterator = ^ ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:422:1: 错误:‘constexpr’不是一个类型名 constexpr auto to_pointer(OutputIt, size_t) -> T* { ^ ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:422:1: 附注:C++11 ‘constexpr’ only available with -std=c++11 or -std=gnu++11 ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:425:39: 错误:ISO C++ 不允许声明无类型的‘to_pointer’ [-fpermissive] template <typename T> auto to_pointer(buffer_appender<T> it, size_t n) -> T* { ^ ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:425:39: 错误:在文件层将‘to_pointer’声明为‘auto’ ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:425:39: 错误:‘int fmt::v8::detail::to_pointer’声明为模板 ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:425:39: 错误:‘buffer_appender’在此作用域中尚未声明 ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:425:56: 错误:expected primary-expression before ‘>’ token template <typename T> auto to_pointer(buffer_appender<T> it, size_t n) -> T* { ^ ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:425:58: 错误:‘it’在此作用域中尚未声明 template <typename T> auto to_pointer(buffer_appender<T> it, size_t n) -> T* { ^ ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:425:69: 错误:expected primary-expression before ‘n’ template <typename T> auto to_pointer(buffer_appender<T> it, size_t n) -> T* { ^ In file included from ./spdlog/v1.9.2/include/spdlog/fmt/fmt.h:24:0, from ./spdlog/v1.9.2/include/spdlog/common.h:45, from ./spdlog/v1.9.2/include/spdlog/spdlog.h:12, from ./loglib/cclog.h:8, from ./loglib/ccdeclare.h:7, from source/subtitdspi.h:8, from source/user.h:4, from source/user_prog.cpp:1: ./spdlog/v1.9.2/include/spdlog/fmt/bundled/core.h:344:30: 错误:‘enable_if_t’未声明 # define FMT_ENABLE_IF(...) enable_if_t<(__VA_ARGS__), int> = 0 ^ ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:433:31: 附注:in expansion of macro ‘FMT_ENABLE_IF’ template <typename Container, FMT_ENABLE_IF(is_contiguous<Container>::value)> ^ ./spdlog/v1.9.2/include/spdlog/fmt/bundled/core.h:344:41: 错误:expected ‘>’ before ‘<’ token # define FMT_ENABLE_IF(...) enable_if_t<(__VA_ARGS__), int> = 0 ^ ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:433:31: 附注:in expansion of macro ‘FMT_ENABLE_IF’ template <typename Container, FMT_ENABLE_IF(is_contiguous<Container>::value)> ^ In file included from ./spdlog/v1.9.2/include/spdlog/fmt/bundled/core.h:3234:0, from ./spdlog/v1.9.2/include/spdlog/fmt/fmt.h:24, from ./spdlog/v1.9.2/include/spdlog/common.h:45, from ./spdlog/v1.9.2/include/spdlog/spdlog.h:12, from ./loglib/cclog.h:8, from ./loglib/ccdeclare.h:7, from source/subtitdspi.h:8, from source/user.h:4, from source/user_prog.cpp:1: ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:435:27: 错误:‘checked_ptr’未声明 checked_ptr<typename Container::value_type>) ^ ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:435:38: 错误:expected ‘,’ or ‘...’ before ‘<’ token checked_ptr<typename Container::value_type>) ^ ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:436:13: 错误:ISO C++ 不允许声明无类型的‘base_iterator’ [-fpermissive] -> std::back_insert_iterator<Container> { ^ ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:436:13: 错误:在文件层将‘base_iterator’声明为‘auto’ ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:436:13: 错误:trailing return type only available with -std=c++11 or -std=gnu++11 ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:441:1: 错误:‘constexpr’不是一个类型名 constexpr auto base_iterator(Iterator, Iterator it) -> Iterator { ^ ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:441:1: 附注:C++11 ‘constexpr’ only available with -std=c++11 or -std=gnu++11 ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:449:8: 错误:ISO C++ 不允许声明无类型的‘fill_n’ [-fpermissive] -> OutputIt { ^ ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:449:8: 错误:在文件层将‘fill_n’声明为‘auto’ ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:449:8: 错误:trailing return type only available with -std=c++11 or -std=gnu++11 ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:454:65: 错误:ISO C++ 不允许声明无类型的‘fill_n’ [-fpermissive] FMT_CONSTEXPR20 auto fill_n(T* out, Size count, char value) -> T* { ^ ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:454:65: 错误:在文件层将‘fill_n’声明为‘auto’ ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:454:65: 错误:trailing return type only available with -std=c++11 or -std=gnu++11 ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:465:28: 警告:scoped enums only available with -std=c++11 or -std=gnu++11 [默认启用] enum char8_type : unsigned char {}; ^ ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:470:68: 错误:ISO C++ 不允许声明无类型的‘copy_str_noinline’ [-fpermissive] OutputIt out) -> OutputIt { ^ ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:470:68: 错误:在文件层将‘copy_str_noinline’声明为‘auto’ ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:470:68: 错误:trailing return type only available with -std=c++11 or -std=gnu++11 ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:492:18: 错误:ISO C++ 不允许声明无类型的‘utf8_decode’ [-fpermissive] -> const char* { ^ ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:492:18: 错误:在文件层将‘utf8_decode’声明为‘auto’ ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:492:18: 错误:trailing return type only available with -std=c++11 or -std=gnu++11 ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:523:1: 错误:‘constexpr’不是一个类型名 constexpr uint32_t invalid_code_point = ~uint32_t(); ^ ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:523:1: 附注:C++11 ‘constexpr’ only available with -std=c++11 or -std=gnu++11 ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:528:39: 错误:变量或字段‘for_each_codepoint’声明为 void FMT_CONSTEXPR void for_each_codepoint(string_view s, F f) { ^ ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:528:39: 错误:‘string_view’在此作用域中尚未声明 ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:528:56: 错误:expected primary-expression before ‘f’ FMT_CONSTEXPR void for_each_codepoint(string_view s, F f) { ^ ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:559:57: 错误:ISO C++ 不允许声明无类型的‘compute_width’ [-fpermissive] inline auto compute_width(basic_string_view<Char> s) -> size_t { ^ ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:559:57: 错误:在文件层将‘compute_width’声明为‘auto’ ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:559:57: 错误:trailing return type only available with -std=c++11 or -std=gnu++11 ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:564:43: 错误:‘fmt::v8::detail::compute_width’声明为‘inline’变量 FMT_CONSTEXPR inline size_t compute_width(string_view s) { ^ ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:564:43: 错误:‘string_view’在此作用域中尚未声明 ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:564:58: 错误:expected ‘,’ or ‘;’ before ‘{’ token FMT_CONSTEXPR inline size_t compute_width(string_view s) { ^ In file included from ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format.h:3099:0, from ./spdlog/v1.9.2/include/spdlog/fmt/bundled/core.h:3234, from ./spdlog/v1.9.2/include/spdlog/fmt/fmt.h:24, from ./spdlog/v1.9.2/include/spdlog/common.h:45, from ./spdlog/v1.9.2/include/spdlog/spdlog.h:12, from ./loglib/cclog.h:8, from ./loglib/ccdeclare.h:7, from source/subtitdspi.h:8, from source/user.h:4, from source/user_prog.cpp:1: ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format-inl.h:191:30: 错误:expected ‘}’ before end of line # pragma GCC diagnostic push ^ ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format-inl.h:191:30: 错误:expected ‘}’ before end of line ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format-inl.h:191:30: 错误:expected ‘}’ before end of line ./spdlog/v1.9.2/include/spdlog/fmt/bundled/format-inl.h:191:30: 错误:expected declaration before end of line make: *** [source/user_prog.o] 错误 1,请问要怎么修改才能正确运行demo2?
06-27
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值