Skip to content

Linker error in program that used to work when using 2.113-rc0 #23731

Description

@deadalnix

main.d :

import config;

void main() {}

config.d:

module config;

private auto genConfig()() {
  string[] config;

  import std;
  foreach (def; "".splitLines().filter!(l => l)
                            .map!(l => l)) {
  }

  return config;
}

enum Config = genConfig();

And for the error:

$ dmd -c -of"main.o" "main.d" -m64 -w -debug -g
$ dmd -of"bin/sdc" main.o -m64 -w -debug -g -Xcc=-fuse-ld=lld -Xcc=-lstdc++ -Xcc=-export-dynamic
ld.lld: error: undefined symbol: ModuleInfo for config
>>> referenced by main.d
>>>               main.o:(ModuleInfo for main)

ld.lld: error: undefined symbol: _D3std9algorithm9iteration__T12FilterResultS6config__T9genConfigZQlFZ15__lambda_L7_C41TAAyaZQCl9__xtoHashFNbNeKxSQEhQEgQDz__TQDsSQDh__TQDdZQDhFZQCxTQCjZQEtZm
>>> referenced by main.d
>>>               main.o:(initializer for TypeInfo_S3std9algorithm9iteration__T12FilterResultS6config__T9genConfigZQlFZ15__lambda_L7_C41TAAyaZQCl)

ld.lld: error: undefined symbol: _D3std9algorithm9iteration__T12FilterResultS6config__T9genConfigZQlFZ15__lambda_L7_C41TAAyaZQCl11__xopEqualsMxFKxSQEiQEhQEa__TQDtSQDi__TQDeZQDiFZQCyTQCkZQEuZb
>>> referenced by main.d
>>>               main.o:(initializer for TypeInfo_S3std9algorithm9iteration__T12FilterResultS6config__T9genConfigZQlFZ15__lambda_L7_C41TAAyaZQCl)
collect2: error: ld returned 1 exit status
[...]

This used to work with dmd 2.112 and before. the mdoule config.d is meant to be header only, it contains no runtime data or information at all.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions