Commit f8e57eeb authored by Swann Perarnau's avatar Swann Perarnau
Browse files

[fix] Make jemalloc link properly with aml

Using both --with-jemalloc-prefix=jemk_ and --with-install-suffix=-aml
ensures that the libjemalloc we build for our internal use has unique
functions names and library names.

This patch fixes a problem with the libtool configuration, where we had
to link a static jemalloc library into the shared aml library to make
everything work. Instead, we can now use the proper LIBADD variables
with the unique library.

Note that with this patch the `make check` target requires a `make
install` beforehand.
parent a002945c
...@@ -41,7 +41,9 @@ AC_CHECK_HEADERS(numa.h) ...@@ -41,7 +41,9 @@ AC_CHECK_HEADERS(numa.h)
AC_CHECK_LIB(numa, move_pages) AC_CHECK_LIB(numa, move_pages)
# internal jemalloc # internal jemalloc
ac_configure_args="$ac_configure_args '--with-jemalloc-prefix=jemk_'" ac_configure_args="$ac_configure_args \
'--with-jemalloc-prefix=jemk_' \
'--with-install-suffix=-aml'"
AC_CONFIG_SUBDIRS([jemalloc]) AC_CONFIG_SUBDIRS([jemalloc])
AC_CONFIG_HEADERS([src/config.h]) AC_CONFIG_HEADERS([src/config.h])
......
...@@ -17,5 +17,5 @@ LIBCSOURCES = aml.c area.c arena.c \ ...@@ -17,5 +17,5 @@ LIBCSOURCES = aml.c area.c arena.c \
LIBHSOURCES = aml.h LIBHSOURCES = aml.h
libaml_la_SOURCES = $(LIBCSOURCES) $(LIBHSOURCES) libaml_la_SOURCES = $(LIBCSOURCES) $(LIBHSOURCES)
libaml_la_LIBADD = $(top_srcdir)/jemalloc/lib/libjemalloc_pic.a libaml_la_LIBADD = -L$(top_srcdir)/jemalloc/lib/ -ljemalloc-aml
include_HEADERS = $(LIBHSOURCES) include_HEADERS = $(LIBHSOURCES)
#include <assert.h> #include <assert.h>
#include <aml.h> #include <aml.h>
#include <jemalloc/jemalloc.h> #include <jemalloc/jemalloc-aml.h>
#include <pthread.h> #include <pthread.h>
#include <stdio.h> #include <stdio.h>
#include <sys/mman.h> #include <sys/mman.h>
......
...@@ -2,7 +2,7 @@ AM_COLOR_TESTS = yes ...@@ -2,7 +2,7 @@ AM_COLOR_TESTS = yes
# add OpenMP to flags for test programs # add OpenMP to flags for test programs
AM_CFLAGS = -fopenmp -I$(top_srcdir)/src AM_CFLAGS = -fopenmp -I$(top_srcdir)/src
AM_LDFLAGS = -fopenmp ../src/libaml.la AM_LDFLAGS = -fopenmp ../src/libaml.la ../jemalloc/lib/libjemalloc-aml.so
# valgrind support # valgrind support
if TEST_VALGRIND if TEST_VALGRIND
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment