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 jemalloc to 5.0.1 #34

Merged
merged 2 commits into from
Nov 25, 2017
Merged

Update jemalloc to 5.0.1 #34

merged 2 commits into from
Nov 25, 2017

Conversation

gnzlbg
Copy link
Owner

@gnzlbg gnzlbg commented Nov 23, 2017

Updates jemalloc to rust-lang/jemalloc branch: rust-2017-10-09

@alexcrichton
Copy link
Collaborator

Looks like CI is red? Can this also avoid a version bump? There seem to be a ton of changes in flight...

@gnzlbg
Copy link
Owner Author

gnzlbg commented Nov 24, 2017

@alexcrichton I did the version bump because that's what the last commit that updated the allocator did. I'll revert that.

@alexcrichton alexcrichton merged commit cac5f88 into gnzlbg:master Nov 25, 2017
@SimonSapin
Copy link
Contributor

Did this update bring anything useful? Landing it in rust-lang/rust was abandoned rust-lang/rust#45163 (comment), and now using a new version of this crate in Servo fails to land for possibly the same reason: servo/servo#20640 (comment).

@gnzlbg
Copy link
Owner Author

gnzlbg commented Apr 15, 2018

@SimonSapin it uses madvise + MADV_FREE which is a pretty big boon on linux.

Are those bugs reported in jemalloc upstream? Also, what's Android's system allocator?

@SimonSapin
Copy link
Contributor

I don’t know if they’re really upstream bugs. Servo (and I think Rust as well?) uses a fairly old Android toolchain, presumably for compat with old Android versions. I haven’t found out for sure, but it’s possible that the cpu_set_t type only exists in more recent versions and that upstream now just require that.

The system allocator is not really relevant here. Even if it happens to be jemalloc, it’s probably a different version built with a different build system.

@gnzlbg
Copy link
Owner Author

gnzlbg commented Apr 15, 2018

@SimonSapin I've reported that upstream: jemalloc/jemalloc#1175

We'll see what happens. Jemalloc 5.1 will be released soon, so maybe a fix can land on upstream jemalloc for it.

I am fine with reverting the jemalloc version here, but if @alexcrichton agrees I'd like to add here the same android build bots that we are using in libc/stdsimd to prevent this from happening again. Upgrading jemallocator shouldn't lead to failures 6 months later in neither Rust nor servo..

SimonSapin referenced this pull request in servo/servo Apr 16, 2018
CC https://github.com/alexcrichton/jemallocator/pull/40,
rust-lang/rust#49669

The new version of jemallocator requires a more recent jemalloc
https://github.com/alexcrichton/jemallocator/pull/34
which doesn’t build on our current Android toolchain
jemalloc/jemalloc#1175.

To avoid blocking on figuring that out, duplicate ~70 lines
from jemallocator and use the older jemalloc-sys directly.
bors-servo referenced this pull request in servo/servo Apr 16, 2018
Fork the jemallocator crate, fix for nightly-2018-04-15

CC https://github.com/alexcrichton/jemallocator/pull/40, rust-lang/rust#49669

The new version of jemallocator requires a more recent jemalloc https://github.com/alexcrichton/jemallocator/pull/34 which doesn’t build on our current Android toolchain jemalloc/jemalloc#1175.

To avoid blocking on figuring that out, duplicate ~70 lines from jemallocator and use the older jemalloc-sys directly.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/20641)
<!-- Reviewable:end -->
@alexcrichton
Copy link
Collaborator

I'd be tempted to either patch this locally and/or work around it somehow personally rather than be beholden to ancient versions due to variuos platforms

@SimonSapin
Copy link
Contributor

Steps to reproduce (in this crate, I’ve not managed to get the same build error with jemalloc directly):

In a temporary directory:

wget https://dl.google.com/android/repository/android-ndk-r12b-linux-x86_64.zip
unzip -q android-ndk-r12b-linux-x86_64.zip
android-ndk-r12b/build/tools/make_standalone_toolchain.py --arch arm --api 19 --install-dir toolchain

In jemallocator:

rustup target add armv7-linux-androideabi
PATH="../path/to/toolchain/bin:$PATH" cargo build --target armv7-linux-androideabi

Full output below. Changing --api 19 to --api 21 is enough for jemallocator to build successfully. (API 20 doesn’t seem to exist.) Changing ndk-r12b to ndk-r15c is also enough.

Full output:

