Closed mukeshgarg81 closed 1 year ago
Hi mukeshgarg81. The reason for the 'multiple definition' error you got seems that jemalloc's function prefix was not specified during the its build. $ /path/to/jemalloc/configure --with-jemalloc-prefix='je_'
To solve the problem more simply,, I recommend you build all libraries through the buildscript we provide than build each library seperately with a command below. $ /path/to/smdk/lib/build_lib.sh smdkmalloc
Thanks!
Junhyeok Im.
I tried following steps to build smdl_allocator code but facing issue in build "comp_api"
build error logs: root@mukesh-Inspiron-7460:/home/smdk_allocator# make comp_api cd jemalloc-5.2.1 && make -j make[1]: Entering directory '/home/smdk_allocator/jemalloc-5.2.1' make[1]: Leaving directory '/home/smdk_allocator/jemalloc-5.2.1' mkdir -p lib cd ./comp_api && make make[1]: Entering directory '/home/smdk_allocator/comp_api' g++ -Wall -shared -o ../lib/libcxlmalloc.so smdk_comp_api.o cxlmalloc.o cxlmalloc_cpp.o /home/smdk_allocator/comp_api/../core/init.o /home/smdk_allocator/comp_api/../core/alloc.o /home/smdk_allocator/comp_api/../core/config.o -L/home/smdk_allocator/comp_api/../jemalloc-5.2.1/lib/ -Wl,--whole-archive /home/smdk_allocator/comp_api/../jemalloc-5.2.1/lib/libjemalloc_pic.a -Wl,--no-whole-archive -lpthread -ldl -lnuma -lstdc++ /usr/bin/ld: /home/smdk_allocator/comp_api/../jemalloc-5.2.1/lib/libjemalloc_pic.a(jemalloc.pic.o): in function
realloc': /home/smdk_allocator/jemalloc-5.2.1/src/jemalloc.c:2653: multiple definition of
realloc'; smdk_comp_api.o:smdk_comp_api.c:(.text+0x12f): first defined here /usr/bin/ld: /home/smdk_allocator/comp_api/../jemalloc-5.2.1/lib/libjemalloc_pic.a(jemalloc.pic.o): in functionmalloc': /home/smdk_allocator/jemalloc-5.2.1/src/jemalloc.c:2323: multiple definition of
malloc'; smdk_comp_api.o:smdk_comp_api.c:(.text+0x20): first defined here /usr/bin/ld: /home/smdk_allocator/comp_api/../jemalloc-5.2.1/lib/libjemalloc_pic.a(jemalloc.pic.o): in functionposix_memalign': /home/smdk_allocator/jemalloc-5.2.1/src/jemalloc.c:2393: multiple definition of
posix_memalign'; smdk_comp_api.o:smdk_comp_api.c:(.text+0x1ac): first defined here ....... ...... collect2: error: ld returned 1 exit status make[1]: [Makefile:33: ../lib/libcxlmalloc.so] Error 1 make[1]: Leaving directory '/home/smdk_allocator/comp_api' make: [Makefile:16: comp_api] Error 2