Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rust environment support #81

Open
sanketsudake opened this issue May 24, 2021 · 6 comments
Open

Rust environment support #81

sanketsudake opened this issue May 24, 2021 · 6 comments
Labels
feature-request Request for new features in help wanted

Comments

@sanketsudake
Copy link
Member

Is your feature request related to a problem? Please describe.
We would like to enabled Rust language as one of the fission environments.

Describe the solution you'd like
As a Fission user I should be able to run/deploy functions written using Rust language.

Describe alternatives you've considered

Additional context

@sanketsudake sanketsudake added help wanted feature-request Request for new features in labels Nov 25, 2021
@Algorab
Copy link

Algorab commented Dec 21, 2021

Help Wanted:
I try to set an environment for the rust-lang. Now I have some trouble with the build.sh from the builder. When it runs for the package creation it looks like that shell-script is faster than the cargo build command. And then directory of the env var DEPLOY_PKG isn't anymore available. Hopefully someone can help me or point me to the right direction.

See the output from the builder build.sh:

Name:        fission-rust-handler-7bf3c9dc-9c18-461f-a28f-1743b2a23f71
Environment: rust-env
Status:      failed
Build Logs:
Building rust cargo project in /packages/fission-rust-handler-7bf3c9dc-9c18-461f-a28f-1743b2a23f71-xvznrm
0. use deploy dir /packages/fission-rust-handler-7bf3c9dc-9c18-461f-a28f-1743b2a23f71-xvznrm-yznpts
1. go into /packages/fission-rust-handler-7bf3c9dc-9c18-461f-a28f-1743b2a23f71-xvznrm
2. now in /packages/fission-rust-handler-7bf3c9dc-9c18-461f-a28f-1743b2a23f71-xvznrm
3. try to get target_dir
4. found target_dir: /packages/fission-rust-handler-7bf3c9dc-9c18-461f-a28f-1743b2a23f71-xvznrm/target
5. try to get project_name
6. found project_name: fission_rust_handler
7. start cargo build
8. end cargo build
9. ls target_dir/release
total 4040
drwxr-xr-x   66 root     root          4096 Dec 21 13:25 build
drwxr-xr-x    2 root     root         36864 Dec 21 13:26 deps
drwxr-xr-x    2 root     root          4096 Dec 21 13:25 examples
drwxr-xr-x    2 root     root          4096 Dec 21 13:25 incremental
-rw-r--r--    1 root     root           204 Dec 21 13:26 libfission_rust_handler.d
-rwxr-xr-x    2 root     root       4075832 Dec 21 13:26 libfission_rust_handler.so
10. end ls target_dir
11. ls deploy pkg /packages/fission-rust-handler-7bf3c9dc-9c18-461f-a28f-1743b2a23f71-xvznrm-yznpts
12. end ls deploy pkg
13. rename by copy => /packages/fission-rust-handler-7bf3c9dc-9c18-461f-a28f-1743b2a23f71-xvznrm/target/release/libfission_rust_handler.so /packages/fission-rust-handler-7bf3c9dc-9c18-461f-a28f-1743b2a23f71-xvznrm/target/release/handler.so
14. copy /packages/fission-rust-handler-7bf3c9dc-9c18-461f-a28f-1743b2a23f71-xvznrm/target/release/libfission_rust_handler.so /packages/fission-rust-handler-7bf3c9dc-9c18-461f-a28f-1743b2a23f71-xvznrm-yznpts/
15. ls deploy pkg /packages/fission-rust-handler-7bf3c9dc-9c18-461f-a28f-1743b2a23f71-xvznrm-yznpts
16. end ls deploy pkg
    Updating crates.io index
 Downloading crates ...
  Downloaded autocfg v1.0.1
  Downloaded fuchsia-zircon v0.3.3
  Downloaded futures-util v0.3.17
  Downloaded actix-codec v0.3.0
  Downloaded derive_more v0.99.17
  Downloaded match_cfg v0.1.0
  Downloaded actix-threadpool v0.3.3
  Downloaded pin-utils v0.1.0
  Downloaded heck v0.3.3
  Downloaded opaque-debug v0.3.0
  Downloaded lazy_static v1.4.0
  Downloaded rand_chacha v0.2.2
  Downloaded rand v0.7.3
  Downloaded proc-macro-nested v0.1.7
  Downloaded parking_lot v0.11.2
  Downloaded brotli-sys v0.3.2
  Downloaded ppv-lite86 v0.2.15
  Downloaded pin-project-lite v0.2.7
  Downloaded pin-project-internal v1.0.8
  Downloaded parking_lot_core v0.8.5
  Downloaded brotli2 v0.3.2
  Downloaded proc-macro2 v1.0.34
  Downloaded bumpalo v3.8.0
  Downloaded h2 v0.2.7
  Downloaded miniz_oxide v0.4.4
  Downloaded bytes v0.5.6
  Downloaded byteorder v1.4.3
  Downloaded bytestring v1.0.0
  Downloaded cfg-if v1.0.0
  Downloaded cpufeatures v0.2.1
  Downloaded mio v0.6.23
  Downloaded digest v0.9.0
  Downloaded either v1.6.1
  Downloaded pin-project-internal v0.4.28
  Downloaded net2 v0.2.37
  Downloaded fnv v1.0.7
  Downloaded form_urlencoded v1.0.1
  Downloaded scopeguard v1.1.0
  Downloaded proc-macro-hack v0.5.19
  Downloaded redox_syscall v0.2.10
  Downloaded rand_hc v0.2.0
  Downloaded rustc_version v0.4.0
  Downloaded semver v0.9.0
  Downloaded rustc_version v0.2.3
  Downloaded bytes v1.1.0
  Downloaded semver-parser v0.7.0
  Downloaded quick-error v1.2.3
  Downloaded semver v1.0.4
  Downloaded quote v1.0.10
  Downloaded const_fn v0.4.8
  Downloaded serde_derive v1.0.132
  Downloaded cookie v0.14.4
  Downloaded discard v1.0.4
  Downloaded copyless v0.1.5
  Downloaded flate2 v1.0.22
  Downloaded regex v1.5.4
  Downloaded enum-as-inner v0.3.3
  Downloaded cfg-if v0.1.10
  Downloaded serde v1.0.132
  Downloaded crc32fast v1.3.0
  Downloaded futures-io v0.3.17
  Downloaded futures-macro v0.3.17
  Downloaded futures-sink v0.3.17
  Downloaded fuchsia-zircon-sys v0.3.3
  Downloaded convert_case v0.4.0
  Downloaded fxhash v0.2.1
  Downloaded getrandom v0.1.16
  Downloaded hostname v0.3.1
  Downloaded hermit-abi v0.1.19
  Downloaded instant v0.1.12
  Downloaded ryu v1.0.9
  Downloaded ipconfig v0.2.2
  Downloaded resolv-conf v0.7.0
  Downloaded tokio-util v0.3.1
  Downloaded hashbrown v0.11.2
  Downloaded httparse v1.5.1
  Downloaded serde_urlencoded v0.7.0
  Downloaded serde_json v1.0.73
  Downloaded sha-1 v0.9.8
  Downloaded indexmap v1.7.0
  Downloaded cc v1.0.72
  Downloaded tinyvec_macros v0.1.0
  Downloaded version_check v0.9.3
  Downloaded stdweb-internal-runtime v0.1.5
  Downloaded stdweb-derive v0.5.3
  Downloaded stdweb-internal-macros v0.2.9
  Downloaded wasi v0.9.0+wasi-snapshot-preview1
  Downloaded wasm-bindgen-backend v0.2.78
  Downloaded idna v0.2.3
  Downloaded wasm-bindgen v0.2.78
  Downloaded http v0.2.5
  Downloaded futures v0.3.17
  Downloaded futures-channel v0.3.17
  Downloaded iovec v0.1.4
  Downloaded winapi-build v0.1.1
  Downloaded generic-array v0.14.4
  Downloaded wasm-bindgen-macro v0.2.78
  Downloaded futures-core v0.3.17
  Downloaded widestring v0.4.3
  Downloaded wasm-bindgen-shared v0.2.78
  Downloaded itoa v0.4.8
  Downloaded futures-task v0.3.17
  Downloaded ws2_32-sys v0.2.1
  Downloaded winreg v0.6.2
  Downloaded async-trait v0.1.52
  Downloaded matches v0.1.9
  Downloaded smallvec v1.7.0
  Downloaded slab v0.4.5
  Downloaded signal-hook-registry v1.4.0
  Downloaded thiserror-impl v1.0.30
  Downloaded thiserror v1.0.30
  Downloaded tinyvec v1.5.1
  Downloaded unicode-xid v0.2.2
  Downloaded typenum v1.14.0
  Downloaded num_cpus v1.13.0
  Downloaded percent-encoding v2.1.0
  Downloaded kernel32-sys v0.2.2
  Downloaded language-tags v0.2.2
  Downloaded lock_api v0.4.5
  Downloaded lru-cache v0.1.2
  Downloaded mio-uds v0.6.8
  Downloaded miow v0.2.2
  Downloaded syn v1.0.82
  Downloaded pin-project v0.4.28
  Downloaded pin-project-lite v0.1.12
  Downloaded unicode-segmentation v1.8.0
  Downloaded rand_core v0.5.1
  Downloaded sha1 v0.6.0
  Downloaded mime v0.3.16
  Downloaded log v0.4.14
  Downloaded standback v0.2.17
  Downloaded memchr v2.4.1
  Downloaded pin-project v1.0.8
  Downloaded socket2 v0.3.19
  Downloaded itoa v1.0.1
  Downloaded linked-hash-map v0.5.4
  Downloaded block-buffer v0.9.0
  Downloaded time-macros v0.1.1
  Downloaded time-macros-impl v0.1.2
  Downloaded time v0.2.27
  Downloaded threadpool v1.8.1
  Downloaded actix-web v3.3.2
  Downloaded adler v1.0.2
  Downloaded actix-utils v2.0.0
  Downloaded tracing v0.1.29
  Downloaded bitflags v1.3.2
  Downloaded actix-web-codegen v0.4.0
  Downloaded tracing-core v0.1.21
  Downloaded base64 v0.13.0
  Downloaded tracing-futures v0.2.5
  Downloaded base-x v0.2.8
  Downloaded unicode-bidi v0.3.7
  Downloaded awc v2.0.3
  Downloaded unicode-normalization v0.1.19
  Downloaded aho-corasick v0.7.18
  Downloaded libc v0.2.112
  Downloaded tokio v0.2.25
  Downloaded trust-dns-proto v0.19.7
  Downloaded url v2.2.2
  Downloaded trust-dns-resolver v0.19.7
  Downloaded actix-macros v0.1.3
  Downloaded actix-rt v1.1.1
  Downloaded actix-http v2.2.1
  Downloaded actix-service v1.0.6
  Downloaded actix-server v1.0.4
  Downloaded wasm-bindgen-macro-support v0.2.78
  Downloaded actix-tls v2.0.0
  Downloaded actix-connect v2.0.0
  Downloaded actix-router v0.2.7
  Downloaded stdweb v0.4.20
  Downloaded actix-testing v1.0.1
  Downloaded regex-syntax v0.6.25
  Downloaded winapi v0.2.8
  Downloaded encoding_rs v0.8.30
  Downloaded winapi v0.3.9
  Downloaded winapi-x86_64-pc-windows-gnu v0.4.0
  Downloaded winapi-i686-pc-windows-gnu v0.4.0
   Compiling proc-macro2 v1.0.34
   Compiling unicode-xid v0.2.2
   Compiling syn v1.0.82
   Compiling libc v0.2.112
   Compiling cfg-if v1.0.0
   Compiling autocfg v1.0.1
   Compiling memchr v2.4.1
   Compiling log v0.4.14
   Compiling version_check v0.9.3
   Compiling proc-macro-hack v0.5.19
   Compiling futures-core v0.3.17
   Compiling slab v0.4.5
   Compiling futures-sink v0.3.17
   Compiling lazy_static v1.4.0
   Compiling cfg-if v0.1.10
   Compiling futures-channel v0.3.17
   Compiling futures-task v0.3.17
   Compiling proc-macro-nested v0.1.7
   Compiling pin-project-lite v0.2.7
   Compiling pin-project-lite v0.1.12
   Compiling pin-utils v0.1.0
   Compiling bytes v0.5.6
   Compiling futures-io v0.3.17
   Compiling smallvec v1.7.0
   Compiling parking_lot_core v0.8.5
   Compiling pin-project-internal v0.4.28
   Compiling scopeguard v1.1.0
   Compiling getrandom v0.1.16
   Compiling convert_case v0.4.0
   Compiling percent-encoding v2.1.0
   Compiling tinyvec_macros v0.1.0
   Compiling matches v0.1.9
   Compiling copyless v0.1.5
   Compiling typenum v1.14.0
   Compiling bitflags v1.3.2
   Compiling serde_derive v1.0.132
   Compiling serde v1.0.132
   Compiling ppv-lite86 v0.2.15
   Compiling async-trait v0.1.52
   Compiling unicode-bidi v0.3.7
   Compiling itoa v0.4.8
   Compiling bytes v1.1.0
   Compiling unicode-segmentation v1.8.0
   Compiling either v1.6.1
   Compiling const_fn v0.4.8
   Compiling cc v1.0.72
   Compiling match_cfg v0.1.0
   Compiling fnv v1.0.7
   Compiling crc32fast v1.3.0
   Compiling quick-error v1.2.3
   Compiling linked-hash-map v0.5.4
   Compiling serde_json v1.0.73
   Compiling regex-syntax v0.6.25
   Compiling encoding_rs v0.8.30
   Compiling ryu v1.0.9
   Compiling httparse v1.5.1
   Compiling adler v1.0.2
   Compiling hashbrown v0.11.2
   Compiling opaque-debug v0.3.0
   Compiling itoa v1.0.1
   Compiling cpufeatures v0.2.1
   Compiling byteorder v1.4.3
   Compiling mime v0.3.16
   Compiling language-tags v0.2.2
   Compiling base64 v0.13.0
   Compiling instant v0.1.12
   Compiling tracing-core v0.1.21
   Compiling tinyvec v1.5.1
   Compiling lock_api v0.4.5
   Compiling form_urlencoded v1.0.1
   Compiling standback v0.2.17
   Compiling generic-array v0.14.4
   Compiling time v0.2.27
   Compiling cookie v0.14.4
   Compiling futures-macro v0.3.17
   Compiling futures-util v0.3.17
   Compiling miniz_oxide v0.4.4
   Compiling indexmap v1.7.0
   Compiling lru-cache v0.1.2
   Compiling http v0.2.5
   Compiling bytestring v1.0.0
   Compiling heck v0.3.3
   Compiling fxhash v0.2.1
   Compiling tracing v0.1.29
   Compiling aho-corasick v0.7.18
   Compiling quote v1.0.10
   Compiling unicode-normalization v0.1.19
   Compiling iovec v0.1.4
   Compiling net2 v0.2.37
   Compiling signal-hook-registry v1.4.0
   Compiling num_cpus v1.13.0
   Compiling hostname v0.3.1
   Compiling socket2 v0.3.19
   Compiling brotli-sys v0.3.2
   Compiling flate2 v1.0.22
   Compiling threadpool v1.8.1
   Compiling resolv-conf v0.7.0
   Compiling rand_core v0.5.1
   Compiling mio v0.6.23
   Compiling parking_lot v0.11.2
   Compiling rand_chacha v0.2.2
   Compiling rand v0.7.3
   Compiling digest v0.9.0
   Compiling block-buffer v0.9.0
   Compiling idna v0.2.3
   Compiling regex v1.5.4
   Compiling mio-uds v0.6.8
   Compiling sha-1 v0.9.8
   Compiling tokio v0.2.25
   Compiling url v2.2.2
   Compiling tokio-util v0.3.1
   Compiling derive_more v0.99.17
   Compiling actix-macros v0.1.3
   Compiling thiserror-impl v1.0.30
   Compiling time-macros-impl v0.1.2
   Compiling enum-as-inner v0.3.3
   Compiling pin-project-internal v1.0.8
   Compiling actix-web-codegen v0.4.0
   Compiling time-macros v0.1.1
   Compiling pin-project v1.0.8
   Compiling tracing-futures v0.2.5
   Compiling thiserror v1.0.30
WARN rustc_metadata::locator no metadata found: incompatible metadata version found: '/packages/fission-rust-handler-7bf3c9dc-9c18-461f-a28f-1743b2a23f71-xvznrm/target/release/deps/libpin_project_internal-f374565dbb79d124.so'
   Compiling pin-project v0.4.28
   Compiling actix-codec v0.3.0
   Compiling actix-threadpool v0.3.3
   Compiling actix-rt v1.1.1
   Compiling actix-service v1.0.6
   Compiling futures v0.3.17
   Compiling h2 v0.2.7
   Compiling trust-dns-proto v0.19.7
   Compiling actix-utils v2.0.0
   Compiling actix-server v1.0.4
   Compiling actix-tls v2.0.0
   Compiling actix-testing v1.0.1
   Compiling trust-dns-resolver v0.19.7
   Compiling brotli2 v0.3.2
   Compiling actix-connect v2.0.0
   Compiling serde_urlencoded v0.7.0
   Compiling actix-router v0.2.7
   Compiling actix-http v2.2.1
   Compiling awc v2.0.3
   Compiling actix-web v3.3.2
   Compiling fission-rust-handler v0.1.0 (/packages/fission-rust-handler-7bf3c9dc-9c18-461f-a28f-1743b2a23f71-xvznrm)
