Skip to content

使用cmake编译example里echo_c++进程启动即报Segmentation fault: 11 #2025

@SillyBoyenjoy

Description

@SillyBoyenjoy

Describe the bug (描述bug)
请问为什么我用cmake编译example里echo_c++里的echo_server进程启动即Segmentation fault: 11,但是直接用Makefile的make编译正常?

Versions (各种版本)
OS:macOS Monterey 12.2.1
Compiler:Clang
brpc:1.3.0
protobuf:3.17.3
cmake version 3.21.3

Additional context/screenshots (更多上下文/截图)
MacBook-Pro:echo_c++ sillyboyenjoy$ cmake -B build && cmake --build build && ./build/echo_server
CMake Deprecation Warning at CMakeLists.txt:18 (cmake_minimum_required):
Compatibility with CMake < 2.8.12 will be removed from a future version of
CMake.

Update the VERSION argument value or use a ... suffix to tell
CMake that the project does not need compatibility with older versions.

-- The C compiler identification is AppleClang 13.1.6.13160021
-- The CXX compiler identification is AppleClang 13.1.6.13160021
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /Library/Developer/CommandLineTools/usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE
-- Found Protobuf: /opt/homebrew/lib/libprotobuf.dylib (found version "3.17.3")
-- Looking for clock_gettime
-- Looking for clock_gettime - found
-- CMAKE_CXX_FLAGS: -DGFLAGS_NS=google -DNDEBUG -O2 -D__const__=unused -pipe -W -Wall -Wno-unused-parameter -fPIC -fno-omit-frame-pointer -Wno-deprecated-declarations -Wno-inconsistent-missing-override
-- CMAKE_CXX_COMPILER_ID:Clang
-- Found OpenSSL: /opt/homebrew/Cellar/openssl@3/3.0.0/lib/libcrypto.dylib (found version "3.0.0")
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/sillyboyenjoy/Project/incubator-brpc/example/echo_c++/build
[ 12%] Running cpp protocol buffer compiler on echo.proto
[ 25%] Building CXX object CMakeFiles/echo_server.dir/server.cpp.o
[ 37%] Building CXX object CMakeFiles/echo_server.dir/echo.pb.cc.o
[ 50%] Linking CXX executable echo_server
[ 50%] Built target echo_server
[ 62%] Building CXX object CMakeFiles/echo_client.dir/client.cpp.o
[ 75%] Building CXX object CMakeFiles/echo_client.dir/echo.pb.cc.o
[ 87%] Linking CXX executable echo_client
[100%] Built target echo_client
Segmentation fault: 11

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugthe code does not work as expectedkind/coredump

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions