Comments (4)
Here is a simpler reproduce:
Create the two following files
./Package.swift
./Sources/Action/main.swift
Content of Package.swift
// swift-tools-version:4.0
// The swift-tools-version declares the minimum version of Swift required to build this package.
import PackageDescription
let package = Package(
name: "Action",
products: [
.executable(
name: "Action",
targets: ["Action"]
)
],
targets: [
.target(
name: "Action"
)
]
)
Create Sources/Action/main.swift
import Foundation
func _run_main<Out: Encodable>(mainFunction: ( @escaping (Out?, Error?) -> Void) -> Void) {
let resultHandler = { (out: Out?, error: Error?) in
let encoder = JSONEncoder()
do {
let jsonData = try encoder.encode(out)
let jsonString = String(data: jsonData, encoding: .utf8)
print("\(jsonString!)")
} catch {
print("{\"error\":\"Error encoding result\"}")
}
}
let _ = mainFunction(resultHandler)
}
struct Output: Codable {
let greeting: String
let group: String
}
func main(completion: (Output?, Error?) -> Void) -> Void {
let result = Output(greeting: "Hello OpenWhisk!", group: "Avoid")
completion(result, nil)
}
_run_main(mainFunction:main)
Use Swift Docker image to compile
docker run --rm -it -v $(pwd):/owexec swift:4.1 bash
root@15fe743675c1:/# cd /owexec
Try to compile in debug mode
root@15fe743675c1:/owexec# swift build
Compile Swift Module 'Action' (1 sources)
Linking ./.build/x86_64-unknown-linux/debug/Action
As you can see no issues
Then try to compile in release mode
root@15fe743675c1:/owexec# swift build -c release
Compile Swift Module 'Action' (1 sources)
swift: /home/buildnode/jenkins/workspace/oss-swift-4.1-package-linux-ubuntu-16_04/swift/lib/IRGen/IRGenSIL.cpp:1928: void emitApplyArgument((anonymous namespace)::IRGenSILFunction &, swift::SILValue, swift::SILType, swift::irgen::Explosion &): Assertion `arg->getType().isObject()' failed.
/usr/bin/swift[0x3f24d54]
/usr/bin/swift[0x3f25096]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x11390)[0x7f721a60d390]
/lib/x86_64-linux-gnu/libc.so.6(gsignal+0x38)[0x7f7218d4c428]
/lib/x86_64-linux-gnu/libc.so.6(abort+0x16a)[0x7f7218d4e02a]
/lib/x86_64-linux-gnu/libc.so.6(+0x2dbd7)[0x7f7218d44bd7]
/lib/x86_64-linux-gnu/libc.so.6(+0x2dc82)[0x7f7218d44c82]
/usr/bin/swift[0x5f2bd1]
/usr/bin/swift[0x5f1873]
/usr/bin/swift[0x5d6202]
/usr/bin/swift[0x5d3cfb]
/usr/bin/swift[0x4e5ae5]
/usr/bin/swift[0x5ac229]
/usr/bin/swift[0x4c3780]
/usr/bin/swift[0x4beecc]
/usr/bin/swift[0x4778c4]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf0)[0x7f7218d37830]
/usr/bin/swift[0x475179]
Stack dump:
0. Program arguments: /usr/bin/swift -frontend -c /owexec/Sources/Action/main.swift -target x86_64-unknown-linux -disable-objc-interop -sdk / -I /owexec/.build/x86_64-unknown-linux/release -module-cache-path /owexec/.build/x86_64-unknown-linux/release/ModuleCache -swift-version 4 -O -D SWIFT_PACKAGE -color-diagnostics -emit-module-doc-path /owexec/.build/x86_64-unknown-linux/release/Action.swiftdoc -module-name Action -emit-module-path /owexec/.build/x86_64-unknown-linux/release/Action.swiftmodule -emit-dependencies-path /owexec/.build/x86_64-unknown-linux/release/Action.build/Action.d -num-threads 4 -o /owexec/.build/x86_64-unknown-linux/release/Action.build/main.swift.o
1. While emitting IR SIL function "@main".
<unknown>:0: error: unable to execute command: Aborted
<unknown>:0: error: compile command failed due to signal 6 (use -v to see invocation)
error: terminated(1): /usr/bin/swift-build-tool -f /owexec/.build/release.yaml main output:
Now try to workaround by compiling with Optimization off, and compiles with no errors
root@15fe743675c1:/owexec# swift build -c release -Xswiftc -Onone
Compile Swift Module 'Action' (1 sources)
Linking ./.build/x86_64-unknown-linux/release/Action
from openwhisk-runtime-swift.
I created a bug in swift bug tracker here: https://bugs.swift.org/browse/SR-7696
from openwhisk-runtime-swift.
More data points from today
I was able to compile the code with no errors in 4.2 and development snapshots
https://swift.org/builds/swift-4.2-branch/ubuntu1404/swift-4.2-DEVELOPMENT-SNAPSHOT-2018-05-14-a/swift-4.2-DEVELOPMENT-SNAPSHOT-2018-05-14-a-ubuntu14.04.tar.gz
So it looks like the problem is already fixed in the swift-4.2 branch.
from openwhisk-runtime-swift.
Closing a fixed in Swift4.2
from openwhisk-runtime-swift.
Related Issues (20)
- Update Swift to 5.1.4
- Enable Swift SDK testing in GitHub Action CI runs
- Some source files miss Apache license headers HOT 1
- Fix codable escaping for result handler
- update image to latest GA release of Swift 4.1
- Update swift runtime to push master tag to Docker from Travis build
- Rename "license" subdir. to "licenses" to conform to other project repos. HOT 2
- What is the license of ibmcom/swift-ubuntu:3.1.1 HOT 2
- Travis build failure openwhisk-admin-tools dependency not found HOT 1
- build swift41Action failed in my local HOT 2
- Swift 3.1.1 runtime fails for large input HOT 3
- Async Swift Action and Promise/Future HOT 1
- Define Swift development experience HOT 1
- travis failing to build swift 4 image
- Swift 3.1.1 image fails to build due to timeout HOT 1
- Provide Swift 4.2 runtime 🚀 HOT 5
- Feature Request: Pg/MySQL/SQLite HOT 1
- Build is failing due to using `latest` image. HOT 1
- Support Swift 5 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from openwhisk-runtime-swift.