warning: unused variable: `req`
 --> src/lib.rs:4:27
  |
4 | pub extern "C" fn handler(req: HttpRequest) -> HttpResponse {
  |                           ^^^ help: if this is intentional, prefix it with an underscore: `_req`
  |
  = note: `#[warn(unused_variables)]` on by default

warning: `extern` fn uses type `HttpRequest`, which is not FFI-safe
 --> src/lib.rs:4:32
  |
4 | pub extern "C" fn handler(req: HttpRequest) -> HttpResponse {
  |                                ^^^^^^^^^^^ not FFI-safe
  |
  = note: `#[warn(improper_ctypes_definitions)]` on by default
  = help: consider adding a `#[repr(C)]` or `#[repr(transparent)]` attribute to this struct
  = note: this struct has unspecified layout

warning: `extern` fn uses type `HttpResponse`, which is not FFI-safe
 --> src/lib.rs:4:48
  |
4 | pub extern "C" fn handler(req: HttpRequest) -> HttpResponse {
  |                                                ^^^^^^^^^^^^ not FFI-safe
  |
  = help: consider adding a `#[repr(C)]` or `#[repr(transparent)]` attribute to this struct
  = note: this struct has unspecified layout

warning: `fission-rust-handler` (lib) generated 3 warnings
    Finished release [optimized] target(s) in 52.36s
ls: /packages/fission-rust-handler-7bf3c9dc-9c18-461f-a28f-1743b2a23f71-xvznrm-yznpts: No such file or directory
cp: can't create '/packages/fission-rust-handler-7bf3c9dc-9c18-461f-a28f-1743b2a23f71-xvznrm-yznpts/handler.so': No such file or directory
ls: /packages/fission-rust-handler-7bf3c9dc-9c18-461f-a28f-1743b2a23f71-xvznrm-yznpts: No such file or directory
Error uploading deployment package: Internal error - error archiving zip file: failed to zip file: stat /packages/fission-rust-handler-7bf3c9dc-9c18-461f-a28f-1743b2a23f71-xvznrm-yznpts: no such file or directory

@sanketsudake
Copy link
Member Author

sanketsudake commented Dec 22, 2021

Hey, @Algorab would it be possible to share your source? Maybe I can give it try with local build.

@Algorab
Copy link

Algorab commented Dec 22, 2021

Hi @sanketsudake, you can find the current state of the project here fission rust

@Algorab
Copy link

Algorab commented Dec 30, 2021

After some more debugging I have found out that:
the source-dir " /packages/fission-rust-handler-7bf3c9dc-9c18-461f-a28f-1743b2a23f71-xvznrm" is available in the builder for the function. The deploy-dir "/packages/fission-rust-handler-7bf3c9dc-9c18-461f-a28f-1743b2a23f71-xvznrm-yznpts" doesn't exists. Should it be normally there, have I it to create?

@AdarshdeepCheema
Copy link

I am also hitting the same issue @sanketsudake
can u please check what is wrong here ?

@AdarshdeepCheema
Copy link

AdarshdeepCheema commented Apr 5, 2023

I have 3 files in the zip

package.json
package-lock.json
build.sh

I am running fission package create --spec --sourcearchive src-pkg.zip --env nodejs --name ap-pkg --buildcmd "./build.sh" --envNamespace fission --pkgNamespace=controlplane
This only happens when I use the --buildcmd "./build.sh"
Error uploading deployment package: Internal error - error archiving zip file: failed to zip file: stat /packages/ap-pkg-mxnp60-sjljw7: no such file or directory

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request Request for new features in help wanted
Projects
None yet
Development

No branches or pull requests

3 participants