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

[fix] Embed custom jemalloc into libaml

Force libtool to static link the PIC version of our jemalloc import into
libaml, making libaml standalone. This requires us to test some
additional libraries in our own configure (pthread, and dlopen).

This also solves the long-standing issue of `make check` only working after
`make install`, while removing our custom jemalloc from the installed
libraries.

Fixes #26.
parent b3c9093f
Pipeline #6705 passed with stage
in 9 minutes and 17 seconds
...@@ -11,8 +11,8 @@ make:generic: ...@@ -11,8 +11,8 @@ make:generic:
- mkdir build - mkdir build
- ./configure --prefix=`pwd`/build - ./configure --prefix=`pwd`/build
- make - make
- make install
- make check - make check
- make install
artifacts: artifacts:
when: on_failure when: on_failure
paths: paths:
...@@ -29,8 +29,8 @@ make:knl: ...@@ -29,8 +29,8 @@ make:knl:
- mkdir build - mkdir build
- CC=icc CFLAGS="-mkl -xhost" ./configure --prefix=`pwd`/build --enable-benchmarks - CC=icc CFLAGS="-mkl -xhost" ./configure --prefix=`pwd`/build --enable-benchmarks
- make -j64 - make -j64
- make install
- make check - make check
- make install
artifacts: artifacts:
when: on_failure when: on_failure
paths: paths:
......
...@@ -13,7 +13,6 @@ check-recursive: ...@@ -13,7 +13,6 @@ check-recursive:
$(MAKE) -C tests check $(MAKE) -C tests check
install-recursive: install-recursive:
$(MAKE) -C jemalloc install_lib
$(MAKE) -C src install $(MAKE) -C src install
$(MAKE) install-am $(MAKE) install-am
......
...@@ -6,5 +6,5 @@ includedir=@includedir@ ...@@ -6,5 +6,5 @@ includedir=@includedir@
Name: libaml Name: libaml
Description: Argonne's Memory Library Description: Argonne's Memory Library
Version: 0.0.1 Version: 0.0.1
Libs: -L${libdir} -laml -ljemalloc-aml Libs: -L${libdir} -laml
Cflags: -I${includedir} Cflags: -I${includedir}
AM_CFLAGS = -I$(top_srcdir)/src -I. @OPENMP_FLAG@ AM_CFLAGS = -I$(top_srcdir)/src -I. @OPENMP_FLAG@
AM_LDFLAGS = ../src/libaml.la ../jemalloc/lib/libjemalloc-aml.so @OPENMP_FLAG@ AM_LDFLAGS = ../src/libaml.la @OPENMP_FLAG@
noinst_LIBRARIES = libutils.a noinst_LIBRARIES = libutils.a
libutils_a_SOURCES = utils.c utils.h libutils_a_SOURCES = utils.c utils.h
......
...@@ -51,6 +51,14 @@ AM_CONDITIONAL([ADD_BENCHMARKS],[test "x$benchmarks" = xtrue]) ...@@ -51,6 +51,14 @@ AM_CONDITIONAL([ADD_BENCHMARKS],[test "x$benchmarks" = xtrue])
# dependencies # dependencies
AC_CHECK_HEADERS(numa.h) AC_CHECK_HEADERS(numa.h)
AC_CHECK_LIB(numa, move_pages) AC_CHECK_LIB(numa, move_pages)
AC_CHECK_LIB(dl, dlopen)
# add pthread support
AX_PTHREAD
LIBS="$PTHREAD_LIBS $LIBS"
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
CC="$PTHREAD_CC"
# internal jemalloc # internal jemalloc
ac_configure_args="$ac_configure_args \ ac_configure_args="$ac_configure_args \
......
This diff is collapsed.
...@@ -41,5 +41,5 @@ LIBCSOURCES = aml.c area.c arena.c \ ...@@ -41,5 +41,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 = -L$(top_srcdir)/jemalloc/lib/ -ljemalloc-aml libaml_la_LIBADD = $(top_srcdir)/jemalloc/lib/libjemalloc-aml_pic.a
include_HEADERS = $(LIBHSOURCES) include_HEADERS = $(LIBHSOURCES)
...@@ -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 = -I$(top_srcdir)/src AM_CFLAGS = -I$(top_srcdir)/src
AM_LDFLAGS = ../src/libaml.la ../jemalloc/lib/libjemalloc-aml.so AM_LDFLAGS = ../src/libaml.la
# 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