On a freshly-minted Ubuntu 18.04 server I get the error below when trying to build my Swift project. I have installed Swift 5.1.2. Any ideas?
BR,
Mark
swift build
/usr/bin/ld.gold: fatal error: out of file descriptors and couldn't close any
clang-7: error: linker command failed with exit code 1 (use -v to see invocation)
:0: error: link command failed with exit code 1 (use -v to see invocation)
[0/1] Linking ProjectName
I'm glad you resolved the issue but I'm slightly surprised that we need more than 1024 open files to compile a Swift project. What kind of project is that?
So the largest module has 277 files. The total amount of files the Swift compiler as a whole seems to produce for this module is
$ find .build/x86_64-apple-macosx/debug/AccountTransactionApiV3p1p2Types.build/ -type f | wc -l
1388
which means it seems to produce roughly 5 output files per input file. So if it wants to open the input file as well as all the output files all in one go, it will need more than 1024 files... I would argue that is a bit excessive and we should look into options to reduce this, if the compiler team determine that this is impossible or too much work, then the compiler should still output at least an actionable error message telling you to raise ulimit -n to something high, it might even be able to give you an estimate given the number of source files.
Thanks Johannes for the analysis. I can have a go at a bug report but will be Fri or Sat as Finnovation Labs is exhibiting and demo-ing Open Banking Connector at a conference this week: https://fdata.global/summit/sponsors-2019/