Ninja Build Failure on Ubuntu 20.04

I tried building Swift's master branch on Ubuntu 20.04, and it failed.

FAILED: bindings/ocaml/llvm/llvm.cma bindings/ocaml/llvm/libllvm.a bindings/ocaml/llvm/llvm.cmxa bindings/ocaml/llvm/llvm.a bindings/ocaml/llvm/llvm.cmi bindings/ocaml/llvm/llvm.cmo bindings/ocaml/llvm/llvm.cmx bindings/ocaml/llvm/llvm.o 
cd /home/wowbagger/swift-source/build/Ninja-RelWithDebInfoAssert/llvm-linux-x86_64/bindings/ocaml/llvm && /usr/bin/ocamlfind ocamlmklib -o llvm -lstdc++ -ldopt -L/home/wowbagger/swift-source/build/Ninja-RelWithDebInfoAssert/llvm-linux-x86_64/./lib -ccopt "-L\\\$CAMLORIGIN/../.." -ccopt "-Wl,-rpath,\\\$CAMLORIGIN/../.." -custom -lLLVMCore -lLLVMRemarks -lLLVMBitstreamReader -lLLVMBinaryFormat -lLLVMSupport -lLLVMDemangle -l/usr/lib/x86_64-linux-gnu/libz.so -lrt -ldl -ltinfo -lpthread -lm -ldopt "-Wl,-rpath,\\\$ORIGIN/../../../lib" llvm.mli llvm.ml llvm_ocaml.o
x86_64-linux-gnu-ar: invalid option -- '/'
Usage: x86_64-linux-gnu-ar [emulation options] [-]{dmpqrstx}[abcDfilMNoOPsSTuvV] [--plugin <name>] [member-name] [count] archive-file file...
       x86_64-linux-gnu-ar -M [<mri-script]
 commands:
  d            - delete file(s) from the archive
  m[ab]        - move file(s) in the archive
  p            - print file(s) found in the archive
  q[f]         - quick append file(s) to the archive
  r[ab][f][u]  - replace existing or insert new file(s) into the archive
  s            - act as ranlib
  t[O][v]      - display contents of the archive
  x[o]         - extract file(s) from the archive
 command specific modifiers:
  [a]          - put file(s) after [member-name]
  [b]          - put file(s) before [member-name] (same as [i])
  [D]          - use zero for timestamps and uids/gids (default)
  [U]          - use actual timestamps and uids/gids
  [N]          - use instance [count] of name
  [f]          - truncate inserted file names
  [P]          - use full path names when matching
  [o]          - preserve original dates
  [O]          - display offsets of files in the archive
  [u]          - only replace files that are newer than current archive contents
 generic modifiers:
  [c]          - do not warn if the library had to be created
  [s]          - create an archive index (cf. ranlib)
  [S]          - do not build a symbol table
  [T]          - make a thin archive
  [v]          - be verbose
  [V]          - display the version number
  @<file>      - read options from <file>
  --target=BFDNAME - specify the target object format as BFDNAME
  --output=DIRNAME - specify the output directory for extraction operations
 optional:
  --plugin <p> - load the specified plugin
 emulation options: 
  No emulation specific options
x86_64-linux-gnu-ar: supported targets: elf64-x86-64 elf32-i386 elf32-iamcu elf32-x86-64 pei-i386 pei-x86-64 elf64-l1om elf64-k1om elf64-little elf64-big elf32-little elf32-big pe-x86-64 pe-bigobj-x86-64 pe-i386 srec symbolsrec verilog tekhex binary ihex plugin
[19/2079][  0%][0.045s] Generating VCSRevision.h
-- Found Git: /usr/bin/git (found version "2.25.1") 
[30/2071][  1%][4.462s] Building CXX object utils/benchmark/src/CMakeFiles/benchmark.dir/benchmark_register.cc.o
ninja: build stopped: subcommand failed.
ERROR: command terminated with a non-zero exit status 1, aborting

I've never seen this, though I haven't built Swift master on linux since January. It may be that LLVM automatically tries to build some OCaml bindings if you have it installed, whereas most others don't have that /usr/bin/ocamlfind executable installed.

am getting the same error with the swift-5.3 branch on arch linux, created a bug here: https://bugs.swift.org/browse/SR-13083 .

1 Like
Terms of Service

Privacy Policy

Cookie Policy