Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sentry installation and configuration #306

Closed
Prachiagrawal1 opened this issue Jun 17, 2020 · 5 comments · Fixed by #523
Closed

sentry installation and configuration #306

Prachiagrawal1 opened this issue Jun 17, 2020 · 5 comments · Fixed by #523

Comments

@Prachiagrawal1
Copy link

Followed it to use sentry for my cpp app till this step:
To build:

Use Windows Explorer to delete any CMakeFile folder within this folder ...
cd \sentry-native
Patch CMakeLists.txt as follows:

if(WIN32)
set(SENTRY_DEFAULT_TRANSPORT "winhttp")
MY CHANGES BEGIN
https://stackoverflow.com/questions/14172856/compile-with-mt-instead-of-md-using-cmake
https://devblogs.microsoft.com/cppblog/making-cpp-exception-handling-smaller-x64/
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MT -d2FH4-")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MTd -d2FH4-")
set(CMAKE_CXX_STANDARD 17)
add_link_options("-d2:-FH4-")
MY CHANGES END
elseif(APPLE OR LINUX)
set(SENTRY_DEFAULT_TRANSPORT "curl")
else()
set(SENTRY_DEFAULT_TRANSPORT "none")
endif()
Using Power Shell from the right folder:
cmake . -DBUILD_SHARED_LIBS=OFF
This builds the debug version by default
cmake --build . --parallel
build the Release version using Visual Studio 2019 directly
and built the sentry .sln file in release mode after that made a project in cpp then tried including sentry to it but it says "No such directory" for sentry or issues with sentry.h library....how to resolve it.

@pagikiw552
Copy link

Have the same problem.

@Swatinem
Copy link
Member

Swatinem commented Jul 3, 2020

This is basically #170 (comment) as a separate issue. TBH, from your description, I don’t understand what the exact problem here is.

@Swatinem
Copy link
Member

Swatinem commented Jul 3, 2020

I think you also need to set SENTRY_BUILD_RUNTIMESTATIC. Can you try with that and check back?

@Ramjii
Copy link

Ramjii commented Jul 28, 2020

Hi @Swatinem
If it helps understanding the context here, I also had to do what @Prachiagrawal1 suggested in order to get Sentry to work with my project.
Basically, my project is a dll that can be hotswapped, hence the need for compilation with /MT and Sentry to be linked as a static lib, I think that's also her case.

On top of that, I also had to set SENTRY_BUILD_RUNTIMESTATIC as you said, and

target_link_libraries(${TARGET} Shlwapi)
target_link_libraries(${TARGET} winhttp)
target_link_libraries(${TARGET} Dbghelp)

in my project's CMakeLists.

I guess Sentry's CMakeLists can then be improved for this particular situation?
Hope this helps

@Mixaill
Copy link
Contributor

Mixaill commented Jul 28, 2020

Yeah, something like

if(SENTRY_BUILD_RUNTIMESTATIC)
   target_link_libraries(sentry INTERFACE Shlwapi)
   target_link_libraries(sentry INTERFACE winhttp)
   target_link_libraries(sentry INTERFACE Dbghelp)
endif()

can be added in sentry-native's CMakeLists.txt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants