Skip to content

AWS Lambda binary compatibility #6

Closed

Description

@ejoebstl

AWS lambdas run on the ami amzn-ami-hvm-2018.03.0.20181129-x86_64-gp2, except lambdas for the Node 10.x runtime, which use a different ami.

A binary compiled on the mentioned ami links against the following binaries:

# ldd migration-engine
linux-vdso.so.1 =>  (0x00007fffc01ba000)
libssl.so.10 => /lib64/libssl.so.10 (0x00007f0877ec4000)
libcrypto.so.10 => /lib64/libcrypto.so.10 (0x00007f0877a65000)
libdl.so.2 => /lib64/libdl.so.2 (0x00007f0877861000)
librt.so.1 => /lib64/librt.so.1 (0x00007f0877659000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f087743d000)
libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007f0877227000)
libc.so.6 => /lib64/libc.so.6 (0x00007f0876e5a000)
/lib64/ld-linux-x86-64.so.2 (0x00007f0878c37000)
libm.so.6 => /lib64/libm.so.6 (0x00007f0876b58000)
libgssapi_krb5.so.2 => /usr/lib64/libgssapi_krb5.so.2 (0x00007f087690b000)
libkrb5.so.3 => /usr/lib64/libkrb5.so.3 (0x00007f0876622000)
libcom_err.so.2 => /usr/lib64/libcom_err.so.2 (0x00007f087641f000)
libk5crypto.so.3 => /usr/lib64/libk5crypto.so.3 (0x00007f0876204000)
libz.so.1 => /lib64/libz.so.1 (0x00007f0875fee000)
libkrb5support.so.0 => /usr/lib64/libkrb5support.so.0 (0x00007f0875ddf000)
libkeyutils.so.1 => /lib64/libkeyutils.so.1 (0x00007f0875bdc000)
libresolv.so.2 => /lib64/libresolv.so.2 (0x00007f08759c3000)
libselinux.so.1 => /usr/lib64/libselinux.so.1 (0x00007f08757a2000)

The specific package versions are found here:

openssl-1.0.2k
glibc-2.17

The binary can be built as described in #5.

Activity

  1. added this to the milestone on Jun 26, 2019
  2. matthewmueller commented on Jun 27, 2019

    @matthewmueller
    Contributor

    Reposting from prisma/next repo:

    Steps to Reproduce:

    mkdir lambda && cd lambda
    curl -o migration-engine-glibc https://s3-eu-west-1.amazonaws.com/prisma-native/alpha/latest/linux-glibc/migration-engine
    curl -o migration-engine-musl https://s3-eu-west-1.amazonaws.com/prisma-native/alpha/latest/linux-musl/migration-engine
    curl -o prisma-glibc https://s3-eu-west-1.amazonaws.com/prisma-native/alpha/latest/linux-glibc/prisma
    curl -o prisma-musl https://s3-eu-west-1.amazonaws.com/prisma-native/alpha/latest/linux-musl/prisma
    # todo: also fix permission plz :-)
    chmod +x migration-engine-glibc migration-engine-musl prisma-glibc prisma-musl

    In lambda/, Create an index.js:

    const os = require('os')
    const { execSync } = require('child_process')
    
    exports.handler = function(event, ctx, fn) {
      console.log(execSync('./prisma-musl').toString())
      fn(null)
    }

    Now inside lambda/ run:

    docker run --rm -v "$PWD":/var/task lambci/lambda:nodejs8.10 index.handler
    

    You'll see:

    START RequestId: 86ae9067-25bd-1b5b-3b09-3f6d917b42c3 Version: $LATEST
    /bin/sh: ./prisma-musl: /lib/ld64.so.1: bad ELF interpreter: No such file or directory
    2019-06-16T09:55:35.784Z	86ae9067-25bd-1b5b-3b09-3f6d917b42c3	Error: Command failed: ./prisma-musl
    /bin/sh: ./prisma-musl: /lib/ld64.so.1: bad ELF interpreter: No such file or directory
    
        at checkExecSyncError (child_process.js:601:13)
        at execSync (child_process.js:641:13)
        at exports.handler (/var/task/index.js:5:15)
    

    You can then modify the index.js and see it with other binaries.

    If you run prisma-glibc, you'll see:

    START RequestId: 328fbca9-8987-1c19-497d-ba31e148cb8f Version: $LATEST
    ./prisma-glibc: error while loading shared libraries: libssl.so.1.1: cannot open shared object file: No such file or directory
    2019-06-16T11:16:44.258Z	328fbca9-8987-1c19-497d-ba31e148cb8f	Error: Command failed: ./prisma-glibc
    ./prisma-glibc: error while loading shared libraries: libssl.so.1.1: cannot open shared object file: No such file or directory
    
        at checkExecSyncError (child_process.js:601:13)
        at execSync (child_process.js:641:13)
        at exports.handler (/var/task/index.js:5:15)
    

    Though I'd imagine this would be expected.

  3. added
    kind/bug
    on Jul 2, 2019
  4. 1 remaining item

  5. timsuchanek commented on Jul 26, 2019

    @timsuchanek
    Contributor

    Fixed in latest alpha.

  6. added this to the Preview 3 milestone on Aug 9, 2019
  7. added 2 commits that reference this issue on Apr 14, 2020
    8bd6d85
    dac2592
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bug/2-confirmedkind/bug

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions