Skip to content

linker: undefined symbol _IError_None___index on FreeBSD/clang #27330

@medvednikov

Description

@medvednikov

Description

Multiple bug reports from FreeBSD (clang) fail at link time with:

error: undefined symbol: _IError_None___index

IError_None is the builtin none implementor of the IError interface, and ___index is the interface type-table index entry. In normal builds this is emitted as a compile-time enum constant, e.g.:

enum { _IError_None___index = 1 };

An undefined symbol at link time for something that should be a compile-time enum constant indicates that a reference to it survived in one translation unit while its definition was either not emitted or stripped — i.e. a likely dead-code-elimination / -skip-unused or interface type-table codegen ordering problem. It may be FreeBSD/clang-specific.

Occurrences

  • 5 reports, all FreeBSD / clang.
  • Generated C file basename: hello_world (likely a generic placeholder; the triggering program source was not captured by the bug reporter).

Repro status

Not reproduced. On a normal build the none__ builtin const reliably registers None__ as an IError implementor, so _IError_None___index is always defined (enum { _IError_None___index = 1 };) — a plain fn main(){ println('hello world') } links fine, with the enum present. The specific source / build flags that drop the definition while keeping the reference are still needed.

Anyone who can attach the V program (and exact v flags) that produced this would help isolate it. Most likely candidates to probe: programs that use IError/none/optionals together with indexing, built with -skip-unused, on FreeBSD.

Environment

  • V 0.5.1
  • FreeBSD, clang

Note

You can use the 👍 reaction to increase the issue's priority for developers.

Please note that only the 👍 reaction to the issue itself counts as a vote.
Other reactions and those to comments will not be taken into account.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugs.vlang.ioReported via the bugs.vlang.io crash reporter

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions