Description
I'm trying to figure out how to run these lambda functions locally on my mac mini, but each thing I try I get a different error! 🙃
This time I changed the serverless.yml
file by adding this block:
custom:
rust:
dockerless: true
# when using local builds (dockerless), optionally provide a different target and linker for the compiler
# for example, allow local running on ARM macs
target: aarch64-apple-darwin
linker: clang
The machine I am using is not an m1 mac- not sure if this is ARM or not...
Is it even possible for me to build this for linux on mac and then run it on mac?
I was thinking that maybe bypassing docker would be better because IMO it bloats the whole architecture/dev workflow and slows everything down...
Anyway, when I try to run it locally with this additions I get this error:
Running "serverless" from node_modules
Serverless: Deprecation Notice: bin/serverless is deprecated, use bin/serverless.js instead
More Info: https://www.serverless.com/framework/docs/deprecations/#BIN_SERVERLESS
Serverless: Building Rust hello func...
Serverless: Running local cargo build on darwin
Compiling proc-macro2 v1.0.36
Compiling unicode-xid v0.2.2
Compiling syn v1.0.86
Compiling libc v0.2.119
Compiling autocfg v1.1.0
Compiling cfg-if v1.0.0
Compiling serde_derive v1.0.136
Compiling serde v1.0.136
Compiling log v0.4.14
Compiling memchr v2.4.1
Compiling pin-project-lite v0.2.8
Compiling futures-core v0.3.21
Compiling futures-sink v0.3.21
Compiling slab v0.4.5
Compiling lazy_static v1.4.0
Compiling futures-channel v0.3.21
Compiling itoa v1.0.1
Compiling futures-task v0.3.21
Compiling fnv v1.0.7
Compiling futures-util v0.3.21
Compiling futures-io v0.3.21
Compiling pin-utils v0.1.0
Compiling pkg-config v0.3.24
Compiling cc v1.0.73
Compiling hashbrown v0.11.2
Compiling matches v0.1.9
Compiling httparse v1.6.0
Compiling crossbeam-utils v0.8.7
Compiling version_check v0.9.4
Compiling try-lock v0.2.3
Compiling crc32fast v1.3.2
Compiling tower-service v0.3.1
Compiling percent-encoding v2.1.0
Compiling openssl v0.10.38
Compiling serde_json v1.0.79
Compiling base64 v0.13.0
Compiling ryu v1.0.9
Compiling foreign-types-shared v0.1.1
Compiling httpdate v1.0.2
Compiling adler v1.0.2
Compiling bitflags v1.3.2
Compiling minimal-lexical v0.2.1
Compiling tinyvec_macros v0.1.0
Compiling once_cell v1.9.0
Compiling native-tls v0.2.8
Compiling ppv-lite86 v0.2.16
Compiling byteorder v1.4.3
Compiling openssl-probe v0.1.5
Compiling cfg-if v0.1.10
Compiling encoding_rs v0.8.30
Compiling unicode-bidi v0.3.7
Compiling tower-layer v0.3.1
Compiling ipnet v2.3.1
Compiling pin-project-lite v0.1.12
Compiling mime v0.3.16
Compiling bytes v0.5.6
Compiling tracing-core v0.1.22
Compiling indexmap v1.8.0
Compiling num-traits v0.2.14
Compiling miniz_oxide v0.4.4
Compiling num-integer v0.1.44
Compiling form_urlencoded v1.0.1
Compiling foreign-types v0.3.2
Compiling nom v7.1.0
Compiling tinyvec v1.5.1
Compiling openssl-sys v0.9.72
Compiling want v0.3.0
Compiling quote v1.0.15
Compiling num_cpus v1.13.1
error: failed to run custom build command for `openssl-sys v0.9.72`
Caused by:
process didn't exit successfully: `/Users/jim/Git-Projects/joke-fetcher-crab-lamb/target/release/build/openssl-sys-3e44e517a0f81f37/build-script-main` (exit status: 101)
--- stdout
cargo:rustc-cfg=const_fn
cargo:rerun-if-env-changed=X86_64_UNKNOWN_LINUX_MUSL_OPENSSL_LIB_DIR
X86_64_UNKNOWN_LINUX_MUSL_OPENSSL_LIB_DIR unset
cargo:rerun-if-env-changed=OPENSSL_LIB_DIR
OPENSSL_LIB_DIR unset
cargo:rerun-if-env-changed=X86_64_UNKNOWN_LINUX_MUSL_OPENSSL_INCLUDE_DIR
X86_64_UNKNOWN_LINUX_MUSL_OPENSSL_INCLUDE_DIR unset
cargo:rerun-if-env-changed=OPENSSL_INCLUDE_DIR
OPENSSL_INCLUDE_DIR unset
cargo:rerun-if-env-changed=X86_64_UNKNOWN_LINUX_MUSL_OPENSSL_DIR
X86_64_UNKNOWN_LINUX_MUSL_OPENSSL_DIR unset
cargo:rerun-if-env-changed=OPENSSL_DIR
OPENSSL_DIR unset
cargo:rerun-if-env-changed=OPENSSL_NO_PKG_CONFIG
cargo:rerun-if-env-changed=PKG_CONFIG_ALLOW_CROSS_x86_64-unknown-linux-musl
cargo:rerun-if-env-changed=PKG_CONFIG_ALLOW_CROSS_x86_64_unknown_linux_musl
cargo:rerun-if-env-changed=TARGET_PKG_CONFIG_ALLOW_CROSS
cargo:rerun-if-env-changed=PKG_CONFIG_ALLOW_CROSS
cargo:rerun-if-env-changed=PKG_CONFIG_x86_64-unknown-linux-musl
cargo:rerun-if-env-changed=PKG_CONFIG_x86_64_unknown_linux_musl
cargo:rerun-if-env-changed=TARGET_PKG_CONFIG
cargo:rerun-if-env-changed=PKG_CONFIG
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64-unknown-linux-musl
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64_unknown_linux_musl
cargo:rerun-if-env-changed=TARGET_PKG_CONFIG_SYSROOT_DIR
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR
run pkg_config fail: "pkg-config has not been configured to support cross-compilation.\n\nInstall a sysroot for the target platform and configure it via\nPKG_CONFIG_SYSROOT_DIR and PKG_CONFIG_PATH, or install a\ncross-compiling wrapper for pkg-config and set it via\nPKG_CONFIG environment variable."
--- stderr
thread 'main' panicked at '
Could not find directory of OpenSSL installation, and this `-sys` crate cannot
proceed without this knowledge. If OpenSSL is installed and this crate had
trouble finding it, you can set the `OPENSSL_DIR` environment variable for the
compilation process.
Make sure you also have the development packages of openssl installed.
For example, `libssl-dev` on Ubuntu or `openssl-devel` on Fedora.
If you're in a situation where you think the directory *should* be found
automatically, please open a bug at https://github.com/sfackler/rust-openssl
and include information about your system as well as this message.
$HOST = x86_64-apple-darwin
$TARGET = x86_64-unknown-linux-musl
openssl-sys = 0.9.72
', /Users/jim/.cargo/registry/src/github.com-1ecc6299db9ec823/openssl-sys-0.9.72/build/find_normal.rs:180:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...
error: build failed
Serverless: Rust build encountered an error: undefined 101.
Error --------------------------------------------------
Error:
at /Users/jim/Git-Projects/joke-fetcher-crab-lamb/node_modules/serverless-rust/index.js:289:15
at Array.forEach (<anonymous>)
at RustPlugin.build (/Users/jim/Git-Projects/joke-fetcher-crab-lamb/node_modules/serverless-rust/index.js:269:22)
at /Users/jim/Git-Projects/joke-fetcher-crab-lamb/node_modules/serverless/lib/classes/PluginManager.js:476:55
at tryCatcher (/Users/jim/Git-Projects/joke-fetcher-crab-lamb/node_modules/bluebird/js/release/util.js:16:23)
at Object.gotValue (/Users/jim/Git-Projects/joke-fetcher-crab-lamb/node_modules/bluebird/js/release/reduce.js:168:18)
at Object.gotAccum (/Users/jim/Git-Projects/joke-fetcher-crab-lamb/node_modules/bluebird/js/release/reduce.js:155:25)
at Object.tryCatcher (/Users/jim/Git-Projects/joke-fetcher-crab-lamb/node_modules/bluebird/js/release/util.js:16:23)
at Promise._settlePromiseFromHandler (/Users/jim/Git-Projects/joke-fetcher-crab-lamb/node_modules/bluebird/js/release/promise.js:547:31)
at Promise._settlePromise (/Users/jim/Git-Projects/joke-fetcher-crab-lamb/node_modules/bluebird/js/release/promise.js:604:18)
at Promise._settlePromise0 (/Users/jim/Git-Projects/joke-fetcher-crab-lamb/node_modules/bluebird/js/release/promise.js:649:10)
at Promise._settlePromises (/Users/jim/Git-Projects/joke-fetcher-crab-lamb/node_modules/bluebird/js/release/promise.js:729:18)
at _drainQueueStep (/Users/jim/Git-Projects/joke-fetcher-crab-lamb/node_modules/bluebird/js/release/async.js:93:12)
at _drainQueue (/Users/jim/Git-Projects/joke-fetcher-crab-lamb/node_modules/bluebird/js/release/async.js:86:9)
at Async._drainQueues (/Users/jim/Git-Projects/joke-fetcher-crab-lamb/node_modules/bluebird/js/release/async.js:102:5)
at Immediate.Async.drainQueues [as _onImmediate] (/Users/jim/Git-Projects/joke-fetcher-crab-lamb/node_modules/bluebird/js/release/async.js:15:14)
at processImmediate (node:internal/timers:464:21)
For debugging logs, run again after setting the "SLS_DEBUG=*" environment variable.
Get Support --------------------------------------------
Docs: docs.serverless.com
Bugs: github.com/serverless/serverless/issues
Issues: forum.serverless.com
Your Environment Information ---------------------------
Operating System: darwin
Node Version: 16.13.2
Framework Version: 1.74.1
Plugin Version: 3.6.15
SDK Version: 2.3.1
Components Version: 2.31.10
joke-fetcher-crab-lamb (main) 👽 brew install pkg-config
Warning: pkg-config 0.29.2_3 is already installed and up-to-date.
To reinstall 0.29.2_3, run:
brew reinstall pkg-config
Not sure what it wants me to do here... looks like I have pck-config already installed, but it's breaking on that.
I am trying to just run the function locally sls invoke local -f hello
on a mac without docker...