How to solve: Recompile with -fPIE error?

I tried to compile the code with a makefile but this is the error that the terminal shows to me:

rm -f test/bst_is_not_empty rm -f test/ht_sepchain_is_not_empty rm -f *.o test/*.o cc -Wall -Wextra -std=c11 -pedantic -g -I./include -c -o test/bst_is_not_empty. test/bst_is_not_empty.c cc -Wall -Wextra -std=c11 -pedantic -g -I./include -c -o exam.o exam.c cc -L./lib test/bst_is_not_empty.o exam.o -lm -lupoalglib -o test/bst_is_not_empty /usr/bin/ld: ./lib/libupoalglib.a(test.o): relocation R_X86_64_32 against `.rodata' can not be used when making a PIE object; recompile with -fPIE /usr/bin/ld: ./lib/libupoalglib.a(bst.o): relocation R_X86_64_32 against `.rodata' can not be used when making a PIE object; recompile with -fPIE collect2: error: ld returned 1 exit status make: *** [<builtin>: test/bst_is_not_empty] Error 1 

This is the makefile:

CFLAGS += -Wall -Wextra -std=c11 -pedantic CFLAGS += -g CFLAGS += -I./include LDFLAGS += -L./lib LDLIBS += -lm -lupoalglib .PHONY: all clean all: test/bst_is_not_empty test/ht_sepchain_is_not_empty test/bst_is_not_empty: test/bst_is_not_empty.o exam.o test/ht_sepchain_is_not_empty: test/ht_sepchain_is_not_empty.o exam.o clean: $(RM) test/bst_is_not_empty $(RM) test/ht_sepchain_is_not_empty $(RM) *.o test/*.o 

The makefile, and all source/header files were provided by my professor (is a test example, so...) I tried to figure out how to solve this issue but I'm still confused about this error

2

1 Answer

Try recompile ./lib/libupoalglib.a with -fPIC

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like