Skip to content

Crash before main() when linking osgEarth::osgEarthImGui (Windows, vcpkg 3.8#1) #2992

Description

@coderc264

Description of the problem:

I'm experiencing a reproducible crash on Windows when linking an application against osgEarth::osgEarthImGui.

The application works correctly when linking only osgEarth::osgEarth, but as soon as osgEarth::osgEarthImGui is added, it crashes before entering main().

The problem occurs in both Debug and Release builds and has been reproduced on two different PCs, using both Visual Studio 2022 and Visual Studio 2026.

The application does not contain any custom Protobuf messages.

The debugger shows the crash occurring during static initialization inside libprotobufd.dll. In Debug, the MSVC STL reports:

cannot construct a string_view from a null pointer and a non-zero size

where:

_Cts = nullptr
_Count = 31

What you have tried:
Fresh vcpkg installation.
Fresh CMake build directory.
Reinstalled all dependencies.
Tested on two different Windows PCs.
Tested with both Visual Studio 2022 and Visual Studio 2026.
Verified that linking only osgEarth::osgEarth works correctly.
Verified that the crash only occurs when osgEarth::osgEarthImGui is linked.
Verified that the crash happens before main().
Verified that the project does not use any custom .proto files.

Screenshot, code block, or data file that will help reproduce the issue:

Minimal CMake:

find_package(osgEarth CONFIG REQUIRED)

add_executable(Test main.cpp)

target_link_libraries(Test PRIVATE
osgEarth::osgEarth
osgEarth::osgEarthImGui
)

Minimal main.cpp:

#include

int main()
{
std::cout << "Hello World\n";
return 0;
}

The application crashes before reaching main().

Debugger message (Debug build):

cannot construct a string_view from a null pointer and a non-zero size

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions