jemallocator icon indicating copy to clipboard operation
jemallocator copied to clipboard

Add `arm64e-apple-darwin` support

Open arttet opened this issue 1 year ago • 8 comments

Failed to build on arm64e-apple-darwin

Errors
 warning: [email protected]+5.3.0-patched: "Unprefixed `malloc` requested on unsupported platform `arm64e-apple-darwin` => using prefixed `malloc`"
  
  error: failed to run custom build command for `jemalloc-sys v0.5.4+5.3.0-patched`
  
  Caused by:
    process didn't exit successfully: `/Users/runner/work/rust-compiler-builder/rust-compiler-builder/rust/build/aarch64-apple-darwin/stage1-rustc/release/build/jemalloc-sys-0513b27edcf6bb21/build-script-build` (exit status: 101)
    --- stdout
    TARGET=arm64e-apple-darwin
    HOST=aarch64-apple-darwin
    NUM_JOBS=3
    OUT_DIR="/Users/runner/work/rust-compiler-builder/rust-compiler-builder/rust/build/aarch64-apple-darwin/stage1-rustc/arm64e-apple-darwin/release/build/jemalloc-sys-5fc1cef2b6f17384/out"
    BUILD_DIR="/Users/runner/work/rust-compiler-builder/rust-compiler-builder/rust/build/aarch64-apple-darwin/stage1-rustc/arm64e-apple-darwin/release/build/jemalloc-sys-5fc1cef2b6f17384/out/build"
    SRC_DIR="/Users/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/jemalloc-sys-0.5.4+5.3.0-patched"
    cargo:warning="Unprefixed `malloc` requested on unsupported platform `arm64e-apple-darwin` => using prefixed `malloc`"
    cargo:rustc-cfg=prefixed
    cargo:rerun-if-env-changed=JEMALLOC_OVERRIDE
    OPT_LEVEL = Some(3)
    TARGET = Some(arm64e-apple-darwin)
    OUT_DIR = Some(/Users/runner/work/rust-compiler-builder/rust-compiler-builder/rust/build/aarch64-apple-darwin/stage1-rustc/arm64e-apple-darwin/release/build/jemalloc-sys-5fc1cef2b6f17384/out)
    HOST = Some(aarch64-apple-darwin)
    cargo:rerun-if-env-changed=CC_arm64e-apple-darwin
    CC_arm64e-apple-darwin = None
    cargo:rerun-if-env-changed=CC_arm64e_apple_darwin
    CC_arm64e_apple_darwin = Some(sccache cc)
    cargo:rerun-if-env-changed=CC_KNOWN_WRAPPER_CUSTOM
    CC_KNOWN_WRAPPER_CUSTOM = 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:rerun-if-env-changed=MACOSX_DEPLOYMENT_TARGET
    MACOSX_DEPLOYMENT_TARGET = Some(11)
    cargo:rerun-if-env-changed=CFLAGS_arm64e-apple-darwin
    CFLAGS_arm64e-apple-darwin = None
    cargo:rerun-if-env-changed=CFLAGS_arm64e_apple_darwin
    CFLAGS_arm64e_apple_darwin = Some(-ffunction-sections -fdata-sections -fPIC --target=arm64e-apple-darwin -mmacosx-version-min=11)
    cargo:rerun-if-env-changed=CC_SHELL_ESCAPED_FLAGS
    CC_SHELL_ESCAPED_FLAGS = None
    CC="cc"
    CFLAGS="-O3 -ffunction-sections -fdata-sections -fPIC --target=arm64e-apple-darwin -mmacosx-version-min=11 -ffunction-sections -fdata-sections -fPIC --target=arm64e-apple-darwin -mmacosx-version-min=11"
    JEMALLOC_REPO_DIR="jemalloc"
    cargo:rerun-if-env-changed=JEMALLOC_SYS_WITH_MALLOC_CONF
    cargo:rerun-if-env-changed=JEMALLOC_SYS_WITH_LG_PAGE
    cargo:rerun-if-env-changed=JEMALLOC_SYS_WITH_LG_HUGEPAGE
    cargo:rerun-if-env-changed=JEMALLOC_SYS_WITH_LG_QUANTUM
    cargo:rerun-if-env-changed=JEMALLOC_SYS_WITH_LG_VADDR
    --with-jemalloc-prefix=_rjem_
    running: cd "/Users/runner/work/rust-compiler-builder/rust-compiler-builder/rust/build/aarch64-apple-darwin/stage1-rustc/arm64e-apple-darwin/release/build/jemalloc-sys-5fc1cef2b6f17384/out/build" && CC="cc" CFLAGS="-O3 -ffunction-sections -fdata-sections -fPIC --target=arm64e-apple-darwin -mmacosx-version-min=11 -ffunction-sections -fdata-sections -fPIC --target=arm64e-apple-darwin -mmacosx-version-min=11" CPPFLAGS="-O3 -ffunction-sections -fdata-sections -fPIC --target=arm64e-apple-darwin -mmacosx-version-min=11 -ffunction-sections -fdata-sections -fPIC --target=arm64e-apple-darwin -mmacosx-version-min=11" LDFLAGS="-O3 -ffunction-sections -fdata-sections -fPIC --target=arm64e-apple-darwin -mmacosx-version-min=11 -ffunction-sections -fdata-sections -fPIC --target=arm64e-apple-darwin -mmacosx-version-min=11" "sh" "/Users/runner/work/rust-compiler-builder/rust-compiler-builder/rust/build/aarch64-apple-darwin/stage1-rustc/arm64e-apple-darwin/release/build/jemalloc-sys-5fc1cef2b6f17384/out/build/configure" "--disable-cxx" "--enable-doc=no" "--enable-shared=no" "--with-jemalloc-prefix=_rjem_" "--with-private-namespace=_rjem_" "--host=arm64e-apple-darwin" "--build=aarch64-apple-darwin" "--prefix=/Users/runner/work/rust-compiler-builder/rust-compiler-builder/rust/build/aarch64-apple-darwin/stage1-rustc/arm64e-apple-darwin/release/build/jemalloc-sys-5fc1cef2b6f17384/out"
    checking for xsltproc... /usr/bin/xsltproc
    checking for arm64e-apple-darwin-gcc... cc
    checking whether the C compiler works... yes
    checking for C compiler default output file name... a.out
    checking for suffix of executables... 
    checking whether we are cross compiling... yes
    checking for suffix of object files... o
    checking whether we are using the GNU C compiler... yes
    checking whether cc accepts -g... yes
    checking for cc option to accept ISO C89... none needed
    checking whether compiler is cray... no
    checking whether compiler supports -std=gnu11... yes
    checking whether compiler supports -Werror=unknown-warning-option... yes
    checking whether compiler supports -Wall... yes
    checking whether compiler supports -Wextra... yes
    checking whether compiler supports -Wshorten-64-to-32... yes
    checking whether compiler supports -Wsign-compare... yes
    checking whether compiler supports -Wundef... yes
    checking whether compiler supports -Wno-format-zero-length... yes
    checking whether compiler supports -Wpointer-arith... yes
    checking whether compiler supports -Wno-missing-braces... yes
    checking whether compiler supports -Wno-missing-field-initializers... yes
    checking whether compiler supports -Wno-missing-attributes... no
    checking whether compiler supports -pipe... yes
    checking whether compiler supports -g3... yes
    checking how to run the C preprocessor... cc -E
    checking for grep that handles long lines and -e... /usr/bin/grep
    checking for egrep... /usr/bin/grep -E
    checking for ANSI C header files... yes
    checking for sys/types.h... yes
    checking for sys/stat.h... yes
    checking for stdlib.h... yes
    checking for string.h... yes
    checking for memory.h... yes
    checking for strings.h... yes
    checking for inttypes.h... yes
    checking for stdint.h... yes
    checking for unistd.h... yes
    checking whether byte ordering is bigendian... no
    checking size of void *... 8
    checking size of int... 4
    checking size of long... 8
    checking size of long long... 8
    checking size of intmax_t... 8
    checking build system type... aarch64-apple-darwin
    checking host system type... running: "tail" "-n" "100" "/Users/runner/work/rust-compiler-builder/rust-compiler-builder/rust/build/aarch64-apple-darwin/stage1-rustc/arm64e-apple-darwin/release/build/jemalloc-sys-5fc1cef2b6f17384/out/build/config.log"
    dvidir='${docdir}'
    enable_autogen=''
    enable_cache_oblivious=''
    enable_cxx='0'
    enable_debug=''
    enable_doc='no'
    enable_experimental_smallocx=''
    enable_fill=''
    enable_initial_exec_tls=''
    enable_lazy_lock=''
    enable_log=''
    enable_opt_safety_checks=''
    enable_opt_size_checks=''
    enable_prof=''
    enable_readlinkat=''
    enable_shared='no'
    enable_static=''
    enable_stats=''
    enable_tls=''
    enable_uaf_detection=''
    enable_utrace=''
    enable_xmalloc=''
    enable_zone_allocator=''
    exe=''
    exec_prefix='/Users/runner/work/rust-compiler-builder/rust-compiler-builder/rust/build/aarch64-apple-darwin/stage1-rustc/arm64e-apple-darwin/release/build/jemalloc-sys-5fc1cef2b6f17384/out'
    host='arm64e-apple-darwin'
    host_alias='arm64e-apple-darwin'
    host_cpu=''
    host_os=''
    host_vendor=''
    htmldir='${docdir}'
    importlib=''
    includedir='${prefix}/include'
    infodir='${datarootdir}/info'
    install_suffix=''
    je_=''
    jemalloc_version=''
    jemalloc_version_bugfix=''
    jemalloc_version_gid=''
    jemalloc_version_major=''
    jemalloc_version_minor=''
    jemalloc_version_nrev=''
    libdir='${exec_prefix}/lib'
    libdl=''
    libexecdir='${exec_prefix}/libexec'
    libprefix=''
    link_whole_archive=''
    localedir='${datarootdir}/locale'
    localstatedir='${prefix}/var'
    mandir='${datarootdir}/man'
    o=''
    objroot=''
    oldincludedir='/usr/include'
    pdfdir='${docdir}'
    prefix='/Users/runner/work/rust-compiler-builder/rust-compiler-builder/rust/build/aarch64-apple-darwin/stage1-rustc/arm64e-apple-darwin/release/build/jemalloc-sys-5fc1cef2b6f17384/out'
    private_namespace=''
    program_transform_name='s,x,x,'
    psdir='${docdir}'
    rev='2'
    sbindir='${exec_prefix}/sbin'
    sharedstatedir='${prefix}/com'
    so=''
    srcroot=''
    sysconfdir='${prefix}/etc'
    target_alias=''
  
    ## ----------- ##
    ## confdefs.h. ##
    ## ----------- ##
  
    /* confdefs.h */
    #define PACKAGE_NAME ""
    #define PACKAGE_TARNAME ""
    #define PACKAGE_VERSION ""
    #define PACKAGE_STRING ""
    #define PACKAGE_BUGREPORT ""
    #define PACKAGE_URL ""
    #define JEMALLOC_HAS_RESTRICT
    #define STDC_HEADERS 1
    #define HAVE_SYS_TYPES_H 1
    #define HAVE_SYS_STAT_H 1
    #define HAVE_STDLIB_H 1
    #define HAVE_STRING_H 1
    #define HAVE_MEMORY_H 1
    #define HAVE_STRINGS_H 1
    #define HAVE_INTTYPES_H 1
    #define HAVE_STDINT_H 1
    #define HAVE_UNISTD_H 1
    #define SIZEOF_VOID_P 8
    #define LG_SIZEOF_PTR 3
    #define SIZEOF_INT 4
    #define LG_SIZEOF_INT 2
    #define SIZEOF_LONG 8
    #define LG_SIZEOF_LONG 3
    #define SIZEOF_LONG_LONG 8
    #define LG_SIZEOF_LONG_LONG 3
    #define SIZEOF_INTMAX_T 8
    #define LG_SIZEOF_INTMAX_T 3
  
    configure: exit 1
  
    --- stderr
    Invalid configuration `arm64e-apple-darwin': machine `arm64e-apple' not recognized
    configure: error: /bin/sh build-aux/config.sub arm64e-apple-darwin failed
    thread 'main' panicked at /Users/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/jemalloc-sys-0.5.4+5.3.0-patched/build.rs:351:9:
    command did not execute successfully: cd "/Users/runner/work/rust-compiler-builder/rust-compiler-builder/rust/build/aarch64-apple-darwin/stage1-rustc/arm64e-apple-darwin/release/build/jemalloc-sys-5fc1cef2b6f17384/out/build" && CC="cc" CFLAGS="-O3 -ffunction-sections -fdata-sections -fPIC --target=arm64e-apple-darwin -mmacosx-version-min=11 -ffunction-sections -fdata-sections -fPIC --target=arm64e-apple-darwin -mmacosx-version-min=11" CPPFLAGS="-O3 -ffunction-sections -fdata-sections -fPIC --target=arm64e-apple-darwin -mmacosx-version-min=11 -ffunction-sections -fdata-sections -fPIC --target=arm64e-apple-darwin -mmacosx-version-min=11" LDFLAGS="-O3 -ffunction-sections -fdata-sections -fPIC --target=arm64e-apple-darwin -mmacosx-version-min=11 -ffunction-sections -fdata-sections -fPIC --target=arm64e-apple-darwin -mmacosx-version-min=11" "sh" "/Users/runner/work/rust-compiler-builder/rust-compiler-builder/rust/build/aarch64-apple-darwin/stage1-rustc/arm64e-apple-darwin/release/build/jemalloc-sys-5fc1cef2b6f17384/out/build/configure" "--disable-cxx" "--enable-doc=no" "--enable-shared=no" "--with-jemalloc-prefix=_rjem_" "--with-private-namespace=_rjem_" "--host=arm64e-apple-darwin" "--build=aarch64-apple-darwin" "--prefix=/Users/runner/work/rust-compiler-builder/rust-compiler-builder/rust/build/aarch64-apple-darwin/stage1-rustc/arm64e-apple-darwin/release/build/jemalloc-sys-5fc1cef2b6f17384/out"
    expected success, got: exit status: 1
    note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
  warning: build failed, waiting for other jobs to finish...

