From bd9c85bbf2a0ec61c3870f8bc8729106bd400641 Mon Sep 17 00:00:00 2001 From: hbobenicio Date: Mon, 29 Aug 2022 12:40:53 -0300 Subject: [PATCH] faq: adds section about linkers errors when using linkers incompatible with compilers. related #151 --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 0812476..0789449 100644 --- a/README.md +++ b/README.md @@ -214,6 +214,8 @@ curl_easy_setopt(curl_handle, CURLOPT_CAINFO, "/etc/pki/tls/certs/ca-bundle.crt" - You can try hitting the non-TLS version of the endpoint if available. (Not Recommended). 1. **No known conversion between `std::string` and `Aws::String`** - Either turn off custom memory management in the AWS C++ SDK or build it as a static library (`-DBUILD_SHARED_LIBS=OFF`) +1. **I'm getting wierd linking errors like `/usr/bin/ld: /home/<...>bin/lib/libaws-lambda-runtime.a: error adding symbols: file format not recognized clang: error: linker command failed with exit code 1 (use -v to see invocation)`** + - By default this project enables _link-time optimization (LTO)_ (configurable with `ENABLE_LTO` _cmake_ option). This tells compilers to delay optimizations until the linking phase. For some compilers (like _clang_) this means that each compilation unit should be compiled down only to intermediate representations (_e.g._ _clang_ uses _LLVM IR_) instead of directly to native object files. As a side-effect, library archives (like _aws-lambda-runtime_) would also contain only _IR_ code. This may result in linker errors like the above if you use a linker incompatible with the _IR_ code generated by your compiler (e.g. _GNU ld_ linker doesn't support _LLVM IR_). In order for the linking step to succeed with _LTO_ you must either use an appropriate linker with something like `-DCMAKE_CXX_FLAGS="-fuse-ld=lld"` (_GNU ld_ for _gcc_ and _lld_ for _clang_ are known to work) or disable _LTO_ (`-DENABLE_LTO=OFF`). ## License