meson icon indicating copy to clipboard operation
meson copied to clipboard

Fix Swift targets with same module name as source file name

Open dblsaiko opened this issue 1 year ago • 0 comments

If you have a library target such as static_library('Foo', 'Foo.swift', '...') and link it to another target, swiftc will crash.

SwiftDriverExecution/MultiJobExecutor.swift:207: Fatal error: multiple producers for output .../Foo.o: Wrapping Swift module Foo & Compiling Foo Foo.swift

Two problems here:

  • The .swiftmodule output target unintendedly also outputs the .o files compiled by the real compile target (it includes the argument -c via get_compile_only_args() which outputs .o files).
  • The combination of -g -emit-module outputs a {modulename}.o for some reason.

This takes away -c -g from the module target command to fix both of these.

dblsaiko avatar Feb 16 '25 21:02 dblsaiko