WuBingzheng / libleak

detect memory leak by LD_PRELOAD, without changing the target program
249 stars 52 forks source link

fails to compile on fedora 36 #23

Closed mailinglists35 closed 2 years ago

mailinglists35 commented 2 years ago

first I hit this issue https://github.com/WuBingzheng/libleak/issues/19 then I hit this issue and re-downloaded https://github.com/WuBingzheng/libleak/issues/11

then I get this:

cc -g -O2 -Wall -fPIC -Ilibwuya   -c -o libleak.o libleak.c
CFLAGS='-fPIC' make -C libwuya
make[1]: Entering directory '/home/asus/libleak/libwuya'
cc -fPIC -g -Wall -O2   -c -o wuy_dict.o wuy_dict.c
cc -fPIC -g -Wall -O2   -c -o wuy_pool.o wuy_pool.c
cc -fPIC -g -Wall -O2   -c -o wuy_heap.o wuy_heap.c
cc -fPIC -g -Wall -O2   -c -o wuy_event.o wuy_event.c
cc -fPIC -g -Wall -O2   -c -o wuy_sockaddr.o wuy_sockaddr.c
cc -fPIC -g -Wall -O2   -c -o wuy_skiplist.o wuy_skiplist.c
ar rcs libwuya.a wuy_dict.o wuy_pool.o wuy_heap.o wuy_event.o wuy_sockaddr.o wuy_skiplist.o
make[1]: Leaving directory '/home/asus/libleak/libwuya'
cc -shared -o libleak.so libleak.o -Llibwuya -lwuya -lpthread -ldl -lbacktrace
/usr/bin/ld: /usr/local/lib/libbacktrace.a(fileline.o): relocation R_X86_64_32 against `.rodata.str1.8' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libbacktrace.a(posix.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libbacktrace.a(simple.o): relocation R_X86_64_32 against `.text' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libbacktrace.a(elf.o): relocation R_X86_64_32 against `.rodata.str1.8' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libbacktrace.a(mmapio.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libbacktrace.a(mmap.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libbacktrace.a(dwarf.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
collect2: error: ld returned 1 exit status
make: *** [Makefile:6: libleak.so] Error 1
mailinglists35 commented 2 years ago

I went back into libbacktrace folder, edited Makefile and added -fPIC to CFLAGS = line