arttet avatar Oct 10 '24 17:10 arttet

It needs to be supported by https://github.com/jemalloc/jemalloc first.

BusyJay avatar Oct 11 '24 03:10 BusyJay

https://github.com/jemalloc/jemalloc is now Read Only and I guess it won't be accepting enhancements and new features anymore. What's jemallocator's plan do deal with it?

mikhasd avatar Jun 14 '25 13:06 mikhasd

This is unfortunate for us and we may have to wait for someone to fork and maintain it.

0x676e67 avatar Jun 14 '25 13:06 0x676e67

facebook fork https://github.com/facebook/jemalloc

0x676e67 avatar Jun 14 '25 13:06 0x676e67

@arttet Would you like to post this at https://github.com/facebook/jemalloc?

reneleonhardt avatar Jun 28 '25 16:06 reneleonhardt

@arttet Would you like to post this at https://github.com/facebook/jemalloc?

Hi @reneleonhardt

I've created a new issue for this. Please review it and share any feedback or additional context you think would be helpful.

arttet avatar Jul 02 '25 21:07 arttet

jemalloc-sys/jemalloc/build-aux/config.sub is very old (timestamp='2021-01-07'). When I add

diff --git a/build-aux/config.sub b/build-aux/config.sub
--- a/build-aux/config.sub	(revision 09ad115bc02db60cc9d9338cf0067074d3135fb4)
+++ b/build-aux/config.sub	(date 1751527404458)
@@ -1159,6 +1159,7 @@
 			1750a | 580 \
 			| a29k \
 			| aarch64 | aarch64_be \
+			| arm64e \
 			| abacus \
 			| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] \
 			| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] \

it builds of course, but I don't know if it works.

I guess we have to wait another 6 years until more components support arm64e 😅

reneleonhardt avatar Jul 03 '25 07:07 reneleonhardt

@arttet If you would switch to the latest facebook/jemalloc git (they don't want to publish a new release, last was 3 years ago), your issue has been implemented. https://github.com/facebook/jemalloc/issues/18

reneleonhardt avatar Sep 06 '25 07:09 reneleonhardt