Skip to content

Commit 0580cdf

Browse files
committed
Fix build.sh for linux to enable jemalloc
1 parent 939d6a9 commit 0580cdf

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

chdb/build.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,13 @@ LIBCHDB_CMD=$(grep 'clang++.*-o programs/clickhouse .*' build.log \
100100
| sed 's/ -Xlinker --no-undefined//g' \
101101
)
102102

103+
if [ "$(uname)" == "Linux" ]; then
104+
# remove src/CMakeFiles/clickhouse_malloc.dir/Common/stubFree.c.o
105+
LIBCHDB_CMD=$(echo ${LIBCHDB_CMD} | sed 's/ src\/CMakeFiles\/clickhouse_malloc.dir\/Common\/stubFree.c.o//g')
106+
# put -Wl,-wrap,malloc ... after -DUSE_JEMALLOC=1
107+
LIBCHDB_CMD=$(echo ${LIBCHDB_CMD} | sed 's/ -DUSE_JEMALLOC=1/ -DUSE_JEMALLOC=1 -Wl,-wrap,malloc -Wl,-wrap,valloc -Wl,-wrap,pvalloc -Wl,-wrap,calloc -Wl,-wrap,realloc -Wl,-wrap,memalign -Wl,-wrap,aligned_alloc -Wl,-wrap,posix_memalign -Wl,-wrap,free/g')
108+
fi
109+
103110
# save the command to a file for debug
104111
echo ${LIBCHDB_CMD} > libchdb_cmd.sh
105112

0 commit comments

Comments
 (0)