First, two caveats:
1. Perhaps I’m not seeing something simple. I’m confident that’s not the
case, but I won’t rule it out.
2. I have not tried this on a local install of OpenWhisk---I haven’t yet
been able to get that to install properly. I’m using BlueMix if that matters.
I can create and run the following Swift 4 action from the documentation just
fine.
struct Output: Codable {
let greeting: String
}
func main(completion: (Output?, Error?) -> Void) -> Void {
let result = Output(greeting: "Hello OpenWhisk!")
completion(result, nil)
}
However, with a small change, invoking the action yields the following error:
"The action failed to generate or locate a binary. See logs for details."
Here’s the changed code—all I’ve done is added a second string to Output.
struct Output: Codable {
let greeting: String
let extraValue: String
}
func main(completion: (Output?, Error?) -> Void) -> Void {
let result = Output(greeting: "Hello OpenWhisk!", extraValue:
"Snafu")
completion(result, nil)
}
I’ve included the error log below. But first let me mention that following the
steps in the next section of the documentation “Using a script to build Swift
packaged action” gives me the same result---i.e. a compiler error.
However, if I copy _Whisk.swift and the other necessary pieces from the script
and try to build the action under macOS, it compiles and runs fine.
Here’s the error log. I’ve tried to format it nicely, but it’s still a big wall
of text. The essential point (scroll down to the “logs” key) is that the
compiler (swiftc) crashes during IR generation.
Any help would be appreciated!
Thanks,
Matt
Error log from BlueMix dashboard:
{
"duration":3740,
"name":"test2",
"subject":"[email protected]",
"activationId":"7df2e7fa3bdf4984b2e7fa3bdff984a5",
"publish":false,
"annotations":[
{
"key":"path",
"value":"bluedinoTrial_dev/test2"
},
{
"key":"waitTime",
"value":478
},
{
"key":"kind",
"value":"swift:4.1"
},
{
"key":"limits",
"value":
{
"timeout":60000,
"memory":256,
"logs":10
}
},
{
"key":"initTime",
"value":3740
}
],
"version":"0.0.1",
"response": {
"result": {
"error":"The action failed to generate or locate a binary. See logs
for details."
},
"success":false,
"status":"action developer error"
},
"end":1526045840760,
"logs":[
"2018-05-11T13:37:20.759258968Z stdout: Compiling",
"2018-05-11T13:37:20.759324582Z stdout: swiftc status is 254",
"2018-05-11T13:37:20.759332521Z stdout: Action did not compile",
"2018-05-11T13:37:20.759457212Z stderr: swift:
/home/buildnode/jenkins/workspace/oss-swift-4.1-package-linux-ubuntu-14_04/swift/lib/IRGen/IRGenSIL.cpp:1928:
void emitApplyArgument((anonymous namespace)::IRGenSILFunction &,
swift::SILValue, swift::SILType, swift::irgen::Explosion &): Assertion
`arg->getType().isObject()' failed.",
"2018-05-11T13:37:20.759502143Z stderr: /usr/bin/swift[0x3b78654]",
"2018-05-11T13:37:20.759509769Z stderr: /usr/bin/swift[0x3b78dc6]",
"2018-05-11T13:37:20.759516232Z stderr:
/lib/x86_64-linux-gnu/libpthread.so.0(+0x10330)[0x7fa789685330]",
"2018-05-11T13:37:20.759522369Z stderr:
/lib/x86_64-linux-gnu/libc.so.6(gsignal+0x37)[0x7fa787e67c37]",
"2018-05-11T13:37:20.75952814Z stderr:
/lib/x86_64-linux-gnu/libc.so.6(abort+0x148)[0x7fa787e6b028]",
"2018-05-11T13:37:20.7595339Z stderr:
/lib/x86_64-linux-gnu/libc.so.6(+0x2fbf6)[0x7fa787e60bf6]",
"2018-05-11T13:37:20.759539616Z stderr:
/lib/x86_64-linux-gnu/libc.so.6(+0x2fca2)[0x7fa787e60ca2]",
"2018-05-11T13:37:20.759545148Z stderr: /usr/bin/swift[0x5c3b7e]",
"2018-05-11T13:37:20.759550538Z stderr: /usr/bin/swift[0x5c2733]",
"2018-05-11T13:37:20.75955585Z stderr: /usr/bin/swift[0x5aa218]",
"2018-05-11T13:37:20.759561208Z stderr: /usr/bin/swift[0x5a80c6]",
"2018-05-11T13:37:20.759566503Z stderr: /usr/bin/swift[0x4d4bf5]",
"2018-05-11T13:37:20.759571901Z stderr: /usr/bin/swift[0x58183d]",
"2018-05-11T13:37:20.759577191Z stderr: /usr/bin/swift[0x4bb350]",
"2018-05-11T13:37:20.759582429Z stderr: /usr/bin/swift[0x4b70b1]",
"2018-05-11T13:37:20.759587623Z stderr: /usr/bin/swift[0x4781e2]",
"2018-05-11T13:37:20.759593019Z stderr:
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf5)[0x7fa787e52f45]",
"2018-05-11T13:37:20.759598474Z stderr: /usr/bin/swift[0x475d87]",
"2018-05-11T13:37:20.759603803Z stderr: Stack dump:",
"2018-05-11T13:37:20.759614908Z stderr: 0.\tProgram arguments:
/usr/bin/swift -frontend -c /swift4Action/spm-build/Sources/Action/_Whisk.swift
/swift4Action/spm-build/Sources/Action/main.swift -target x86_64-unknown-linux
-disable-objc-interop -sdk / -I
/swift4Action/spm-build/.build/x86_64-unknown-linux/release -module-cache-path
/swift4Action/spm-build/.build/x86_64-unknown-linux/release/ModuleCache
-suppress-warnings -swift-version 4 -O -D SWIFT_PACKAGE -emit-module-doc-path
/swift4Action/spm-build/.build/x86_64-unknown-linux/release/Action.swiftdoc
-module-name Action -emit-module-path
/swift4Action/spm-build/.build/x86_64-unknown-linux/release/Action.swiftmodule
-emit-dependencies-path
/swift4Action/spm-build/.build/x86_64-unknown-linux/release/Action.build/Action.d
-num-threads 2 -o
/swift4Action/spm-build/.build/x86_64-unknown-linux/release/Action.build/_Whisk.swift.o
-o
/swift4Action/spm-build/.build/x86_64-unknown-linux/release/Action.build/main.swift.o",
"2018-05-11T13:37:20.759629514Z stderr: 1.\tWhile emitting IR SIL
function \"@main\".",
"2018-05-11T13:37:20.759635548Z stderr: <unknown>:0: error: unable to
execute command: Aborted",
"2018-05-11T13:37:20.759643511Z stderr: <unknown>:0: error: compile
command failed due to signal 6 (use -v to see invocation)"
],
"start":1526045837020,
"namespace":"bluedinoTrial_dev"
}
________________________________________________________
The information contained in this e-mail is confidential and/or proprietary to
Capital One and/or its affiliates and may only be used solely in performance of
work or services for Capital One. The information transmitted herewith is
intended only for use by the individual or entity to which it is addressed. If
the reader of this message is not the intended recipient, you are hereby
notified that any review, retransmission, dissemination, distribution, copying
or other use of, or taking of any action in reliance upon this information is
strictly prohibited. If you have received this communication in error, please
contact the sender and delete the material from your computer.