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

Update mimalloc to 0.1.42 #12919

Merged
merged 1 commit into from
May 21, 2024
Merged

Update mimalloc to 0.1.42 #12919

merged 1 commit into from
May 21, 2024

Conversation

devyn
Copy link
Contributor

@devyn devyn commented May 20, 2024

Description

This update fixes mimalloc for NetBSD

Tests + Formatting

Tests are passing just fine

@sholderbach sholderbach merged commit 1cdc39b into nushell:main May 21, 2024
14 checks passed
@hustcer hustcer added this to the v0.94.0 milestone May 22, 2024
@devyn
Copy link
Contributor Author

devyn commented May 22, 2024

@0323pin just a heads up - this will most likely work in 0.94, as it was fixed upstream 🙂

@0323pin
Copy link
Contributor

0323pin commented May 22, 2024

@devyn I've tried to build mimalloc-0.1.42 stand alone today and failed, I can post the error later/tomorrow but, I remember it fails to find static.c

@devyn
Copy link
Contributor Author

devyn commented May 22, 2024

@0323pin okay, do let me know. We are building with --no-default-features I think. Also note that the rust package versions don't reflect the actual mimalloc versions at all

I have been able to build Nushell so far on NetBSD without modifications with the current changes

@0323pin
Copy link
Contributor

0323pin commented May 23, 2024

@devyn All good, git-HEAD builds natively with default features on NetBSD current. Thank you!

Bear in mind, my system is on Rust-1.78.0 while, default Rust on NetBSD is currently stuck on 1.76.0 due to this.

2024-05-23-132109_1366x768_scrot

Although, I must say, this is weird ...

~> pin/Downloads: ls
.rw-r--r-- pin wheel 16 KB Thu May 23 13:14:04 2024  mimalloc_rust-0.1.42.tar.gz
~> pin/Downloads: tar -xf mimalloc_rust-0.1.42.tar.gz
~> pin/Downloads: cd mimalloc_rust-0.1.42
~> pin/Downloads/mimalloc_rust-0.1.42: cargo build --release
    Updating crates.io index
  Downloaded cc v1.0.98
  Downloaded libc v0.2.155
  Downloaded 2 crates (820.3 KB) in 0.59s
   Compiling libc v0.2.155
   Compiling cc v1.0.98
   Compiling libmimalloc-sys v0.1.38 (/home/pin/Downloads/mimalloc_rust-0.1.42/libmimalloc-sys)
The following warnings were emitted during compilation:

warning: [email protected]: cc: error: c_src/mimalloc/src/static.c: No such file or directory
warning: [email protected]: cc: fatal error: no input files
warning: [email protected]: compilation terminated.

error: failed to run custom build command for `libmimalloc-sys v0.1.38 (/home/pin/Downloads/mimalloc_rust-0.1.42/libmimalloc-sys)`

Caused by:
  process didn't exit successfully: `/home/pin/Downloads/mimalloc_rust-0.1.42/target/release/build/libmimalloc-sys-16279b23cc448111/build-script-build` (exit status: 1)
  --- stdout
  OPT_LEVEL = Some("3")
  TARGET = Some("x86_64-unknown-netbsd")
  HOST = Some("x86_64-unknown-netbsd")
  cargo:rerun-if-env-changed=CC_x86_64-unknown-netbsd
  CC_x86_64-unknown-netbsd = None
  cargo:rerun-if-env-changed=CC_x86_64_unknown_netbsd
  CC_x86_64_unknown_netbsd = None
  cargo:rerun-if-env-changed=HOST_CC
  HOST_CC = None
  cargo:rerun-if-env-changed=CC
  CC = None
  cargo:rerun-if-env-changed=CC_ENABLE_DEBUG_OUTPUT
  cargo:rerun-if-env-changed=CRATE_CC_NO_DEFAULTS
  CRATE_CC_NO_DEFAULTS = None
  DEBUG = Some("false")
  CARGO_CFG_TARGET_FEATURE = Some("fxsr,sse,sse2")
  cargo:rerun-if-env-changed=CFLAGS_x86_64-unknown-netbsd
  CFLAGS_x86_64-unknown-netbsd = None
  cargo:rerun-if-env-changed=CFLAGS_x86_64_unknown_netbsd
  CFLAGS_x86_64_unknown_netbsd = None
  cargo:rerun-if-env-changed=HOST_CFLAGS
  HOST_CFLAGS = None
  cargo:rerun-if-env-changed=CFLAGS
  CFLAGS = None
  cargo:rerun-if-env-changed=CC_ENABLE_DEBUG_OUTPUT
  cargo:rerun-if-env-changed=CRATE_CC_NO_DEFAULTS
  CRATE_CC_NO_DEFAULTS = None
  CARGO_CFG_TARGET_FEATURE = Some("fxsr,sse,sse2")
  cargo:rerun-if-env-changed=CFLAGS_x86_64-unknown-netbsd
  CFLAGS_x86_64-unknown-netbsd = None
  cargo:rerun-if-env-changed=CFLAGS_x86_64_unknown_netbsd
  CFLAGS_x86_64_unknown_netbsd = None
  cargo:rerun-if-env-changed=HOST_CFLAGS
  HOST_CFLAGS = None
  cargo:rerun-if-env-changed=CFLAGS
  CFLAGS = None
  cargo:warning=cc: error: c_src/mimalloc/src/static.c: No such file or directory
  cargo:warning=cc: fatal error: no input files
  cargo:warning=compilation terminated.

  --- stderr


  error occurred: Command "cc" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-m64" "-I" "c_src/mimalloc/include" "-I" "c_src/mimalloc/src" "-Wall" "-Wextra" "-ftls-model=initial-exec" "-DMI_DEBUG=0" "-o" "/home/pin/Downloads/mimalloc_rust-0.1.42/target/release/build/libmimalloc-sys-8f501235df9081f0/out/98cfcaec7182b1d8-static.o" "-c" "c_src/mimalloc/src/static.c" with args cc did not execute successfully (status code exit status: 1).

@devyn
Copy link
Contributor Author

devyn commented May 23, 2024

@0323pin glad to hear it! So that's why NetBSD is on 1.76. I just used rustup which seemed to work fine. That's a weird issue, I hope it gets resolved somehow soon...

As for rust-mimalloc, that kind of looks to me like it might be missing the git submodule that contains the actual mimalloc source code. If you grab it from a git clone and then git submodule init --update, does that still happen?

@devyn devyn deleted the update-mimalloc branch May 23, 2024 22:33
@0323pin
Copy link
Contributor

0323pin commented May 24, 2024

As for rust-mimalloc, that kind of looks to me like it might be missing the git submodule that contains the actual mimalloc source code.

🤦‍♂️ Didn't even think about this. I hate git submodules.

@0323pin
Copy link
Contributor

0323pin commented May 24, 2024

@devyn The important thing is that it's working inside nushell build. As for using git-submodules ...

