Error: fatal error encountered while reading from module 'Doggie'

I'm trying put my library to the Google Cloud Platform, and here are the compiler crash log.

docker: vapor/swift:5.0
packages: vapor, Doggie, etc

: [62/70] Compiling Swift Module 'FluentSQL' (9 sources)
: [63/70] Compiling Swift Module 'GoogleCloud' (31 sources)
: [64/70] Compiling Swift Module 'Authentication' (17 sources)
: [65/70] Compiling Swift Module 'FluentPostgreSQL' (17 sources)
: [66/70] Compiling Swift Module 'svg_generator' (20 sources)
: [67/70] Linking ./.build/x86_64-unknown-linux/release/svg_generator
: [68/70] Compiling Swift Module 'App' (33 sources)
: /app/Sources/App/Controllers/ApiController.swift:122:23: warning: 'launchPath' is deprecated: renamed to 'executableURL'
:         svg_generator.launchPath = "svg_generator"
:                       ^
: /app/Sources/App/Controllers/ApiController.swift:122:23: note: use 'executableURL' instead
:         svg_generator.launchPath = "svg_generator"
:                       ^~~~~~~~~~
:                       executableURL
: /app/Sources/App/Controllers/ApiController.swift:161:23: warning: 'launch()' is deprecated: renamed to 'run'
:         svg_generator.launch()
:                       ^
: /app/Sources/App/Controllers/ApiController.swift:161:23: note: use 'run' instead
:         svg_generator.launch()
:                       ^~~~~~
:                       run
: <unknown>:0: error: fatal error encountered while reading from module 'Doggie'; please file a bug report with your project and the crash log
: 
: &lt;unknown&gt;:0: error: fatal error encountered while reading from module 'Doggie'; please file a bug report with your project and the crash log
:
: *** DESERIALIZATION FAILURE (please include this section in any bug report) ***
: multiple matching base values
: Cross-reference to module 'Foundation'
: ... Data
: ... withUnsafeBytes
: ... with type &lt;τ_0_0&gt; (Data) -&gt; ((UnsafeRawBufferPointer) throws -&gt; τ_0_0) throws -&gt; τ_0_0
:
: Stack dump:
: 0. Program arguments: /usr/bin/swift -frontend -c /app/Sources/App/Controllers/ApiController.swift /app/Sources/App/Controllers/HomeDirectoryController.swift /app/Sources/App/Controllers/RootDirectoryController.swift /app/Sources/App/Controllers/TransactionDirectoryController.swift /app/Sources/App/Controllers/TransactionsDirectoryController.swift /app/Sources/App/Controllers/UserController.swift /app/Sources/App/Controllers/UsersDirectoryController.swift /app/Sources/App/Controllers/WebsiteDirectoryController.swift /app/Sources/App/Crypto/PasswordHasher.swift /app/Sources/App/Middlewares/AuthenticationMiddleware.swift /app/Sources/App/Middlewares/BasicAuthenticationResponceMiddleware.swift /app/Sources/App/Middlewares/BruteforceProtection.swift /app/Sources/App/Middlewares/DisableCacheControlMiddleware.swift /app/Sources/App/Middlewares/HttpsRedirectionMiddleware.swift /app/Sources/App/Models/AuthBlacklist.swift /app/Sources/App/Models/AuthToken.swift /app/Sources/App/Models/Domains.swift /app/Sources/App/Models/Roles.swift /app/Sources/App/Models/User.swift /app/Sources/App/Models/UserInfo.swift /app/Sources/App/Models/UserRole.swift /app/Sources/App/Models/VerificationCode.swift /app/Sources/App/Services/CloudStorageManager.swift /app/Sources/App/Services/SMTPService.swift /app/Sources/App/Utilities/Query.swift /app/Sources/App/Utilities/Random.swift /app/Sources/App/Utilities/Renderer.swift /app/Sources/App/Utilities/exports.swift /app/Sources/App/WebDAV/WebDAV.swift /app/Sources/App/app.swift /app/Sources/App/boot.swift /app/Sources/App/configure.swift /app/Sources/App/routes.swift -supplementary-output-file-map /tmp/supplementaryOutputs-d12f00 -target x86_64-unknown-linux -disable-objc-interop -sdk / -I /app/.build/x86_64-unknown-linux/release -I /app/.build/checkouts/swift-nio/Sources/CNIOZlib/include -I /app/.build/checkouts/swift-nio/Sources/CNIOHTTPParser/include -I /app/.build/checkouts/swift-nio-ssl/Sources/CNIOOpenSSL/include -I /app/.build/checkouts/crypto/Sources/CCryptoOpenSSL/include -I /app/.build/checkouts/crypto/Sources/CBcrypt/include -I /app/.build/checkouts/crypto/Sources/CBase32/include -I /app/.build/checkouts/swift-nio/Sources/CNIOSHA1/include -I /app/.build/checkouts/swift-nio/Sources/CNIOAtomics/include -I /app/.build/checkouts/swift-nio/Sources/CNIODarwin/include -I /app/.build/checkouts/swift-nio/Sources/CNIOLinux/include -I /app/.build/checkouts/Doggie/Sources/doggie_c/include -I /app/Sources/emjc_decoder_c/include -module-cache-path /app/.build/x86_64-unknown-linux/release/ModuleCache -swift-version 5 -O -D SWIFT_PACKAGE -Xcc -fmodule-map-file=/app/.build/checkouts/OpenSSL/Sources/OpenSSL/module.modulemap -Xcc -fmodule-map-file=/app/.build/x86_64-unknown-linux/release/CNIOZlib.build/module.modulemap -Xcc -fmodule-map-file=/app/.build/x86_64-unknown-linux/release/CNIOHTTPParser.build/module.modulemap -Xcc -fmodule-map-file=/app/.build/x86_64-unknown-linux/release/CNIOOpenSSL.build/module.modulemap -Xcc -fmodule-map-file=/app/.build/x86_64-unknown-linux/release/CCryptoOpenSSL.build/module.modulemap -Xcc -fmodule-map-file=/app/.build/checkouts/crypto/Sources/CBcrypt/include/module.modulemap -Xcc -fmodule-map-file=/app/.build/checkouts/crypto/Sources/CBase32/include/module.modulemap -Xcc -fmodule-map-file=/app/.build/checkouts/swift-nio-ssl-support/module.modulemap -Xcc -fmodule-map-file=/app/.build/x86_64-unknown-linux/release/CNIOSHA1.build/module.modulemap -Xcc -fmodule-map-file=/app/.build/x86_64-unknown-linux/release/CNIOAtomics.build/module.modulemap -Xcc -fmodule-map-file=/app/.build/x86_64-unknown-linux/release/CNIODarwin.build/module.modulemap -Xcc -fmodule-map-file=/app/.build/x86_64-unknown-linux/release/CNIOLinux.build/module.modulemap -Xcc -fmodule-map-file=/app/.build/checkouts/swift-nio-zlib-support/module.modulemap -Xcc -fmodule-map-file=/app/.build/checkouts/Doggie/Sources/doggie_c/include/module.modulemap -Xcc -fmodule-map-file=/app/Sources/emjc_decoder_c/include/module.modulemap -parse-as-library -module-name App -num-threads 4 -o /app/.build/x86_64-unknown-linux/release/App.build/Controllers/ApiController.swift.o -o /app/.build/x86_64-unknown-linux/release/App.build/Controllers/HomeDirectoryController.swift.o -o /app/.build/x86_64-unknown-linux/release/App.build/Controllers/RootDirectoryController.swift.o -o /app/.build/x86_64-unknown-linux/release/App.build/Controllers/TransactionDirectoryController.swift.o -o /app/.build/x86_64-unknown-linux/release/App.build/Controllers/TransactionsDirectoryController.swift.o -o /app/.build/x86_64-unknown-linux/release/App.build/Controllers/UserController.swift.o -o /app/.build/x86_64-unknown-linux/release/App.build/Controllers/UsersDirectoryController.swift.o -o /app/.build/x86_64-unknown-linux/release/App.build/Controllers/WebsiteDirectoryController.swift.o -o /app/.build/x86_64-unknown-linux/release/App.build/Crypto/PasswordHasher.swift.o -o /app/.build/x86_64-unknown-linux/release/App.build/Middlewares/AuthenticationMiddleware.swift.o -o /app/.build/x86_64-unknown-linux/release/App.build/Middlewares/BasicAuthenticationResponceMiddleware.swift.o -o /app/.build/x86_64-unknown-linux/release/App.build/Middlewares/BruteforceProtection.swift.o -o /app/.build/x86_64-unknown-linux/release/App.build/Middlewares/DisableCacheControlMiddleware.swift.o -o /app/.build/x86_64-unknown-linux/release/App.build/Middlewares/HttpsRedirectionMiddleware.swift.o -o /app/.build/x86_64-unknown-linux/release/App.build/Models/AuthBlacklist.swift.o -o /app/.build/x86_64-unknown-linux/release/App.build/Models/AuthToken.swift.o -o /app/.build/x86_64-unknown-linux/release/App.build/Models/Domains.swift.o -o /app/.build/x86_64-unknown-linux/release/App.build/Models/Roles.swift.o -o /app/.build/x86_64-unknown-linux/release/App.build/Models/User.swift.o -o /app/.build/x86_64-unknown-linux/release/App.build/Models/UserInfo.swift.o -o /app/.build/x86_64-unknown-linux/release/App.build/Models/UserRole.swift.o -o /app/.build/x86_64-unknown-linux/release/App.build/Models/VerificationCode.swift.o -o /app/.build/x86_64-unknown-linux/release/App.build/Services/CloudStorageManager.swift.o -o /app/.build/x86_64-unknown-linux/release/App.build/Services/SMTPService.swift.o -o /app/.build/x86_64-unknown-linux/release/App.build/Utilities/Query.swift.o -o /app/.build/x86_64-unknown-linux/release/App.build/Utilities/Random.swift.o -o /app/.build/x86_64-unknown-linux/release/App.build/Utilities/Renderer.swift.o -o /app/.build/x86_64-unknown-linux/release/App.build/Utilities/exports.swift.o -o /app/.build/x86_64-unknown-linux/release/App.build/WebDAV/WebDAV.swift.o -o /app/.build/x86_64-unknown-linux/release/App.build/app.swift.o -o /app/.build/x86_64-unknown-linux/release/App.build/boot.swift.o -o /app/.build/x86_64-unknown-linux/release/App.build/configure.swift.o -o /app/.build/x86_64-unknown-linux/release/App.build/routes.swift.o
: 1. While running pass #1 SILModuleTransform "PerformanceSILLinker".
: 2. While deserializing SIL function "$s10Foundation4DataV6DoggieE23withUnsafeBufferPointer2as_q_xm_q_SRyxGKXEtKr0_lF"
: /usr/bin/swift[0x42420c4]
: /usr/bin/swift[0x423fe4e]
: /usr/bin/swift[0x4242282]
: /lib/x86_64-linux-gnu/libpthread.so.0(+0x12890)[0x7fa45a8ce890]
: /lib/x86_64-linux-gnu/libc.so.6(gsignal+0xc7)[0x7fa458d31e97]
: /lib/x86_64-linux-gnu/libc.so.6(abort+0x141)[0x7fa458d33801]
: /usr/bin/swift[0x16148e0]
: /usr/bin/swift[0x1614c8e]
: /usr/bin/swift[0x161e796]
: /usr/bin/swift[0x161596b]
: /usr/bin/swift[0x1615feb]
: /usr/bin/swift[0x1616db6]
: /usr/bin/swift[0x1646f00]
: /usr/bin/swift[0x163cb19]
: /usr/bin/swift[0x164eeeb]
: /usr/bin/swift[0x15f172b]
: /usr/bin/swift[0x13103f4]
: /usr/bin/swift[0x137f321]
: /usr/bin/swift[0x137f743]
: /usr/bin/swift[0x137f52a]
: /usr/bin/swift[0x13104a3]
: /usr/bin/swift[0xfb679e]
: /usr/bin/swift[0xe9b88f]
: /usr/bin/swift[0xe9c251]
: /usr/bin/swift[0x5b5008]
: /usr/bin/swift[0xea3fba]
: /usr/bin/swift[0x4c19f1]
: /usr/bin/swift[0x4bd809]
: /usr/bin/swift[0x46e670]
: /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xe7)[0x7fa458d14b97]
: /usr/bin/swift[0x46ca8a]
: &lt;unknown&gt;:0: error: unable to execute command: Aborted
: &lt;unknown&gt;:0: error: compile command failed due to signal 6 (use -v to see invocation)

Here is the problem, my server should have two executables as result. First one is main server app and the second is svg_generator.
the lines show that the svg_generator build successful which's only rely on my library.

[66/70] Compiling Swift Module 'svg_generator' (20 sources)
[67/70] Linking ./.build/x86_64-unknown-linux/release/svg_generator

that means the Module App having a crash with my library and vapor.

I'm trying to solve this first.

That is a compiler crash and hence a Swift compiler bug. If you wouldn’t mind, filing a bug report on bugs.swift.org would be much appreciated.

I’m trying to reproduce the bug but it seems difficult.

Done!!

I create a package to reproduce the bug.
https://bugs.swift.org/browse/SR-10227

The bug should located in ./Sources/App/Crypto/PasswordHasher.swift

&lt;unknown&gt;:0: error: fatal error encountered while reading from module 'Doggie'; please file a bug report with your project and the crash log
*** DESERIALIZATION FAILURE (please include this section in any bug report) ***
multiple matching base values
Cross-reference to module 'Foundation'
... Data
... withUnsafeBytes
... with type &lt;τ_0_0&gt; (Data) -&gt; ((UnsafeRawBufferPointer) throws -&gt; τ_0_0) throws -&gt; τ_0_0
Stack dump:
0. Program arguments: /usr/bin/swift -frontend -c /app/Sources/App/Controllers/ApiController.swift /app/Sources/App/Crypto/PasswordHasher.swift /app/Sources/App/Utilities/exports.swift /app/Sources/App/app.swift /app/Sources/App/boot.swift /app/Sources/App/configure.swift /app/Sources/App/routes.swift -supplementary-output-file-map /tmp/supplementaryOutputs-8258d9 -target x86_64-unknown-linux -disable-objc-interop -sdk / -I /app/.build/x86_64-unknown-linux/release -I /app/.build/checkouts/swift-nio/Sources/CNIOZlib/include -I /app/.build/checkouts/swift-nio/Sources/CNIOHTTPParser/include -I /app/.build/checkouts/swift-nio-ssl/Sources/CNIOOpenSSL/include -I /app/.build/checkouts/crypto/Sources/CCryptoOpenSSL/include -I /app/.build/checkouts/crypto/Sources/CBcrypt/include -I /app/.build/checkouts/crypto/Sources/CBase32/include -I /app/.build/checkouts/swift-nio/Sources/CNIOSHA1/include -I /app/.build/checkouts/swift-nio/Sources/CNIOAtomics/include -I /app/.build/checkouts/swift-nio/Sources/CNIODarwin/include -I /app/.build/checkouts/swift-nio/Sources/CNIOLinux/include -module-cache-path /app/.build/x86_64-unknown-linux/release/ModuleCache -swift-version 5 -O -D SWIFT_PACKAGE -Xcc -fmodule-map-file=/app/.build/checkouts/OpenSSL/Sources/OpenSSL/module.modulemap -Xcc -fmodule-map-file=/app/.build/x86_64-unknown-linux/release/CNIOZlib.build/module.modulemap -Xcc -fmodule-map-file=/app/.build/x86_64-unknown-linux/release/CNIOHTTPParser.build/module.modulemap -Xcc -fmodule-map-file=/app/.build/x86_64-unknown-linux/release/CNIOOpenSSL.build/module.modulemap -Xcc -fmodule-map-file=/app/.build/x86_64-unknown-linux/release/CCryptoOpenSSL.build/module.modulemap -Xcc -fmodule-map-file=/app/.build/checkouts/crypto/Sources/CBcrypt/include/module.modulemap -Xcc -fmodule-map-file=/app/.build/checkouts/crypto/Sources/CBase32/include/module.modulemap -Xcc -fmodule-map-file=/app/.build/checkouts/swift-nio-ssl-support/module.modulemap -Xcc -fmodule-map-file=/app/.build/x86_64-unknown-linux/release/CNIOSHA1.build/module.modulemap -Xcc -fmodule-map-file=/app/.build/x86_64-unknown-linux/release/CNIOAtomics.build/module.modulemap -Xcc -fmodule-map-file=/app/.build/x86_64-unknown-linux/release/CNIODarwin.build/module.modulemap -Xcc -fmodule-map-file=/app/.build/x86_64-unknown-linux/release/CNIOLinux.build/module.modulemap -Xcc -fmodule-map-file=/app/.build/checkouts/swift-nio-zlib-support/module.modulemap -parse-as-library -module-name App -num-threads 4 -o /app/.build/x86_64-unknown-linux/release/App.build/Controllers/ApiController.swift.o -o /app/.build/x86_64-unknown-linux/release/App.build/Crypto/PasswordHasher.swift.o -o /app/.build/x86_64-unknown-linux/release/App.build/Utilities/exports.swift.o -o /app/.build/x86_64-unknown-linux/release/App.build/app.swift.o -o /app/.build/x86_64-unknown-linux/release/App.build/boot.swift.o -o /app/.build/x86_64-unknown-linux/release/App.build/configure.swift.o -o /app/.build/x86_64-unknown-linux/release/App.build/routes.swift.o
1. While running pass #1 SILModuleTransform "PerformanceSILLinker".
2. While deserializing SIL function "$s10Foundation4DataV6DoggieE23withUnsafeBufferPointer2as_q_xm_q_SRyxGKXEtKr0_lF"
/usr/bin/swift[0x42420c4]
/usr/bin/swift[0x423fe4e]
/usr/bin/swift[0x4242282]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x12890)[0x7f7d29b26890]
/lib/x86_64-linux-gnu/libc.so.6(gsignal+0xc7)[0x7f7d27f89e97]
/lib/x86_64-linux-gnu/libc.so.6(abort+0x141)[0x7f7d27f8b801]
/usr/bin/swift[0x16148e0]
/usr/bin/swift[0x1614c8e]
/usr/bin/swift[0x161e796]
/usr/bin/swift[0x161596b]
/usr/bin/swift[0x1615feb]
/usr/bin/swift[0x1616db6]
/usr/bin/swift[0x1646f00]
/usr/bin/swift[0x163cb19]
/usr/bin/swift[0x164eeeb]
/usr/bin/swift[0x15f172b]
/usr/bin/swift[0x13103f4]
/usr/bin/swift[0x137f321]
/usr/bin/swift[0x137f743]
/usr/bin/swift[0x137f52a]
/usr/bin/swift[0x13104a3]
/usr/bin/swift[0xfb679e]
/usr/bin/swift[0xe9b88f]
/usr/bin/swift[0xe9c251]
/usr/bin/swift[0x5b5008]
/usr/bin/swift[0xea3fba]
/usr/bin/swift[0x4c19f1]
/usr/bin/swift[0x4bd809]
/usr/bin/swift[0x46e670]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xe7)[0x7f7d27f6cb97]
/usr/bin/swift[0x46ca8a]
&lt;unknown&gt;:0: error: unable to execute command: Aborted
&lt;unknown&gt;:0: error: compile command failed due to signal 6 (use -v to see invocation)
The command '/bin/sh -c lsb_release -a &amp;&amp; swift -version &amp;&amp; swift build -c release &amp;&amp; mv `swift build -c release --show-bin-path` /build/bin' returned a non-zero code: 1

I got it!!!

I found same function in swift-nio 1.13.2 which crash the compiler

extension Data: ContiguousCollection {
    @_inlineable
    public func withUnsafeBytes<R>(_ body: (UnsafeRawBufferPointer) throws -> R) rethrows -> R {
        return try self.withUnsafeBytes { (ptr: UnsafePointer<UInt8>) -> R in
            try body(UnsafeRawBufferPointer(start: ptr, count: self.count))
        }
    }
}
Terms of Service

Privacy Policy

Cookie Policy