Skip to content

Failing SENTRY_LIBRARY_TYPE string check when building static library #661

@BharatRajT

Description

@BharatRajT

Description

Value of SENTRY_LIBRARY_TYPE is set as "STATIC" when building static library but it is compared with "static" in case-sensitive way (Current CMakeLists.txt line 387) when linking libraries to sentry. The libraries are linked with sentry using PRIVATE keyword even when building static library thus leading to linking errors with winhttp and dbghelp libraries.

# apply platform libraries to sentry library
if(SENTRY_LIBRARY_TYPE STREQUAL "static")
    target_link_libraries(sentry PUBLIC ${_SENTRY_PLATFORM_LIBS})
else()
    target_link_libraries(sentry PRIVATE ${_SENTRY_PLATFORM_LIBS})
endif()

When does the problem happen

  • During build
  • During run-time
  • When capturing a hard crash

Environment

  • OS: Windows 10, 64-bit
  • Compiler: MSVC 19
  • CMake version and config: [e.g. 3.20.21032501, SENTRY_BACKEND=crashpad

Steps To Reproduce

cmake -B build -A Win32 -D SENTRY_BUILD_SHARED_LIBS=OFF -D SENTRY_BUILD_RUNTIMESTATIC=ON -D CMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded -D SENTRY_BACKEND=crashpad -D CMAKE_BUILD_TYPE=Release -S .

Log output

D:\dev\sentry-native>cmake -B build -A Win32 -D SENTRY_BUILD_SHARED_LIBS=OFF -D BUILD_SHARED_LIBS=OFF -D SENTRY_BUILD_RUNTIMESTATIC=ON -D SENTRY_BACKEND=crashpad -D CMAKE_BUILD_TYPE=Release -D CMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded -S .
-- Building for: Visual Studio 16 2019
-- Enabling CMAKE_MSVC_RUNTIME_LIBRARY
-- Selecting Windows SDK version 10.0.18362.0 to target Windows 10.0.19043.
-- The C compiler identification is MSVC 19.29.30038.1
-- The CXX compiler identification is MSVC 19.29.30038.1
-- The ASM compiler identification is MSVC
-- Found assembler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.29.30037/bin/Hostx64/x86/cl.exe
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.29.30037/bin/Hostx64/x86/cl.exe - 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: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.29.30037/bin/Hostx64/x86/cl.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Looking for pthread.h
-- Looking for pthread.h - not found
-- Found Threads: TRUE
-- SENTRY_TRANSPORT=winhttp
-- SENTRY_BACKEND=crashpad
-- SENTRY_LIBRARY_TYPE=STATIC
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of long
-- Check size of long - done
-- ><><> Sentry platform libs PRIVATE. SENTRY_LIBRARY_TYPE=STATIC <><><
-- The ASM_MASM compiler identification is MSVC
-- Found assembler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.29.30037/bin/Hostx64/x86/ml.exe
-- Configuring done
-- Generating done
-- Build files have been written to: D:/dev/sentry-native/build

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions