https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118495
--- Comment #11 from Brecht Sanders <brechtsanders at users dot sourceforge.net> --- Apparently MinGW-w64 dosn't like extern char** environ; To avoid this issue for now I commented out the following in gcc/cp/module.cc: extern char **environ; while (const char *var = environ[vars.length ()]) vars.safe_push (var); Then I'm one step closer and the result is: x86_64-w64-mingw32-gdc -lstdc++ -g -O2 -DIN_GCC -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-error=narrowing -Wwrite-strings -Wcast-qual -Wmissing-format-attribute -Wconditionally-supported -Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -DHAVE_CONFIG_H -no-pie -static-libstdc++ -static-libgcc -Wl,--stack,12582912 -Wl,--undefined=HOST_EXTRA_OBJS_SYMBOL -static-libphobos -o d21.exe \ d/access.o d/aggregate.o d/aliasthis.o d/arrayop.o d/arraytypes.o d/attrib.o d/attribsem.o d/ast_node.o d/astcodegen.o d/astenums.o d/blockexit.o d/builtin.o d/canthrow.o d/chkformat.o d/clone.o d/common-bitfields.o d/common-charactertables.o d/common-file.o d/common-identifiertables.o d/common-outbuffer.o d/common-smallbuffer.o d/compiler.o d/cond.o d/constfold.o d/cparse.o d/ctfeexpr.o d/ctorflow.o d/cxxfrontend.o d/dcast.o d/dclass.o d/declaration.o d/delegatize.o d/denum.o d/deps.o d/dimport.o d/dinterpret.o d/dmacro.o d/dmodule.o d/doc.o d/dscope.o d/dstruct.o d/dsymbol.o d/dsymbolsem.o d/dtemplate.o d/dtoh.o d/dversion.o d/entity.o d/enumsem.o d/errors.o d/errorsink.o d/escape.o d/expression.o d/expressionsem.o d/file_manager.o d/func.o d/funcsem.o d/globals.o d/gluelayer.o d/hdrgen.o d/iasm.o d/iasmgcc.o d/id.o d/identifier.o d/impcnvtab.o d/imphint.o d/importc.o d/init.o d/initsem.o d/inline.o d/intrange.o d/json.o d/lambdacomp.o d/lexer.o d/location.o d/mangle-basic.o d/mangle-cpp.o d/mangle-package.o d/mtype.o d/mustuse.o d/nogc.o d/nspace.o d/ob.o d/objc.o d/opover.o d/optimize.o d/parse.o d/pragmasem.o d/printast.o d/root-aav.o d/root-array.o d/root-bitarray.o d/root-complex.o d/root-ctfloat.o d/root-file.o d/root-filename.o d/root-hash.o d/root-longdouble.o d/root-optional.o d/root-port.o d/root-region.o d/root-rmem.o d/root-speller.o d/root-string.o d/root-stringtable.o d/root-utf.o d/rootobject.o d/safe.o d/semantic2.o d/semantic3.o d/sideeffect.o d/statement.o d/statementsem.o d/staticassert.o d/staticcond.o d/stmtstate.o d/target.o d/templateparamsem.o d/templatesem.o d/timetrace.o d/tokens.o d/traits.o d/typesem.o d/typinf.o d/utils.o d/visitor-foreachvar.o d/visitor-package.o d/visitor-parsetime.o d/visitor-permissive.o d/visitor-postorder.o d/visitor-statement_rewrite_walker.o d/visitor-transitive.o d/d-attribs.o d/d-builtins.o d/d-codegen.o d/d-compiler.o d/d-convert.o d/d-ctfloat.o d/d-diagnostic.o d/d-frontend.o d/d-gimplify.o d/d-incpath.o d/d-lang.o d/d-longdouble.o d/d-port.o d/d-target.o d/decl.o d/expr.o d/imports.o d/intrinsics.o d/modules.o d/runtime.o d/toir.o d/typeinfo.o d/types.o i386-d.o winnt-d.o attribs.o libbackend.a main.o libcommon-target.a libcommon.a ../libcpp/libcpp.a ../libdecnumber/libdecnumber.a libcommon.a ../libcpp/libcpp.a ../libbacktrace/.libs/libbacktrace.a ../libiberty//libiberty.a ../libdecnumber/libdecnumber.a -L/home/brecht/build-gcc/gcc-x86_64-w64-mingw32/lib -lisl -L/home/brecht/build-gcc/gcc-x86_64-w64-mingw32/lib -L/home/brecht/build-gcc/gcc-x86_64-w64-mingw32/lib -L/home/brecht/build-gcc/gcc-x86_64-w64-mingw32/lib -L/home/brecht/build-gcc/gcc-x86_64-w64-mingw32/lib -L/home/brecht/build-gcc/gcc-x86_64-w64-mingw32/lib -L/home/brecht/build-gcc/gcc-x86_64-w64-mingw32/lib -lmpc -lmpfr -lgmp -L./../zlib -lz /home/brecht/build-gcc/gcc-cross/lib/gcc/x86_64-w64-mingw32/15.0.1/../../../../x86_64-w64-mingw32/bin/ld: d/canthrow.o: in function `dmd.canthrow.canThrow(dmd.expression.Expression, dmd.func.FuncDeclaration, dmd.errorsink.ErrorSink)': /home/brecht/build-gcc/build_stage2-gcc-x86_64-w64-mingw32/gcc/../../gcc-15-20250119/gcc/d/dmd/canthrow.d:60:(.text$_D3dmd8canthrow8canThrowFCQy10expression10ExpressionCQBz4func15FuncDeclarationCQCz9errorsink9ErrorSinkZEQDyQDx2CT[_D3dmd8canthrow8canThrowFCQy10expression10ExpressionCQBz4func15FuncDeclarationCQCz9errorsink9ErrorSinkZEQDyQDx2CT]+0x18): undefined reference to `_d_allocmemory' /home/brecht/build-gcc/gcc-cross/lib/gcc/x86_64-w64-mingw32/15.0.1/../../../../x86_64-w64-mingw32/bin/ld: d/clone.o: in function `core.internal.array.appending._d_arrayappendcTX!(dmd.declaration.VarDeclaration[], dmd.declaration.VarDeclaration)._d_arrayappendcTX(scope return ref dmd.declaration.VarDeclaration[], ulong)': /home/brecht/build-gcc/gcc-cross/lib/gcc/x86_64-w64-mingw32/15.0.1/include/d/core/internal/array/appending.d:41:(.text$_D3dmd5clone13buildPostBlitFCQBb7dstruct17StructDeclarationPSQCh6dscope5ScopeZCQCz4func15FuncDeclaration[_D3dmd5clone13buildPostBlitFCQBb7dstruct17StructDeclarationPSQCh6dscope5ScopeZCQCz4func15FuncDeclaration]+0x5d4): undefined reference to `_d_arrayappendcTX' /home/brecht/build-gcc/gcc-cross/lib/gcc/x86_64-w64-mingw32/15.0.1/../../../../x86_64-w64-mingw32/bin/ld: d/clone.o: in function `core.internal.array.appending._d_arrayappendcTX!(dmd.expression.Expression[], dmd.expression.Expression)._d_arrayappendcTX(scope return ref dmd.expression.Expression[], ulong)': /home/brecht/build-gcc/gcc-cross/lib/gcc/x86_64-w64-mingw32/15.0.1/include/d/core/internal/array/appending.d:41:(.text$_D3dmd5clone13buildPostBlitFCQBb7dstruct17StructDeclarationPSQCh6dscope5ScopeZCQCz4func15FuncDeclaration[_D3dmd5clone13buildPostBlitFCQBb7dstruct17StructDeclarationPSQCh6dscope5ScopeZCQCz4func15FuncDeclaration]+0x13d2): undefined reference to `_d_arrayappendcTX' /home/brecht/build-gcc/gcc-cross/lib/gcc/x86_64-w64-mingw32/15.0.1/../../../../x86_64-w64-mingw32/bin/ld: /home/brecht/build-gcc/gcc-cross/lib/gcc/x86_64-w64-mingw32/15.0.1/include/d/core/internal/array/appending.d:41:(.text$_D4core8internal5array9appending__T17_d_arrayappendcTXHTAC3dmd10expression10ExpressionTQBeZQCeFNaNbNcNeMNkKQBzmZQCe[_D4core8internal5array9appending__T17_d_arrayappendcTXHTAC3dmd10expression10ExpressionTQBeZQCeFNaNbNcNeMNkKQBzmZQCe]+0x2f): undefined reference to `_d_arrayappendcTX' /home/brecht/build-gcc/gcc-cross/lib/gcc/x86_64-w64-mingw32/15.0.1/../../../../x86_64-w64-mingw32/bin/ld: d/clone.o: in function `core.internal.array.appending._d_arrayappendcTX!(dmd.declaration.VarDeclaration[], dmd.declaration.VarDeclaration)._d_arrayappendcTX(scope return ref dmd.declaration.VarDeclaration[], ulong)': /home/brecht/build-gcc/gcc-cross/lib/gcc/x86_64-w64-mingw32/15.0.1/include/d/core/internal/array/appending.d:41:(.text$_D4core8internal5array9appending__T17_d_arrayappendcTXHTAC3dmd11declaration14VarDeclarationTQBjZQCjFNaNbNcNeMNkKQCemZQCj[_D4core8internal5array9appending__T17_d_arrayappendcTXHTAC3dmd11declaration14VarDeclarationTQBjZQCjFNaNbNcNeMNkKQCemZQCj]+0x2f): undefined reference to `_d_arrayappendcTX' /home/brecht/build-gcc/gcc-cross/lib/gcc/x86_64-w64-mingw32/15.0.1/../../../../x86_64-w64-mingw32/bin/ld: d/common-outbuffer.o: in function `_D4core8internal5array8capacity__T22_d_arraysetlengthTImplHTAaTaZ18_d_arraysetlengthTFNaNbNeNkMKQBkmZm': /home/brecht/build-gcc/gcc-cross/lib/gcc/x86_64-w64-mingw32/15.0.1/include/d/core/internal/array/capacity.d:47:(.text$_D4core8internal5array13concatenation__T14_d_arraycatnTXTAaTAxaTQeZQBbFNaNbNeKQsQuZQBa[_D4core8internal5array13concatenation__T14_d_arraycatnTXTAaTAxaTQeZQBbFNaNbNeKQsQuZQBa]+0x67): undefined reference to `_d_arraysetlengthiT' /home/brecht/build-gcc/gcc-cross/lib/gcc/x86_64-w64-mingw32/15.0.1/../../../../x86_64-w64-mingw32/bin/ld: /home/brecht/build-gcc/gcc-cross/lib/gcc/x86_64-w64-mingw32/15.0.1/include/d/core/internal/array/capacity.d:47:(.text$_D4core8internal5array8capacity__T22_d_arraysetlengthTImplHTAaTaZ18_d_arraysetlengthTFNaNbNeNkMKQBkmZm[_D4core8internal5array8capacity__T22_d_arraysetlengthTImplHTAaTaZ18_d_arraysetlengthTFNaNbNeNkMKQBkmZm]+0x1c): undefined reference to `_d_arraysetlengthiT' /home/brecht/build-gcc/gcc-cross/lib/gcc/x86_64-w64-mingw32/15.0.1/../../../../x86_64-w64-mingw32/bin/ld: d/dmodule.o: in function `core.internal.array.appending._d_arrayappendcTX!(dmd.identifier.Identifier[], dmd.identifier.Identifier)._d_arrayappendcTX(scope return ref dmd.identifier.Identifier[], ulong)': /home/brecht/build-gcc/gcc-cross/lib/gcc/x86_64-w64-mingw32/15.0.1/include/d/core/internal/array/appending.d:41:(.text$_D4core8internal5array9appending__T17_d_arrayappendcTXHTAC3dmd10identifier10IdentifierTQBeZQCeFNaNbNcNeMNkKQBzmZQCe[_D4core8internal5array9appending__T17_d_arrayappendcTXHTAC3dmd10identifier10IdentifierTQBeZQCeFNaNbNcNeMNkKQBzmZQCe]+0x2f): undefined reference to `_d_arrayappendcTX' /home/brecht/build-gcc/gcc-cross/lib/gcc/x86_64-w64-mingw32/15.0.1/../../../../x86_64-w64-mingw32/bin/ld: /home/brecht/build-gcc/gcc-cross/lib/gcc/x86_64-w64-mingw32/15.0.1/include/d/core/internal/array/appending.d:41:(.text$_D3dmd5parse__T6ParserTSQw10astcodegen10ASTCodegenTCQBy5lexer5LexerZQCb11parseImportMFZPSQDj4root5array__T5ArrayTCQEi7dsymbol7DsymbolZQBc[_D3dmd5parse__T6ParserTSQw10astcodegen10ASTCodegenTCQBy5lexer5LexerZQCb11parseImportMFZPSQDj4root5array__T5ArrayTCQEi7dsymbol7DsymbolZQBc]+0x182): undefined reference to `_d_arrayappendcTX' ...