Swift build flags with two --arch

I'm compiling the Xcodegen project and I saw in the Makefile the build flags have:

--arch arm64 --arch x86_64

Source: XcodeGen/Makefile at master · yonaskolb/XcodeGen · GitHub

Does this mean that the resulting binary will run on both Apple Silicon & Intel?

Yes, but note this uses the Xcode build system under the hood, it is not the same as a standard swift build and maybe have subtle differences.

edit: It is also not the same as building a Swift Package in Xcode if I recall correctly.

@rauhul is that why it compiles to 16MB?

I'm guessing you have 2 copies of the symbols in your binary, try using bloaty to understand what's causing the size.

You can remove the symbols from the binary using the strip tool.

Thanks, I looked into that. If this isn't the right place to ask the following just let me know.

I ran bloaty with the suggested flags from the project's README:

bloaty ./xcodegen -d compileunits

and get: bloaty: missing debug info

The version in brew is from 4 years ago, so I cloned and compiled the project directly with the same result.

Running without that flag I get the following table:

    FILE SIZE        VM SIZE
 --------------  --------------
  39.5%  6.26Mi  40.9%  3.35Mi    __TEXT,__text
  25.6%  4.06Mi  24.9%  2.04Mi    String Table
  22.2%  3.52Mi  21.6%  1.77Mi    Symbol Table
   3.3%   531Ki   3.2%   269Ki    Export Info
   1.4%   231Ki   1.2%   101Ki    [41 Others]
   1.1%   182Ki   1.1%  91.7Ki    __DATA,__data
   0.9%   150Ki   0.9%  72.3Ki    __TEXT,__const
   0.7%   112Ki   0.7%  56.5Ki    __TEXT,__cstring
   0.0%       0   1.3%   106Ki    __DATA,__bss
   0.5%  86.3Ki   0.5%  43.1Ki    __TEXT,__swift5_fieldmd
   0.5%  86.0Ki   0.0%       3    __DATA_CONST,__const
   0.5%  83.5Ki   0.2%  16.3Ki    __TEXT,__eh_frame
   0.5%  78.8Ki   0.5%  39.8Ki    __DATA,__objc_const
   0.5%  78.5Ki   0.4%  35.4Ki    Binding Info
   0.5%  78.0Ki   0.4%  35.0Ki    __TEXT,__unwind_info
   0.4%  71.7Ki   0.4%  35.8Ki    __TEXT,__swift5_reflstr
   0.4%  70.1Ki   0.4%  35.2Ki    Lazy Binding Info
   0.4%  66.1Ki   0.8%  66.1Ki    __DATA,__const
   0.4%  62.1Ki   0.4%  31.1Ki    __TEXT,__constg_swiftt
   0.4%  61.8Ki   0.0%       0    Code Signature
   0.3%  50.6Ki   0.3%  25.3Ki    __TEXT,__swift5_typeref
 100.0%  15.9Mi 100.0%  8.20Mi    TOTAL

I don't see a duplication of the Symbols unfortunately. Is there anything obvious that I can strip or do I need that -d compileunits flag to work?