% PATH="$HOME/tmp/2018-04-android/toolchain/bin:$PATH" cargo build --target armv7-linux-androideabi
   Compiling jemalloc-sys v0.1.5 (file:///home/simon/projects/jemallocator/jemalloc-sys)
error: failed to run custom build command for `jemalloc-sys v0.1.5 (file:///home/simon/projects/jemallocator/jemalloc-sys)`
process didn't exit successfully: `/home/simon/projects/jemallocator/target/debug/build/jemalloc-sys-3ffb1cce916cdef3/build-script-build` (exit code: 101)
--- stdout
OPT_LEVEL = Some("0")
TARGET = Some("armv7-linux-androideabi")
HOST = Some("x86_64-unknown-linux-gnu")
TARGET = Some("armv7-linux-androideabi")
TARGET = Some("armv7-linux-androideabi")
HOST = Some("x86_64-unknown-linux-gnu")
CC_armv7-linux-androideabi = None
CC_armv7_linux_androideabi = None
TARGET_CC = None
CC = None
TARGET = Some("armv7-linux-androideabi")
HOST = Some("x86_64-unknown-linux-gnu")
CFLAGS_armv7-linux-androideabi = None
CFLAGS_armv7_linux_androideabi = None
TARGET_CFLAGS = None
CFLAGS = None
DEBUG = Some("true")
running: "sh" "/home/simon/projects/jemallocator/jemalloc-sys/jemalloc/configure" "--disable-cxx" "--disable-tls" "--with-jemalloc-prefix=_rjem_" "--host=armv7-linux-androideabi" "--build=x86_64-unknown-linux-gnu" "--prefix=/home/simon/projects/jemallocator/target/armv7-linux-androideabi/debug/build/jemalloc-sys-37291dd91f685dbc/out"
checking for xsltproc... /usr/bin/xsltproc
checking for armv7-linux-androideabi-gcc... arm-linux-androideabi-gcc
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 arm-linux-androideabi-gcc accepts -g... yes
checking for arm-linux-androideabi-gcc option to accept ISO C89... none needed
checking whether compiler is cray... no
checking whether compiler supports -std=gnu11... yes
checking whether compiler supports -Wall... yes
checking whether compiler supports -Wshorten-64-to-32... no
checking whether compiler supports -Wsign-compare... yes
checking whether compiler supports -Wundef... yes
checking whether compiler supports -pipe... yes
checking whether compiler supports -g3... yes
checking how to run the C preprocessor... arm-linux-androideabi-gcc -E
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /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 *... 4
checking size of int... 4
checking size of long... 4
checking size of long long... 8
checking size of intmax_t... 8
checking build system type... x86_64-unknown-linux-gnu
checking host system type... armv7-unknown-linux-androideabi
checking number of significant virtual address bits... 32
checking for armv7-linux-androideabi-ar... no
checking for ar... ar
checking for gawk... no
checking for mawk... mawk
checking malloc.h usability... yes
checking malloc.h presence... yes
checking for malloc.h... yes
checking whether malloc_usable_size definition can use const argument... yes
checking for library containing log... -lm
checking whether __attribute__ syntax is compilable... yes
checking whether compiler supports -fvisibility=hidden... yes
checking whether compiler supports -fvisibility=hidden... yes
checking whether compiler supports -Werror... yes
checking whether compiler supports -herror_on_warning... yes
checking whether tls_model attribute is compilable... yes
checking whether compiler supports -Werror... yes
checking whether compiler supports -herror_on_warning... yes
checking whether alloc_size attribute is compilable... yes
checking whether compiler supports -Werror... yes
checking whether compiler supports -herror_on_warning... yes
checking whether format(gnu_printf, ...) attribute is compilable... yes
checking whether compiler supports -Werror... yes
checking whether compiler supports -herror_on_warning... yes
checking whether format(printf, ...) attribute is compilable... yes
checking for a BSD-compatible install... /usr/bin/install -c
checking for armv7-linux-androideabi-ranlib... no
checking for ranlib... ranlib
checking for ld... /usr/bin/ld
checking for autoconf... /usr/bin/autoconf
checking for memalign... yes
checking for valloc... yes
checking whether compiler supports -O3... yes
checking whether compiler supports -O3... yes
checking whether compiler supports -funroll-loops... yes
checking configured backtracing method... N/A
checking for sbrk... yes
checking whether utrace(2) is compilable... no
checking whether a program using __builtin_unreachable is compilable... yes
checking whether a program using __builtin_ffsl is compilable... yes
checking LG_PAGE... 12
checking pthread.h usability... yes
checking pthread.h presence... yes
checking for pthread.h... yes
checking for pthread_create in -lpthread... no
checking for library containing pthread_create... none required
checking dlfcn.h usability... yes
checking dlfcn.h presence... yes
checking for dlfcn.h... yes
checking for dlsym... yes
checking whether pthread_atfork(3) is compilable... yes
checking whether pthread_setname_np(3) is compilable... yes
checking for library containing clock_gettime... none required
checking whether clock_gettime(CLOCK_MONOTONIC_COARSE, ...) is compilable... yes
checking whether clock_gettime(CLOCK_MONOTONIC, ...) is compilable... yes
checking whether mach_absolute_time() is compilable... no
checking whether compiler supports -Werror... yes
checking whether syscall(2) is compilable... no
checking for secure_getenv... no
checking for sched_getcpu... yes
checking for sched_setaffinity... yes
checking for issetugid... no
checking for _malloc_thread_cleanup... no
checking for _pthread_mutex_init_calloc_cb... no
checking for TLS... yes
checking whether C11 atomics is compilable... yes
checking whether GCC __atomic atomics is compilable... yes
checking whether GCC __sync atomics is compilable... yes
checking whether Darwin OSAtomic*() is compilable... no
checking whether madvise(2) is compilable... yes
checking whether madvise(..., MADV_FREE) is compilable... no
checking whether madvise(..., MADV_DONTNEED) is compilable... yes
checking whether madvise(..., MADV_[NO]HUGEPAGE) is compilable... yes
checking whether to force 32-bit __sync_{add,sub}_and_fetch()... no
checking whether to force 64-bit __sync_{add,sub}_and_fetch()... no
checking for __builtin_clz... yes
checking whether Darwin os_unfair_lock_*() is compilable... no
checking whether Darwin OSSpin*() is compilable... no
checking whether glibc malloc hook is compilable... no
checking whether glibc memalign hook is compilable... no
checking whether pthreads adaptive mutexes is compilable... no
checking for stdbool.h that conforms to C99... yes
checking for _Bool... yes
configure: creating ./config.status
config.status: creating Makefile
config.status: creating jemalloc.pc
config.status: creating doc/html.xsl
config.status: creating doc/manpages.xsl
config.status: creating doc/jemalloc.xml
config.status: creating include/jemalloc/jemalloc_macros.h
config.status: creating include/jemalloc/jemalloc_protos.h
config.status: creating include/jemalloc/jemalloc_typedefs.h
config.status: creating include/jemalloc/internal/jemalloc_preamble.h
config.status: creating test/test.sh
config.status: creating test/include/test/jemalloc_test.h
config.status: creating config.stamp
config.status: creating bin/jemalloc-config
config.status: creating bin/jemalloc.sh
config.status: creating bin/jeprof
config.status: creating include/jemalloc/jemalloc_defs.h
config.status: include/jemalloc/jemalloc_defs.h is unchanged
config.status: creating include/jemalloc/internal/jemalloc_internal_defs.h
config.status: include/jemalloc/internal/jemalloc_internal_defs.h is unchanged
config.status: creating test/include/test/jemalloc_test_defs.h
config.status: test/include/test/jemalloc_test_defs.h is unchanged
config.status: executing include/jemalloc/internal/public_symbols.txt commands
config.status: executing include/jemalloc/internal/private_symbols.awk commands
config.status: executing include/jemalloc/internal/private_symbols_jet.awk commands
config.status: executing include/jemalloc/internal/public_namespace.h commands
config.status: executing include/jemalloc/internal/public_unnamespace.h commands
config.status: executing include/jemalloc/internal/size_classes.h commands
config.status: executing include/jemalloc/jemalloc_protos_jet.h commands
config.status: executing include/jemalloc/jemalloc_rename.h commands
config.status: executing include/jemalloc/jemalloc_mangle.h commands
config.status: executing include/jemalloc/jemalloc_mangle_jet.h commands
config.status: executing include/jemalloc/jemalloc.h commands
===============================================================================
jemalloc version   : 0.1.4-28-g442765d741e0e8f8d6d7229126215a7ea41e1f6e
library revision   : 2

CONFIG             : --disable-cxx --disable-tls --with-jemalloc-prefix=_rjem_ --host=armv7-linux-androideabi --build=x86_64-unknown-linux-gnu --prefix=/home/simon/projects/jemallocator/target/armv7-linux-androideabi/debug/build/jemalloc-sys-37291dd91f685dbc/out build_alias=x86_64-unknown-linux-gnu host_alias=armv7-linux-androideabi CC=arm-linux-androideabi-gcc 'CFLAGS=-O0 -ffunction-sections -fdata-sections -fPIC -g -march=armv7-a -march=armv7-a -mthumb -mfpu=vfpv3-d16 -mfloat-abi=softfp' 'CPPFLAGS=-O0 -ffunction-sections -fdata-sections -fPIC -g -march=armv7-a -march=armv7-a -mthumb -mfpu=vfpv3-d16 -mfloat-abi=softfp'
CC                 : arm-linux-androideabi-gcc
CONFIGURE_CFLAGS   : -std=gnu11 -Wall -Wsign-compare -Wundef -pipe -g3 -fvisibility=hidden -O3 -funroll-loops
SPECIFIED_CFLAGS   : -O0 -ffunction-sections -fdata-sections -fPIC -g -march=armv7-a -march=armv7-a -mthumb -mfpu=vfpv3-d16 -mfloat-abi=softfp
EXTRA_CFLAGS       : 
CPPFLAGS           : -O0 -ffunction-sections -fdata-sections -fPIC -g -march=armv7-a -march=armv7-a -mthumb -mfpu=vfpv3-d16 -mfloat-abi=softfp -D_GNU_SOURCE -D_REENTRANT
CXX                : 
CONFIGURE_CXXFLAGS : -fvisibility=hidden -O3
SPECIFIED_CXXFLAGS : 
EXTRA_CXXFLAGS     : 
LDFLAGS            : 
EXTRA_LDFLAGS      : 
DSO_LDFLAGS        : -shared -Wl,-soname,$(@F)
LIBS               : -lm 
RPATH_EXTRA        : 

XSLTPROC           : /usr/bin/xsltproc
XSLROOT            : 

PREFIX             : /home/simon/projects/jemallocator/target/armv7-linux-androideabi/debug/build/jemalloc-sys-37291dd91f685dbc/out
BINDIR             : /home/simon/projects/jemallocator/target/armv7-linux-androideabi/debug/build/jemalloc-sys-37291dd91f685dbc/out/bin
DATADIR            : /home/simon/projects/jemallocator/target/armv7-linux-androideabi/debug/build/jemalloc-sys-37291dd91f685dbc/out/share
INCLUDEDIR         : /home/simon/projects/jemallocator/target/armv7-linux-androideabi/debug/build/jemalloc-sys-37291dd91f685dbc/out/include
LIBDIR             : /home/simon/projects/jemallocator/target/armv7-linux-androideabi/debug/build/jemalloc-sys-37291dd91f685dbc/out/lib
MANDIR             : /home/simon/projects/jemallocator/target/armv7-linux-androideabi/debug/build/jemalloc-sys-37291dd91f685dbc/out/share/man

srcroot            : /home/simon/projects/jemallocator/jemalloc-sys/jemalloc/
abs_srcroot        : /home/simon/projects/jemallocator/jemalloc-sys/jemalloc/
objroot            : 
abs_objroot        : /home/simon/projects/jemallocator/target/armv7-linux-androideabi/debug/build/jemalloc-sys-37291dd91f685dbc/out/build/

JEMALLOC_PREFIX    : _rjem_
JEMALLOC_PRIVATE_NAMESPACE
                   : je_
install_suffix     : 
malloc_conf        : 
autogen            : 0
debug              : 0
stats              : 1
prof               : 0
prof-libunwind     : 0
prof-libgcc        : 0
prof-gcc           : 0
thp                : 1
fill               : 1
utrace             : 0
xmalloc            : 0
lazy_lock          : 0
cache-oblivious    : 1
cxx                : 0
===============================================================================
running: "make" "install_lib_static" "install_include" "-j" "8"
arm-linux-androideabi-gcc -std=gnu11 -Wall -Wsign-compare -Wundef -pipe -g3 -fvisibility=hidden -O3 -funroll-loops -O0 -ffunction-sections -fdata-sections -fPIC -g -march=armv7-a -march=armv7-a -mthumb -mfpu=vfpv3-d16 -mfloat-abi=softfp -c -O0 -ffunction-sections -fdata-sections -fPIC -g -march=armv7-a -march=armv7-a -mthumb -mfpu=vfpv3-d16 -mfloat-abi=softfp -D_GNU_SOURCE -D_REENTRANT -I/home/simon/projects/jemallocator/jemalloc-sys/jemalloc/include -Iinclude -DJEMALLOC_NO_PRIVATE_NAMESPACE -o src/jemalloc.sym.o /home/simon/projects/jemallocator/jemalloc-sys/jemalloc/src/jemalloc.c
arm-linux-androideabi-gcc -std=gnu11 -Wall -Wsign-compare -Wundef -pipe -g3 -fvisibility=hidden -O3 -funroll-loops -O0 -ffunction-sections -fdata-sections -fPIC -g -march=armv7-a -march=armv7-a -mthumb -mfpu=vfpv3-d16 -mfloat-abi=softfp -c -O0 -ffunction-sections -fdata-sections -fPIC -g -march=armv7-a -march=armv7-a -mthumb -mfpu=vfpv3-d16 -mfloat-abi=softfp -D_GNU_SOURCE -D_REENTRANT -I/home/simon/projects/jemallocator/jemalloc-sys/jemalloc/include -Iinclude -DJEMALLOC_NO_PRIVATE_NAMESPACE -o src/arena.sym.o /home/simon/projects/jemallocator/jemalloc-sys/jemalloc/src/arena.c
arm-linux-androideabi-gcc -std=gnu11 -Wall -Wsign-compare -Wundef -pipe -g3 -fvisibility=hidden -O3 -funroll-loops -O0 -ffunction-sections -fdata-sections -fPIC -g -march=armv7-a -march=armv7-a -mthumb -mfpu=vfpv3-d16 -mfloat-abi=softfp -c -O0 -ffunction-sections -fdata-sections -fPIC -g -march=armv7-a -march=armv7-a -mthumb -mfpu=vfpv3-d16 -mfloat-abi=softfp -D_GNU_SOURCE -D_REENTRANT -I/home/simon/projects/jemallocator/jemalloc-sys/jemalloc/include -Iinclude -DJEMALLOC_NO_PRIVATE_NAMESPACE -o src/background_thread.sym.o /home/simon/projects/jemallocator/jemalloc-sys/jemalloc/src/background_thread.c
arm-linux-androideabi-gcc -std=gnu11 -Wall -Wsign-compare -Wundef -pipe -g3 -fvisibility=hidden -O3 -funroll-loops -O0 -ffunction-sections -fdata-sections -fPIC -g -march=armv7-a -march=armv7-a -mthumb -mfpu=vfpv3-d16 -mfloat-abi=softfp -c -O0 -ffunction-sections -fdata-sections -fPIC -g -march=armv7-a -march=armv7-a -mthumb -mfpu=vfpv3-d16 -mfloat-abi=softfp -D_GNU_SOURCE -D_REENTRANT -I/home/simon/projects/jemallocator/jemalloc-sys/jemalloc/include -Iinclude -DJEMALLOC_NO_PRIVATE_NAMESPACE -o src/base.sym.o /home/simon/projects/jemallocator/jemalloc-sys/jemalloc/src/base.c
arm-linux-androideabi-gcc -std=gnu11 -Wall -Wsign-compare -Wundef -pipe -g3 -fvisibility=hidden -O3 -funroll-loops -O0 -ffunction-sections -fdata-sections -fPIC -g -march=armv7-a -march=armv7-a -mthumb -mfpu=vfpv3-d16 -mfloat-abi=softfp -c -O0 -ffunction-sections -fdata-sections -fPIC -g -march=armv7-a -march=armv7-a -mthumb -mfpu=vfpv3-d16 -mfloat-abi=softfp -D_GNU_SOURCE -D_REENTRANT -I/home/simon/projects/jemallocator/jemalloc-sys/jemalloc/include -Iinclude -DJEMALLOC_NO_PRIVATE_NAMESPACE -o src/bitmap.sym.o /home/simon/projects/jemallocator/jemalloc-sys/jemalloc/src/bitmap.c
arm-linux-androideabi-gcc -std=gnu11 -Wall -Wsign-compare -Wundef -pipe -g3 -fvisibility=hidden -O3 -funroll-loops -O0 -ffunction-sections -fdata-sections -fPIC -g -march=armv7-a -march=armv7-a -mthumb -mfpu=vfpv3-d16 -mfloat-abi=softfp -c -O0 -ffunction-sections -fdata-sections -fPIC -g -march=armv7-a -march=armv7-a -mthumb -mfpu=vfpv3-d16 -mfloat-abi=softfp -D_GNU_SOURCE -D_REENTRANT -I/home/simon/projects/jemallocator/jemalloc-sys/jemalloc/include -Iinclude -DJEMALLOC_NO_PRIVATE_NAMESPACE -o src/ckh.sym.o /home/simon/projects/jemallocator/jemalloc-sys/jemalloc/src/ckh.c
arm-linux-androideabi-gcc -std=gnu11 -Wall -Wsign-compare -Wundef -pipe -g3 -fvisibility=hidden -O3 -funroll-loops -O0 -ffunction-sections -fdata-sections -fPIC -g -march=armv7-a -march=armv7-a -mthumb -mfpu=vfpv3-d16 -mfloat-abi=softfp -c -O0 -ffunction-sections -fdata-sections -fPIC -g -march=armv7-a -march=armv7-a -mthumb -mfpu=vfpv3-d16 -mfloat-abi=softfp -D_GNU_SOURCE -D_REENTRANT -I/home/simon/projects/jemallocator/jemalloc-sys/jemalloc/include -Iinclude -DJEMALLOC_NO_PRIVATE_NAMESPACE -o src/ctl.sym.o /home/simon/projects/jemallocator/jemalloc-sys/jemalloc/src/ctl.c
arm-linux-androideabi-gcc -std=gnu11 -Wall -Wsign-compare -Wundef -pipe -g3 -fvisibility=hidden -O3 -funroll-loops -O0 -ffunction-sections -fdata-sections -fPIC -g -march=armv7-a -march=armv7-a -mthumb -mfpu=vfpv3-d16 -mfloat-abi=softfp -c -O0 -ffunction-sections -fdata-sections -fPIC -g -march=armv7-a -march=armv7-a -mthumb -mfpu=vfpv3-d16 -mfloat-abi=softfp -D_GNU_SOURCE -D_REENTRANT -I/home/simon/projects/jemallocator/jemalloc-sys/jemalloc/include -Iinclude -DJEMALLOC_NO_PRIVATE_NAMESPACE -o src/extent.sym.o /home/simon/projects/jemallocator/jemalloc-sys/jemalloc/src/extent.c

--- stderr
configure: WARNING: unrecognized options: --disable-tls
configure: WARNING: using cross tools not prefixed with host triplet
configure: WARNING: unrecognized options: --disable-tls
In file included from /home/simon/projects/jemallocator/jemalloc-sys/jemalloc/include/jemalloc/internal/jemalloc_internal_includes.h:78:0,
                 from /home/simon/projects/jemallocator/jemalloc-sys/jemalloc/src/base.c:3:
/home/simon/projects/jemallocator/jemalloc-sys/jemalloc/include/jemalloc/internal/jemalloc_internal_inlines_a.h: In function 'malloc_getcpu':
In file included from /home/simon/projects/jemallocator/jemalloc-sys/jemalloc/include/jemalloc/internal/jemalloc_internal_includes.h:78:0,
                 from /home/simon/projects/jemallocator/jemalloc-sys/jemalloc/src/jemalloc.c:3:
/home/simon/projects/jemallocator/jemalloc-sys/jemalloc/include/jemalloc/internal/jemalloc_internal_inlines_a.h: In function 'malloc_getcpu':
In file included from /home/simon/projects/jemallocator/jemalloc-sys/jemalloc/include/jemalloc/internal/jemalloc_internal_includes.h:78:0,
                 from /home/simon/projects/jemallocator/jemalloc-sys/jemalloc/src/arena.c:3:
/home/simon/projects/jemallocator/jemalloc-sys/jemalloc/include/jemalloc/internal/jemalloc_internal_inlines_a.h: In function 'malloc_getcpu':
/home/simon/projects/jemallocator/jemalloc-sys/jemalloc/include/jemalloc/internal/jemalloc_internal_inlines_a.h:14:2: warning: implicit declaration of function 'sched_getcpu' [-Wimplicit-function-declaration]
  return (malloc_cpuid_t)sched_getcpu();
  ^
/home/simon/projects/jemallocator/jemalloc-sys/jemalloc/include/jemalloc/internal/jemalloc_internal_inlines_a.h:14:2: warning: implicit declaration of function 'sched_getcpu' [-Wimplicit-function-declaration]
  return (malloc_cpuid_t)sched_getcpu();
  ^
/home/simon/projects/jemallocator/jemalloc-sys/jemalloc/include/jemalloc/internal/jemalloc_internal_inlines_a.h:14:2: warning: implicit declaration of function 'sched_getcpu' [-Wimplicit-function-declaration]
  return (malloc_cpuid_t)sched_getcpu();
  ^
In file included from /home/simon/projects/jemallocator/jemalloc-sys/jemalloc/include/jemalloc/internal/jemalloc_internal_includes.h:78:0,
                 from /home/simon/projects/jemallocator/jemalloc-sys/jemalloc/src/background_thread.c:3:
/home/simon/projects/jemallocator/jemalloc-sys/jemalloc/include/jemalloc/internal/jemalloc_internal_inlines_a.h: In function 'malloc_getcpu':
/home/simon/projects/jemallocator/jemalloc-sys/jemalloc/include/jemalloc/internal/jemalloc_internal_inlines_a.h:14:2: warning: implicit declaration of function 'sched_getcpu' [-Wimplicit-function-declaration]
  return (malloc_cpuid_t)sched_getcpu();
  ^
In file included from /home/simon/projects/jemallocator/jemalloc-sys/jemalloc/include/jemalloc/internal/jemalloc_internal_includes.h:78:0,
                 from /home/simon/projects/jemallocator/jemalloc-sys/jemalloc/src/ckh.c:42:
/home/simon/projects/jemallocator/jemalloc-sys/jemalloc/include/jemalloc/internal/jemalloc_internal_inlines_a.h: In function 'malloc_getcpu':
/home/simon/projects/jemallocator/jemalloc-sys/jemalloc/include/jemalloc/internal/jemalloc_internal_inlines_a.h:14:2: warning: implicit declaration of function 'sched_getcpu' [-Wimplicit-function-declaration]
  return (malloc_cpuid_t)sched_getcpu();
  ^
In file included from /home/simon/projects/jemallocator/jemalloc-sys/jemalloc/include/jemalloc/internal/jemalloc_internal_includes.h:78:0,
                 from /home/simon/projects/jemallocator/jemalloc-sys/jemalloc/src/bitmap.c:3:
/home/simon/projects/jemallocator/jemalloc-sys/jemalloc/include/jemalloc/internal/jemalloc_internal_inlines_a.h: In function 'malloc_getcpu':
/home/simon/projects/jemallocator/jemalloc-sys/jemalloc/include/jemalloc/internal/jemalloc_internal_inlines_a.h:14:2: warning: implicit declaration of function 'sched_getcpu' [-Wimplicit-function-declaration]
  return (malloc_cpuid_t)sched_getcpu();
  ^
In file included from /home/simon/projects/jemallocator/jemalloc-sys/jemalloc/include/jemalloc/internal/jemalloc_internal_includes.h:78:0,
                 from /home/simon/projects/jemallocator/jemalloc-sys/jemalloc/src/ctl.c:3:
/home/simon/projects/jemallocator/jemalloc-sys/jemalloc/include/jemalloc/internal/jemalloc_internal_inlines_a.h: In function 'malloc_getcpu':
/home/simon/projects/jemallocator/jemalloc-sys/jemalloc/include/jemalloc/internal/jemalloc_internal_inlines_a.h:14:2: warning: implicit declaration of function 'sched_getcpu' [-Wimplicit-function-declaration]
  return (malloc_cpuid_t)sched_getcpu();
  ^
/home/simon/projects/jemallocator/jemalloc-sys/jemalloc/src/background_thread.c: In function 'set_current_thread_affinity':
/home/simon/projects/jemallocator/jemalloc-sys/jemalloc/src/background_thread.c:83:2: error: unknown type name 'cpu_set_t'
  cpu_set_t cpuset;
  ^
/home/simon/projects/jemallocator/jemalloc-sys/jemalloc/src/background_thread.c:84:2: warning: implicit declaration of function 'CPU_ZERO' [-Wimplicit-function-declaration]
  CPU_ZERO(&cpuset);
  ^
/home/simon/projects/jemallocator/jemalloc-sys/jemalloc/src/background_thread.c:85:2: warning: implicit declaration of function 'CPU_SET' [-Wimplicit-function-declaration]
  CPU_SET(cpu, &cpuset);
  ^
/home/simon/projects/jemallocator/jemalloc-sys/jemalloc/src/background_thread.c:86:2: warning: implicit declaration of function 'sched_setaffinity' [-Wimplicit-function-declaration]
  int ret = sched_setaffinity(0, sizeof(cpu_set_t), &cpuset);
  ^
/home/simon/projects/jemallocator/jemalloc-sys/jemalloc/src/background_thread.c:86:40: error: 'cpu_set_t' undeclared (first use in this function)
  int ret = sched_setaffinity(0, sizeof(cpu_set_t), &cpuset);
                                        ^
/home/simon/projects/jemallocator/jemalloc-sys/jemalloc/src/background_thread.c:86:40: note: each undeclared identifier is reported only once for each function it appears in
In file included from /home/simon/projects/jemallocator/jemalloc-sys/jemalloc/include/jemalloc/internal/jemalloc_internal_includes.h:78:0,
                 from /home/simon/projects/jemallocator/jemalloc-sys/jemalloc/src/extent.c:3:
/home/simon/projects/jemallocator/jemalloc-sys/jemalloc/include/jemalloc/internal/jemalloc_internal_inlines_a.h: In function 'malloc_getcpu':
/home/simon/projects/jemallocator/jemalloc-sys/jemalloc/include/jemalloc/internal/jemalloc_internal_inlines_a.h:14:2: warning: implicit declaration of function 'sched_getcpu' [-Wimplicit-function-declaration]
  return (malloc_cpuid_t)sched_getcpu();
  ^
/home/simon/projects/jemallocator/jemalloc-sys/jemalloc/src/jemalloc.c: In function 'malloc_init_hard_recursible':
/home/simon/projects/jemallocator/jemalloc-sys/jemalloc/src/jemalloc.c:1301:2: warning: implicit declaration of function 'pthread_atfork' [-Wimplicit-function-declaration]
  if (pthread_atfork(jemalloc_prefork, jemalloc_postfork_parent,
  ^
make: *** [src/background_thread.sym.o] Error 1
make: *** Waiting for unfinished jobs....
thread 'main' panicked at 'command did not execute successfully: "make" "install_lib_static" "install_include" "-j" "8"
expected success, got: exit code: 2', jemalloc-sys/build.rs:144:9
note: Run with `RUST_BACKTRACE=1` for a backtrace.

@gnzlbg
Copy link
Owner Author

gnzlbg commented Apr 27, 2018

@SimonSapin so I just started adding android CI to jemallocator and had a dejavu...

In fact, before submitting this PR upgrading the jemalloc version, I submitted a PR that did exactly that: add CI for 4 Android targets, amongst many other targets, that would have caught this: https://github.com/alexcrichton/jemallocator/pull/31

In that PR I wrote:

@alexcrichton I am updating the jemalloc version in another PR and that breaks some platforms, so I'd rather have these tests for all these platforms here with allow_failures so that we know when upgrading jemalloc breaks something.

To which @alexcrichton responded:

Yes that's true, upgrading jemalloc can cause platform breakage, but again I think I just do not personally want to maintain so many platforms. It'll be our job in rustc to catch these breakages if we'd like.

So the work for expanding the CI of jemallocator was already done. The problem is that nobody did the job of updating jemalloc in rustc, catching failures, and fixing things as necessary. @sfackler tried, but IMO it is much easier to catch and debug failures here in isolation than when running the full rust-lang/rust testsuite. I almost think that if the tests do not pass here, it is actually pointless to try to get the rust-lang/rust tests to pass on all relevant targets.

Should I reopen that PR ?

@gnzlbg
Copy link
Owner Author

gnzlbg commented Apr 27, 2018

FWIW that PR uses cross but I can remove the cross dependency from it. I just used cross because it got the job done by just changing a couple of lines in the .travis.yml file.

Moggers referenced this pull request in Moggers/servo Jun 13, 2018
CC https://github.com/alexcrichton/jemallocator/pull/40,
rust-lang/rust#49669

The new version of jemallocator requires a more recent jemalloc
https://github.com/alexcrichton/jemallocator/pull/34
which doesn’t build on our current Android toolchain
jemalloc/jemalloc#1175.

To avoid blocking on figuring that out, duplicate ~70 lines
from jemallocator and use the older jemalloc-sys directly.
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.

3 participants