Skip to content

libnethost.lib appears to be built with LTCG, making it unusable with non-MSVC toolchains #71056

@alexrp

Description

@alexrp

Description

It seems that, for Windows platforms, the libnethost.lib static library shipped with the .NET SDK is built with LTCG enabled, rendering it entirely unusable by non-MSVC toolchains such as Zig or just plain LLD on its own.

I'm not sure LTCG meaningfully benefits libnethost anyway, so I would argue it should just be disabled here.

Reproduction Steps

#define NETHOST_USE_AS_STATIC

#include "nethost.h"

int main()
{
    char_t buffer[4096];
    size_t buffer_size = sizeof(buffer) / sizeof(char_t);

    (void)get_hostfxr_path(buffer, &buffer_size, NULL);
}

zig cc test.c /path/to/libnethost.lib

Expected behavior

The program should link successfully.

Actual behavior

$ zig cc test.c libnethost.lib
lld-link: error: unknown file type: nethost\CMakeFiles\libnethost.dir\nethost.cpp.obj

Regression?

No.

Known Workarounds

Building from source with LTCG off (presumably), but this is a pretty big inconvenience.

Configuration

  • .NET SDK 6.0.6
  • Windows x64

Other information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions