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

穿精又带淫゛_ 提交于 2020-06-27 15:49:29

问题


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

回答1:


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.



来源:https://stackoverflow.com/questions/54524190/compiler-error-gcc-8-error-unrecognized-command-line-option-no-pie

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!