编译器错误gcc-8:错误:无法识别的命令行选项'-no-pie' [英] compiler error gcc-8: error: unrecognized command line option '-no-pie'

查看:1193
本文介绍了编译器错误gcc-8:错误:无法识别的命令行选项'-no-pie'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用此Makefile进行编译,但出现此错误。我可以使用学校的Linux计算机和gcc 6.3进行编译。我尝试使用来自自制软件的gcc的几个不同版本使用MacOS mojave(gcc-8,gcc-4.9,gcc-6),但始终出现此错误。

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


推荐答案

正在此处查找有关信息: https://github.com/xd009642/tarpaulin/issues/7#issuecomment-317180523

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

问题可能与gcc的构建方式非常相关:在编译时未设置--enable-default-pie标志的gcc构建,因为它们太旧或仅具有--disable-default-pie标志没有-no-pie链接器标志

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"

您可能需要更新或重新编译该环境的gcc才能使用该标志(如果对您很重要)。

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

这篇关于编译器错误gcc-8:错误:无法识别的命令行选项'-no-pie'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