Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

compiler error gcc-8: error: unrecognized command line option '-no-pie'

I am trying to compile using this makefile but got this error. I can compile using school's linux computer with gcc 6.3. I tried using my MacOS mojave using a few different version of gcc from homebrew (gcc-8, gcc-4.9, gcc-6) but I get this error consistently.

CC = gcc-8
OPT = -O3 -g
LIBS = -lz -lcvp -lz
FLAGS = -std=c++11 -L. $(LIBS) $(OPT) -no-pie


OBJ = myprogram.o
DEPS = cvp.h myprogram.h


all: cvp

cvp: $(OBJ)
    $(CC) $(FLAGS) -o $@ $^

%.o: %.cc $(DEPS)
    $(CC) $(FLAGS) -c -o $@ $<

.PHONY: clean

clean:
    rm -f *.o cvp
like image 618
Summerle Avatar asked Oct 24 '25 18:10

Summerle


1 Answers

Going off information found here: https://github.com/xd009642/tarpaulin/issues/7#issuecomment-317180523

The problem may very well be related to how gcc is built: "Builds of gcc that don't have the --enable-default-pie flag set at compile time because they are too old or have the --disable-default-pie flag just don't have the -no-pie linker flag"

You might need to update or recompile gcc for that environment to be able to use that flag if important to you.

like image 116
Ross Avatar answered Oct 26 '25 18:10

Ross