Request assistance resolving linker error: Undefined symbol(s) for architecture x86_64

anonymouse anony at mouse.com
Wed Aug 3 06:01:43 UTC 2022


On Wednesday, 3 August 2022 at 05:04:08 UTC, H. S. Teoh wrote:
> On Wed, Aug 03, 2022 at 04:28:57AM +0000, anonymouse via 
> Digitalmars-d-learn wrote:
>> How do I go about tracking down what's causing the following 
>> error:
>> 
>> ```
>> Undefined symbols for architecture x86_64:
>>   "__D3std8internal6memory12__ModuleInfoZ", referenced from:
>>       __D3loxQe12__ModuleInfoZ in dlux.o
>> ld: symbol(s) not found for architecture x86_64
>> clang: error: linker command failed with exit code 1 (use -v 
>> to see
>> invocation)
>> ```
>> 
>> I'm not explicitly calling anything in std.internal.memory so 
>> not sure how to resolve. Thanks.
> [...]
>
> This is often a sign of version mismatch between libraries and 
> compiler. Did you recently upgrade your compiler?  Did you 
> accidentally install two versions of the standard library and 
> the new compiler is mistakenly picking up the old library?

Interesting... no I only have one version of DMD installed on this
computer (v2.100.0) and it's never been updated.


> Maybe try also recompiling your project from clean slate just 
> in case your build process is picking up stale binaries for 
> whatever reason. If you have object files compiled with the old 
> version of the compiler still lying around, and they get picked 
> up when compiling with the new compiler, it would cause link 
> errors like the above.

This project aims at learning how compilers work. I'm simply 
adapting Robert Nystrom's code from his book [Crafting 
Compiler](http://www.craftinginterpreters.com/scanning.html). The 
source tree currently looks like this:

```
lox
   |
   + lox.d
   |
   + main.d
   |
   + scanner.d
   |
   + token.d
   |
   + tokentype.d
```

My entire build process comprises issuing the command:
```
dmd -of=dlux lox/*
```

I've tried using -J, -I, and moving main to the current working 
directory but all these result in the same error.

--anonymouse



More information about the Digitalmars-d-learn mailing list