-
Notifications
You must be signed in to change notification settings - Fork 91
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error "plugin needed to handle lto object" while building CPP runtime for Lambda #128
Comments
I had the same issue, but only when building with clang. Using gcc with all the same options was fine. |
I would bet this is the same issue like the one described in #151 . This project by default uses LTO (Link Time Optimization). When building with clang with LTO enabled, the produced .a lib archive will contain LLVM IR Bitcode instead of native object files.
I would also bet the plugin ld is referring to is something like LLVM Gold Plugin The point is that GNU ld (aka ld.bfd) doesn't support LTO (or LLVM IR Bitcode) directly. It may actually work but only if enabling plugins which would extend it and add support for LTO. So you may have to
See #151 for more details |
LTO has caused problems to a few users (see issues linked at the bottom). The problem is the runtime is built as a static library by default unless otherwise specified via CMake flags, and also LTO is enabled by default. Those two things combined means the user must turn on LTO when they build their application if they're using GCC. Since we don't have evidence that LTO is making a substantial difference in the runtime, it seems prudent to leave the option but turn if off by default. Issues where this has been reported: awslabs#151 awslabs#128
Following the blog post "https://aws.amazon.com/blogs/compute/introducing-the-c-lambda-runtime/" to create a custom CPP Lambda function, received an error "/usr/bin/ld: runtime.cpp.o: plugin needed to handle lto object"
Complete error -
[ 50%] Building CXX object CMakeFiles/hello.dir/main.cpp.o
[100%] Linking CXX executable hello
/usr/bin/ld: runtime.cpp.o: plugin needed to handle lto object
CMakeFiles/hello.dir/main.cpp.o: In function
my_handler(aws::lambda_runtime::invocation_request const&)': main.cpp:(.text+0x3f): undefined reference to
aws::lambda_runtime::invocation_response::success(std::string const&, std::string const&)'CMakeFiles/hello.dir/main.cpp.o: In function
main': main.cpp:(.text.startup+0x23): undefined reference to
aws::lambda_runtime::run_handler(std::function<aws::lambda_runtime::invocation_response (aws::lambda_runtime::invocation_request const&)> const&)'collect2: error: ld returned 1 exit status
make[2]: *** [hello] Error 1
make[1]: *** [CMakeFiles/hello.dir/all] Error 2
make: *** [all] Error 2
command executed
$ cmake3 .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=~/out ----> Successful
$ make 3 -----> Errors as above
The text was updated successfully, but these errors were encountered: