swift-lambda icon indicating copy to clipboard operation
swift-lambda copied to clipboard

libicudataswift.so.65 missing using `--configuration debug`

Open alfavata opened this issue 5 years ago • 4 comments

I'm trying to adopt swift-lambda to replace Fabian's process, but my lambda gets a runtime error:

START RequestId: b4ca0e88-b5f5-44c3-99ed-7ab83cf010b3 Version: $LATEST
/var/task/bootstrap: error while loading shared libraries: libicudataswift.so.65: cannot open shared object file: No such file or directory
END RequestId: b4ca0e88-b5f5-44c3-99ed-7ab83cf010b3
REPORT RequestId: b4ca0e88-b5f5-44c3-99ed-7ab83cf010b3	Duration: 80.48 ms	Billed Duration: 100 ms	Memory Size: 128 MB	Max Memory Used: 6 MB	
RequestId: b4ca0e88-b5f5-44c3-99ed-7ab83cf010b3 Error: Runtime exited with error: exit status 127
Runtime.ExitError

I'm afraid I won't have the opportunity to look more into this now, although I hope to be able to do so next week. But I'd appreciate any suggestions in the meantime... perhaps I'm missing something really obvious?

alfavata avatar Oct 16 '20 15:10 alfavata

Building the Macro example:

Zini18:Examples helge$ swift lambda build --verbose -p express-simple-lambda
Build setup:
  Checkout dir: /Users/helge/dev/Swift/Macro/Examples/.build/checkouts
Build status:
  Package resolved: no
    resolved:       
    package:        /Users/helge/dev/Swift/Macro/Examples/Package.swift
SDK: /usr/local/lib/swift/dst/x86_64-unknown-linux/swift-5.3-amazonlinux2.xtoolchain/x86_64-amazonlinux2.sdk
SPM: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift build --configuration release --destination /usr/local/lib/swift/dst/x86_64-unknown-linux/swift-5.3-amazonlinux2.xtoolchain/destination.json -Xswiftc -target -Xswiftc x86_64-unknown-linux -Xcc -target -Xcc x86_64-unknown-linux -Xcc -Wno-unused-command-line-argument --product express-simple-lambda
Preparing build directory: /Users/helge/dev/Swift/Macro/Examples/.build/lambda
  Embedding: libswiftCore.so
    Not embedding: libpthread.so.0
    Not embedding: libdl.so.2
    Embedding: libicui18nswift.so.65
    Embedding: libicuucswift.so.65
    Embedding: libicudataswift.so.65 // <=======
    Not embedding: libstdc++.so.6
...
  Not embedding: libgcc_s.so.1
  Not embedding: libc.so.6
  Embedding Sources resource dir: 'views'
  Embedding Sources resource dir: 'public'
Zipping .... done, size: 23M (unpacked 90M)

It looks OK, it seems packaged properly:

Zini18:Examples helge$ file .build/lambda/libicudataswift.so.65
.build/lambda/libicudataswift.so.65: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, BuildID[sha1]=6a0ce1be26c56d3bdfe1950f3f00fa1ab3c80d65, not stripped

Could you run swift lambda --verbose and post the output?

helje5 avatar Oct 16 '20 16:10 helje5

Thanks for looking into this! I still haven't had time to retry, but here's the output you asked for:

$ swift lambda build --verbose -p hiya-apps-call-log-endpoint

Build setup:
  Checkout dir: /Users/alfavata/Code/ios-hiya/CallLogLambda/.build/checkouts
Build status:
  Package resolved: no
    resolved:       
    package:        /Users/alfavata/Code/ios-hiya/CallLogLambda/Package.swift
SDK: /usr/local/lib/swift/dst/x86_64-unknown-linux/swift-5.3-amazonlinux2.xtoolchain/x86_64-amazonlinux2.sdk
SPM: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift build --configuration release --destination /usr/local/lib/swift/dst/x86_64-unknown-linux/swift-5.3-amazonlinux2.xtoolchain/destination.json -Xswiftc -target -Xswiftc x86_64-unknown-linux -Xcc -target -Xcc x86_64-unknown-linux -Xcc -Wno-unused-command-line-argument --product hiya-apps-call-log-endpoint
[814/814] Linking hiya-apps-call-log-endpoint
Preparing build directory: /Users/alfavata/Code/ios-hiya/CallLogLambda/.build/lambda
  Embedding: libswiftCore.so
    Not embedding: libpthread.so.0
    Not embedding: libdl.so.2
    Embedding: libicui18nswift.so.65
    Embedding: libicuucswift.so.65
    Embedding: libicudataswift.so.65
    Not embedding: libstdc++.so.6
    Not embedding: libm.so.6
    Not embedding: libgcc_s.so.1
    Not embedding: libc.so.6
    Not embedding: ld-linux-x86-64.so.2
  Embedding: libFoundation.so
    Embedding: libswiftDispatch.so
    Already embedded: libicuucswift.so.65
    Already embedded: libicui18nswift.so.65
    Embedding: libdispatch.so
    Embedding: libBlocksRuntime.so
    Not embedding: libpthread.so.0
    Not embedding: libutil.so.1
    Not embedding: libdl.so.2
    Already embedded: libswiftCore.so
    Not embedding: libm.so.6
    Embedding: libswiftGlibc.so
    Not embedding: libgcc_s.so.1
    Not embedding: libc.so.6
  Already embedded: libswiftGlibc.so
  Not embedding: libpthread.so.0
  Not embedding: libutil.so.1
  Not embedding: libdl.so.2
  Not embedding: libm.so.6
  Already embedded: libswiftDispatch.so
  Already embedded: libdispatch.so
  Already embedded: libBlocksRuntime.so
  Embedding: libFoundationNetworking.so
    Already embedded: libFoundation.so
    Not embedding: libcurl.so.4
    Already embedded: libswiftDispatch.so
    Already embedded: libdispatch.so
    Already embedded: libBlocksRuntime.so
    Not embedding: libpthread.so.0
    Not embedding: libutil.so.1
    Not embedding: libdl.so.2
    Already embedded: libswiftCore.so
    Not embedding: libm.so.6
    Already embedded: libswiftGlibc.so
    Not embedding: libgcc_s.so.1
    Not embedding: libc.so.6
  Not embedding: libgcc_s.so.1
  Not embedding: libc.so.6
Zipping .... done, size: 28M (unpacked 111M)

alfavata avatar Oct 19 '20 18:10 alfavata

Just realised that I never tried deploying a lambda built with --configuration release - and the output of swift lambda build seems to be quite different with --configuration debug:

$ swift lambda build \
		--verbose \
		--configuration debug \
		--product hiya-apps-call-log-endpoint
Build setup:
  Checkout dir: /Users/alfavata/Code/ios-hiya/CallLogLambda/.build/checkouts
Build status:
  Package resolved: no
    resolved:       
    package:        /Users/alfavata/Code/ios-hiya/CallLogLambda/Package.swift
SDK: /usr/local/lib/swift/dst/x86_64-unknown-linux/swift-5.3-amazonlinux2.xtoolchain/x86_64-amazonlinux2.sdk
SPM: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift build --configuration debug --destination /usr/local/lib/swift/dst/x86_64-unknown-linux/swift-5.3-amazonlinux2.xtoolchain/destination.json -Xswiftc -target -Xswiftc x86_64-unknown-linux -Xcc -target -Xcc x86_64-unknown-linux -Xcc -Wno-unused-command-line-argument --product hiya-apps-call-log-endpoint
[14/14] Linking hiya-apps-call-log-endpoint
Preparing build directory: /Users/alfavata/Code/ios-hiya/CallLogLambda/.build/lambda
  Embedding: libswiftSwiftOnoneSupport.so
    Not embedding: libpthread.so.0
    Not embedding: libdl.so.2
    Embedding: libswiftCore.so
    Not embedding: libstdc++.so.6
    Not embedding: libm.so.6
    Not embedding: libgcc_s.so.1
    Not embedding: libc.so.6
  Already embedded: libswiftCore.so
  Embedding: libFoundation.so
    Embedding: libswiftDispatch.so
    Embedding: libicuucswift.so.65
    Embedding: libicui18nswift.so.65
    Embedding: libdispatch.so
    Embedding: libBlocksRuntime.so
    Not embedding: libpthread.so.0
    Not embedding: libutil.so.1
    Not embedding: libdl.so.2
    Already embedded: libswiftCore.so
    Not embedding: libm.so.6
    Embedding: libswiftGlibc.so
    Not embedding: libgcc_s.so.1
    Not embedding: libc.so.6
  Already embedded: libswiftGlibc.so
  Not embedding: libpthread.so.0
  Not embedding: libutil.so.1
  Not embedding: libdl.so.2
  Not embedding: libm.so.6
  Already embedded: libswiftDispatch.so
  Already embedded: libdispatch.so
  Already embedded: libBlocksRuntime.so
  Embedding: libFoundationNetworking.so
    Already embedded: libFoundation.so
    Not embedding: libcurl.so.4
    Already embedded: libswiftDispatch.so
    Already embedded: libdispatch.so
    Already embedded: libBlocksRuntime.so
    Not embedding: libpthread.so.0
    Not embedding: libutil.so.1
    Not embedding: libdl.so.2
    Already embedded: libswiftCore.so
    Not embedding: libm.so.6
    Already embedded: libswiftGlibc.so
    Not embedding: libgcc_s.so.1
    Not embedding: libc.so.6
  Not embedding: libgcc_s.so.1
  Not embedding: libc.so.6
Zipping .... done, size: 17M (unpacked 72M)

alfavata avatar Oct 21 '20 17:10 alfavata

I finally managed to deploy a build made using swift lambda build --configuration release and it's working properly, so the problem only seems to happen with --configuration debug.

alfavata avatar Oct 22 '20 10:10 alfavata