~> git clone https://github.com/purpleprotocol/mimalloc_rust
~> git submodule init
Submodule 'libmimalloc-sys/c_src/mimalloc' (https://github.com/microsoft/mimalloc) registered for path 'libmimalloc-sys/c_src/mimalloc'
~> cargo build --release
[...]
error occurred: Command "cc" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-m64" "-I" "c_src/mimalloc/include" "-I" "c_src/mimalloc/src" "-Wall" "-Wextra" "-ftls-model=initial-exec" "-DMI_DEBUG=0" "-o" "/home/pin/Downloads/mimalloc_rust/target/release/build/libmimalloc-sys-8f501235df9081f0/out/98cfcaec7182b1d8-static.o" "-c" "c_src/mimalloc/src/static.c" with args cc did not execute successfully (status code exit status: 1).
~> set-env CC "clang"
~> cargo build --release
[...]
error occurred: Command "clang" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-m64" "--target=x86_64-unknown-netbsd" "-I" "c_src/mimalloc/include" "-I" "c_src/mimalloc/src" "-Wall" "-Wextra" "-ftls-model=initial-exec" "-DMI_DEBUG=0" "-o" "/home/pin/Downloads/mimalloc_rust/target/release/build/libmimalloc-sys-8f501235df9081f0/out/98cfcaec7182b1d8-static.o" "-c" "c_src/mimalloc/src/static.c" with args clang did not execute successfully (status code exit status: 1).
~> git submodule update
Cloning into '/home/pin/Downloads/mimalloc_rust/libmimalloc-sys/c_src/mimalloc'...
Submodule path 'libmimalloc-sys/c_src/mimalloc': checked out '6141843614220c4d85f55774c131a68ba778e413'
~> cargo build --release
   Compiling libc v0.2.155
   Compiling cc v1.0.98
   Compiling libmimalloc-sys v0.1.38 (/home/pin/Downloads/mimalloc_rust/libmimalloc-sys)
warning: [email protected]: In file included from c_src/mimalloc/src/static.c:38:
warning: [email protected]: In file included from c_src/mimalloc/src/prim/prim.c:25:
warning: [email protected]: c_src/mimalloc/src/prim/unix/prim.c:75:12: warning: unused function 'mi_prim_open' [-Wunused-function]
warning: [email protected]:    75 | static int mi_prim_open(const char* fpath, int open_flags) {
warning: [email protected]:       |            ^~~~~~~~~~~~
warning: [email protected]: c_src/mimalloc/src/prim/unix/prim.c:78:16: warning: unused function 'mi_prim_read' [-Wunused-function]
warning: [email protected]:    78 | static ssize_t mi_prim_read(int fd, void* buf, size_t bufsize) {
warning: [email protected]:       |                ^~~~~~~~~~~~
warning: [email protected]: c_src/mimalloc/src/prim/unix/prim.c:81:12: warning: unused function 'mi_prim_close' [-Wunused-function]
warning: [email protected]:    81 | static int mi_prim_close(int fd) {
warning: [email protected]:       |            ^~~~~~~~~~~~~
warning: [email protected]: c_src/mimalloc/src/prim/unix/prim.c:84:12: warning: unused function 'mi_prim_access' [-Wunused-function]
warning: [email protected]:    84 | static int mi_prim_access(const char *fpath, int mode) {
warning: [email protected]:       |            ^~~~~~~~~~~~~~
warning: [email protected]: 4 warnings generated.
   Compiling mimalloc v0.1.42 (/home/pin/Downloads/mimalloc_rust)
    Finished `release` profile [optimized] target(s) in 20.89s

Switching back to gcc instead of clang also works,

~> cargo build --release
   Compiling cc v1.0.98
   Compiling libc v0.2.155
   Compiling libmimalloc-sys v0.1.38 (/home/pin/Downloads/mimalloc_rust/libmimalloc-sys)
warning: [email protected]: In file included from c_src/mimalloc/src/prim/prim.c:25,
warning: [email protected]:                  from c_src/mimalloc/src/static.c:38:
warning: [email protected]: c_src/mimalloc/src/prim/unix/prim.c:84:12: warning: ‘mi_prim_access’ defined but not used [-Wunused-function]
warning: [email protected]:    84 | static int mi_prim_access(const char *fpath, int mode) {
warning: [email protected]:       |            ^~~~~~~~~~~~~~
warning: [email protected]: c_src/mimalloc/src/prim/unix/prim.c:81:12: warning: ‘mi_prim_close’ defined but not used [-Wunused-function]
warning: [email protected]:    81 | static int mi_prim_close(int fd) {
warning: [email protected]:       |            ^~~~~~~~~~~~~
warning: [email protected]: c_src/mimalloc/src/prim/unix/prim.c:78:16: warning: ‘mi_prim_read’ defined but not used [-Wunused-function]
warning: [email protected]:    78 | static ssize_t mi_prim_read(int fd, void* buf, size_t bufsize) {
warning: [email protected]:       |                ^~~~~~~~~~~~
warning: [email protected]: c_src/mimalloc/src/prim/unix/prim.c:75:12: warning: ‘mi_prim_open’ defined but not used [-Wunused-function]
warning: [email protected]:    75 | static int mi_prim_open(const char* fpath, int open_flags) {
warning: [email protected]:       |            ^~~~~~~~~~~~
   Compiling mimalloc v0.1.42 (/home/pin/Downloads/mimalloc_rust)
    Finished `release` profile [optimized] target(s) in 19.83s

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants