Issue #18079 has been reported by xtkoba (Tee KOBAYASHI).

----------------------------------------
Bug #18079: [PATCH] make error for MinGW with Clang/LLVM + LLD
https://bugs.ruby-lang.org/issues/18079

* Author: xtkoba (Tee KOBAYASHI)
* Status: Open
* Priority: Normal
* ruby -v: ruby 3.1.0dev (2021-08-16T00:07:09Z master 4cc44bd819) [x64-mingw32]
* Backport: 2.6: UNKNOWN, 2.7: UNKNOWN, 3.0: UNKNOWN
----------------------------------------
```
building spec/ruby/optional/capi/ext/array_spec.so
lld-link: error: x64-ucrt-ruby310.dll: bad file type. Did you specify a DLL instead of an import library?
clang-13: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [../defs/gmake.mk:406: spec/ruby/optional/capi/ext/array_spec.so] Error 1
```

Proposed patch:

```diff
--- a/defs/gmake.mk
+++ b/defs/gmake.mk
@@ -403,7 +403,7 @@
 $(RUBYSPEC_CAPIEXT)/%.$(DLEXT): $(srcdir)/$(RUBYSPEC_CAPIEXT)/%.c $(srcdir)/$(RUBYSPEC_CAPIEXT)/rubyspec.h $(RUBY_H_INCLUDES) $(LIBRUBY_SO)
 	$(ECHO) building $@
 	$(Q) $(MAKEDIRS) $(@D)
-	$(Q) $(DLDSHARED) $(XDLDFLAGS) $(XLDFLAGS) $(ARCH_FLAG) $(ARCH_FLAG) $(CFLAGS) $(INCFLAGS) $(CPPFLAGS) $(OUTFLAG)$@ $< $(LIBRUBY_SO)
+	$(Q) $(DLDSHARED) $(XDLDFLAGS) $(XLDFLAGS) $(ARCH_FLAG) $(ARCH_FLAG) $(CFLAGS) $(INCFLAGS) $(CPPFLAGS) $(OUTFLAG)$@ $< $(LIBRUBY)
 	$(Q) $(RMALL) $@.*
 
 rubyspec-capiext: $(patsubst %.c,$(RUBYSPEC_CAPIEXT)/%.$(DLEXT),$(notdir $(wildcard $(srcdir)/$(RUBYSPEC_CAPIEXT)/*.c)))
```



-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>