getsentry / sentry-unreal

Unreal Engine
https://docs.sentry.io/platforms/unreal/
MIT License
83 stars 34 forks source link

sentry.lib missing debugging info, adds warnings to builds #527

Open riot-pmaconi opened 5 months ago

riot-pmaconi commented 5 months ago

Environment

How do you use Sentry? Sentry SaaS

Which version of the SDK? 0.15.1

How did you install the package? (Git-URL, Assetstore) git

Which version of Unreal? 5.3

Is this happening in Unreal (editor) or on a player like Android, iOS, Windows? This is happening during build instead of at runtime

Steps to Reproduce

  1. Integrate the sentry plugin
  2. Build the Unreal project from source

Expected Result

Sentry does not introduce new warnings into the build

Actual Result

A significant number of linking warnings are generated

Any logs or screenshots

12>sentry.lib(sentry_alloc.obj): Warning LNK4204 : '' is missing debugging information for referencing module; linking object as if no debug info 12>sentry.lib(sentry_value.obj): Warning LNK4204 : '' is missing debugging information for referencing module; linking object as if no debug info 12>sentry.lib(sentry_uuid.obj): Warning LNK4204 : '' is missing debugging information for referencing module; linking object as if no debug info 12>sentry.lib(sentry_envelope.obj): Warning LNK4204 : '' is missing debugging information for referencing module; linking object as if no debug info 12>sentry.lib(sentry_transport.obj): Warning LNK4204 : '' is missing debugging information for referencing module; linking object as if no debug info 12>sentry.lib(sentry_options.obj): Warning LNK4204 : '' is missing debugging information for referencing module; linking object as if no debug info 12>sentry.lib(sentry_core.obj): Warning LNK4204 : '' is missing debugging information for referencing module; linking object as if no debug info 12>sentry.lib(sentry_session.obj): Warning LNK4204 : '' is missing debugging information for referencing module; linking object as if no debug info 12>sentry.lib(sentry_unwinder.obj): Warning LNK4204 : '' is missing debugging information for referencing module; linking object as if no debug info 12>sentry.lib(mpack.obj): Warning LNK4204 : '' is missing debugging information for referencing module; linking object as if no debug info 12>sentry.lib(sentry_json.obj): Warning LNK4204 : '' is missing debugging information for referencing module; linking object as if no debug info 12>sentry.lib(sentry_slice.obj): Warning LNK4204 : '' is missing debugging information for referencing module; linking object as if no debug info 12>sentry.lib(sentry_string.obj): Warning LNK4204 : '' is missing debugging information for referencing module; linking object as if no debug info 12>sentry.lib(sentry_utils.obj): Warning LNK4204 : '' is missing debugging information for referencing module; linking object as if no debug info 12>sentry.lib(sentry_random.obj): Warning LNK4204 : '' is missing debugging information for referencing module; linking object as if no debug info 12>sentry.lib(sentry_logger.obj): Warning LNK4204 : '' is missing debugging information for referencing module; linking object as if no debug info 12>sentry.lib(sentry_path_windows.obj): Warning LNK4204 : '' is missing debugging information for referencing module; linking object as if no debug info 12>sentry.lib(sentry_path.obj): Warning LNK4204 : '' is missing debugging information for referencing module; linking object as if no debug info 12>sentry.lib(sentry_ratelimiter.obj): Warning LNK4204 : '' is missing debugging information for referencing module; linking object as if no debug info 12>sentry.lib(sentry_backend.obj): Warning LNK4204 : '' is missing debugging information for referencing module; linking object as if no debug info 12>sentry.lib(sentry_backend_crashpad.obj): Warning LNK4204 : '' is missing debugging information for referencing module; linking object as if no debug info 12>sentry.lib(sentry_database.obj): Warning LNK4204 : '' is missing debugging information for referencing module; linking object as if no debug info 12>sentry.lib(sentry_transport_winhttp.obj): Warning LNK4204 : '' is missing debugging information for referencing module; linking object as if no debug info 12>sentry.lib(sentry_modulefinder_windows.obj): Warning LNK4204 : '' is missing debugging information for referencing module; linking object as if no debug info 12>sentry.lib(sentry_tracing.obj): Warning LNK4204 : '' is missing debugging information for referencing module; linking object as if no debug info 12>sentry.lib(sentry_scope.obj): Warning LNK4204 : '' is missing debugging information for referencing module; linking object as if no debug info 12>sentry.lib(sentry_unwinder_dbghelp.obj): Warning LNK4204 : '' is missing debugging information for referencing module; linking object as if no debug info 12>sentry.lib(sentry_disk_transport.obj): Warning LNK4204 : '' is missing debugging information for referencing module; linking object as if no debug info 12>sentry.lib(sentry_sync.obj): Warning LNK4204 : '' is missing debugging information for referencing module; linking object as if no debug info 12>sentry.lib(sentry_os.obj): Warning LNK4204 : '' is missing debugging information for referencing module; linking object as if no debug info 12>sentry.lib(sentry_symbolizer_windows.obj): Warning LNK4204 : '' is missing debugging information for referencing module; linking object as if no debug info 12>sentry.lib(sentry_windows_dbghelp.obj): Warning LNK4204 : '' is missing debugging information for referencing module; linking object as if no debug info

tustanivsky commented 5 months ago

I assume the above warnings could be related to how we build sentry-native library which is included in the plugin yet this issue requires some additional investigation to tell for sure.

riot-pmaconi commented 5 months ago

@tustanivsky I believe this is new for us in 0.15.1 and we were previously on 0.13 in case that helps!

bitsandfoxes commented 4 months ago

Hey @riot-pmaconi, when is this happening for you or how are you running into this? Are you using a source-built version of the engine?

riot-pmaconi commented 4 months ago

Hi @bitsandfoxes - this shows up in our build logs when compiling the engine from source.

bitsandfoxes commented 4 months ago

@Swatinem, @supervacuus could you help us out here: Is there something missing from the way we build sentry-native here that would cause warnings like 12>sentry.lib(sentry_alloc.obj): Warning LNK4204 : '' is missing debugging information for referencing module; linking object as if no debug info

supervacuus commented 4 months ago

There can be many reasons why this warning appears. Off the top of my head, the most apparent aspects:

The logs show that the quotes are empty. They should contain a path to a PDB. This could mean that the PDB is missing from the package you distribute or the translation unit has no PDB associated with it.

The latter seems plausible since you set SENTRY_BUILD_SHARED_LIBS in the build script you referenced to OFF. This means you are building a static library, and a PDB doesn't make sense in that context because it is the product of the linker, which is not involved in producing a static library only later when the library is linked in either an executable or dynamic library.

Nonetheless, it is possible to include debug information in a static library (which will increase in size), which the linker will later use to generate the PDB.

You can create a static_debug_info.cmake (name is irrelevant) that contains the following lines:

set(CMAKE_C_FLAGS_RELWITHDEBINFO "/Z7 /O2 /Ob1 /DNDEBUG" CACHE STRING "C Flags for RelWithDebInfo" FORCE)
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "/Z7 /O2 /Ob1 /DNDEBUG" CACHE STRING "CXX Flags for RelWithDebInfo" FORCE)

Then apply it during the CMake configuration phase like this:

cmake -B "build" 
-DSENTRY_BACKEND=crashpad 
-DSENTRY_SDK_NAME=sentry.native.unreal 
-DSENTRY_BUILD_SHARED_LIBS=OFF 
-C static_debug_info.cmake

Can you reproduce the warnings locally to test against this change @tustanivsky and @bitsandfoxes?