Troubleshooting a failed build
As noted in the CUPC2C build instructions
any build failure experienced with
make -j[N] should be retried with just
make. If that is not sufficient to recover, the following are some known
failure modes and possible resolutions:
Out-of-memory when linking
Even without parallel
make, it is possible that the link steps may require
excessive memory on some systems. On a Linux system, failure mode can often be
distinguished by messages similar to either of the following:
collect2: fatal error: ld terminated with signal 9 [Killed] compilation terminated.
clang: error: unable to execute command: Killed clang: error: linker command failed due to signal (use -v to see invocation)
Possible work-arounds include:
makeafter attempting to maximize resource limits as follows.
$ ulimit -d hard $ ulimit -m hard $ ulimit -f hard $ ulimit -s hard $ ulimit -t hard $ ulimit -v hard # omit on macOS
- On systems where they are available, use of the
lldlinkers may dramatically reduce the memory required to link. You can try running the following in
[BLDDIR]to modify the configuration, where
lld, followed by
maketo resume the build from the point at which it had previously failed.
$ cmake -S [SRCDIR] \ -DCMAKE_EXE_LINKER_FLAGS=-fuse-ld=[LINKER] \ -DCMAKE_SHARED_LINKER_FLAGS=-fuse-ld=[LINKER] $ make
If the chosen linker is not supported, this command will just result in different link failures. One can restore the default behavior by giving empty values for the
$ cmake -S [SRCDIR] \ -DCMAKE_EXE_LINKER_FLAGS= \ -DCMAKE_SHARED_LINKER_FLAGS=
- If passing the recommended
cmake, try using the
MinSizeRelbuild type instead. This results in smaller code, at a slight cost in the performance of source-to-source translation. However, this has no impact on the quality or performance of translated UPC code. This can be done by modifying the configuration without starting over.
$ cmake -S [SRCDIR] -DCMAKE_BUILD_TYPE=MinSizeRel $ make
- If passing a
cmake, consider using the build type with the least debugging and greatest optimization which can meet your needs. Description of the build types supported by CMake and the LLVM infrastructure is beyond the scope of this document.