www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Dub build fails to build my project on macOS with M1 chip

Dub issue: https://github.com/dlang/dub/issues/2954
My repo: https://github.com/Dlang-UPB/D-scanner

Greetings,

When trying to build my project on a macOS machine with the M1 
chip using the ldc compiler and 'dub build', the build fails when 
trying to run dmd's pregenerate command.

When running the command manually, I can see that the linker 
cannot find the 'phobos2-ldc' library. Setting either the 
'LIBRARY_PATH' or 'DFLAGS' env vars with the library path, the 
command executes successfully, but 'dub build' still fails.

I've created an issue in the dub repo and provided additional 
information there.

I've tried a few workarounds. Tried setting the env var in the 
dmd's dub file on my machine (even tried exporting it in the same 
pregen command). Tried adding 'dflags-ldc' in the dub file. 
Neither worked.

Has anyone encountered this issue? Does anyone have any ideas for 
fixing it? I also accept workarounds until we get this issue 
sorted.

Thanks!
Jul 23