@@ -327,46 +327,62 @@ endif(WITH_BLKIN)
327327
328328## breakpad
329329if (WITH_BREAKPAD)
330+ include (FindMake)
331+ find_make("MAKE_EXECUTABLE" "make_cmd" )
332+
330333 set (breakpad_SOURCE_DIR ${CMAKE_SOURCE_DIR} /src/breakpad)
331334 set (lss_SOURCE_DIR ${CMAKE_SOURCE_DIR} /src/lss)
332335
333- add_custom_target (breakpad_lss_symlink)
334- add_custom_command (
335- TARGET breakpad_lss_symlink
336- PRE_BUILD
337- COMMAND ${CMAKE_COMMAND} -E create_symlink ${lss_SOURCE_DIR} ${breakpad_SOURCE_DIR} /src/third_party/lss
338- COMMENT "Creating symbolic link lss -> breakpad third party"
339- )
340336 ExternalProject_Add(
341337 breakpad_project
342338 SOURCE_DIR "${breakpad_SOURCE_DIR} "
343- CONFIGURE_COMMAND cd "${breakpad_SOURCE_DIR} "
344- COMMAND "${breakpad_SOURCE_DIR} /configure"
345- "CC=${CMAKE_C_COMPILER} "
346- "CXX=${CMAKE_CXX_COMPILER} "
347- "CFLAGS=${CMAKE_C_FLAGS} -fPIC -Wno-unknown-warning-option -Wno-array-bounds -Wno-maybe-uninitialized"
348- "CXXFLAGS=${CMAKE_CXX_FLAGS} -fPIC -Wno-unknown-warning-option -Wno-ignored-qualifiers -Wno-array-bounds -Wno-maybe-uninitialized"
349- "LDFLAGS=${CMAKE_EXE_LINKER_FLAGS} -fPIC -Wno-unknown-warning-option -Wno-array-bounds -Wno-maybe-uninitialized"
350- BUILD_COMMAND
351- /bin/sh -cx "cd ${breakpad_SOURCE_DIR} && make"
352- INSTALL_COMMAND ""
339+ PATCH_COMMAND ${CMAKE_COMMAND} -E create_symlink ${lss_SOURCE_DIR} ${breakpad_SOURCE_DIR} /src/third_party/lss
340+ # the minidump processor is used when processing the minidump, we only
341+ # use the breakpad's client for generating the minidump at this moment.
342+ #
343+ # also cancel the -Werror used by breakpad, as new compilers are more
344+ # picky, and might fail the build because of warnings.
345+ CONFIGURE_COMMAND ${breakpad_SOURCE_DIR} /configure --disable-processor --disable-tools --prefix =<INSTALL_DIR>
346+ "CC=${CMAKE_C_COMPILER} "
347+ "CFLAGS=${CMAKE_C_FLAGS} -fPIC"
348+ "CXX=${CMAKE_CXX_COMPILER} "
349+ "CXXFLAGS=${CMAKE_CXX_FLAGS} -fPIC -Wno-error"
350+ BUILD_COMMAND ${make_cmd}
351+ # Install this library to ensure headers are included with proper prefixed paths
352+ # (e.g., "breakpad/client/linux/handler/minidump_descriptor.h") rather than
353+ # unprefixed paths (e.g., "client/linux/handler/minidump_descriptor.h").
354+ # Prefixed paths make the library dependency explicit and avoid ambiguity.
355+ #
356+ # Note: DESTDIR is unset to prevent Debian packaging from overriding install
357+ # paths, which would break header/library discovery during build. This is safe
358+ # since breakpad artifacts are not redistributed in the final package.
359+ INSTALL_COMMAND ${CMAKE_COMMAND} -E env --unset=DESTDIR ${make_cmd} install
353360 UPDATE_DISCONNECTED ON
354- BUILD_IN_SOURCE ON
355- DEPENDS breakpad_lss_symlink
356- BUILD_BYPRODUCTS "${breakpad_SOURCE_DIR} /src/libbreakpad.a;${breakpad_SOURCE_DIR} /src/client/linux/libbreakpad_client.a"
357- )
358-
359- add_library (libbreakpad STATIC IMPORTED GLOBAL )
360- set_property (TARGET libbreakpad PROPERTY IMPORTED_LOCATION ${breakpad_SOURCE_DIR} /src/libbreakpad.a)
361- add_library (libbreakpad_client STATIC IMPORTED GLOBAL )
362- set_property (TARGET libbreakpad_client PROPERTY IMPORTED_LOCATION ${breakpad_SOURCE_DIR} /src/client/linux/libbreakpad_client.a)
361+ BUILD_BYPRODUCTS "<INSTALL_DIR>/lib/libbreakpad_client.a" )
363362
364- include_directories (SYSTEM "${breakpad_SOURCE_DIR} /src" )
365- add_dependencies (libbreakpad breakpad_project)
366- add_dependencies (libbreakpad_client breakpad_project)
367-
368- add_library (breakpad INTERFACE )
369- target_link_libraries (breakpad INTERFACE libbreakpad libbreakpad_client)
363+ ExternalProject_Get_Property(breakpad_project INSTALL_DIR)
364+ # create the directory so cmake won't complain when looking at the imported
365+ # target
366+ file (MAKE_DIRECTORY ${INSTALL_DIR} /include /breakpad)
367+
368+ add_library (Breakpad::client STATIC IMPORTED GLOBAL )
369+ add_dependencies (Breakpad::client breakpad_project)
370+ set_target_properties (Breakpad::client PROPERTIES
371+ # unfortunately, breakpad's public headers use internal include paths
372+ # (e.g., "client/linux/..." rather than the installed include path
373+ # (e.g., "breakpad/client/linux/..."), because the library's source
374+ # structure differs between build time and install time. so we have to
375+ # add ${INSTALL_DIR}/include/breakpad as well.
376+ INTERFACE_INCLUDE_DIRECTORIES "${INSTALL_DIR} /include;${INSTALL_DIR} /include/breakpad"
377+ IMPORTED_LINK_INTERFACE_LANGUAGES "CXX"
378+ IMPORTED_LOCATION "${INSTALL_DIR} /lib/libbreakpad_client.a" )
379+
380+ # for header-only library
381+ add_library (Breakpad::breakpad INTERFACE IMPORTED GLOBAL )
382+ add_dependencies (Breakpad::breakpad breakpad_project)
383+ set_target_properties (Breakpad::breakpad PROPERTIES
384+ INTERFACE_INCLUDE_DIRECTORIES "${INSTALL_DIR} /include"
385+ IMPORTED_LINK_INTERFACE_LANGUAGES "CXX" )
370386endif (WITH_BREAKPAD)
371387
372388if (WITH_JAEGER)
@@ -525,11 +541,6 @@ if(WITH_JAEGER)
525541 target_link_libraries (common-objs jaeger_base)
526542endif ()
527543
528- if (WITH_BREAKPAD)
529- add_dependencies (common-objs breakpad_project)
530- target_link_libraries (common-objs breakpad)
531- endif ()
532-
533544CHECK_C_COMPILER_FLAG("-fvar-tracking-assignments" HAS_VTA)
534545add_subdirectory (auth)
535546add_subdirectory (common)
@@ -591,10 +602,6 @@ if(WITH_JAEGER)
591602 list (APPEND ceph_common_deps jaeger_base)
592603endif ()
593604
594- if (WITH_BREAKPAD)
595- list (APPEND ceph_common_deps breakpad)
596- endif ()
597-
598605if (WIN32 )
599606 list (APPEND ceph_common_deps ws2_32 mswsock iphlpapi bcrypt)
600607 list (APPEND ceph_common_deps dlfcn_win32)
@@ -623,6 +630,10 @@ if(WITH_BLUESTORE_PMEM OR WITH_RBD_RWL)
623630 endif ()
624631endif ()
625632
633+ if (WITH_BREAKPAD)
634+ list (APPEND ceph_common_deps Breakpad::client)
635+ endif ()
636+
626637add_library (common STATIC ${ceph_common_objs} )
627638target_link_libraries (common
628639 ${ceph_common_deps}
@@ -631,10 +642,6 @@ if(WITH_JAEGER)
631642add_dependencies (common jaeger_base)
632643endif ()
633644
634- if (WITH_BREAKPAD)
635- add_dependencies (common breakpad_project)
636- endif ()
637-
638645if (WIN32 )
639646 # Statically building ceph-common on Windows fails. We're temporarily
640647 # reverting this: 22fefb2338cfc4fcb03ece3cbf77aa964a7f17f2
0 commit comments