Python 调试错误“gcc: error: x86_64-linux-gnu-gcc: No such file or directory”

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/22571848/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-19 01:11:33  来源:igfitidea点击:

Debugging the error "gcc: error: x86_64-linux-gnu-gcc: No such file or directory"

pythongccmakefileautotools

提问by cat pants

I'm trying to build: https://github.com/kanzure/nanoengineer

我正在尝试构建:https: //github.com/kanzure/nanoengineer

But it looks like it errors out on:

但看起来它出错了:

gcc -DHAVE_CONFIG_H -I. -I../.. -I/usr/include/python2.7   -std=c99 x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -MT libstructcompare_a-structcompare.o -MD -MP -MF .deps/libstructcompare_a-structcompare.Tpo -c -o libstructcompare_a-structcompare.o `test -f 'structcompare.c' || echo './'`structcompare.c
gcc: error: x86_64-linux-gnu-gcc: No such file or directory

x86_64-linux-gnu-gccdefinitely exists in /usr/bin(It's a symlink) and the target definitely exists as well. It looks to me like the Makefile wasn't generated correctly, perhaps there is a flag that should be passed before specifying x86_64-linux-gnu-gcc? I am unsure as well what specifying x86_64-linux-gnu-gccis supposed to accomplish.

x86_64-linux-gnu-gcc肯定存在于/usr/bin(这是一个符号链接)并且目标也肯定存在。在我看来,Makefile 没有正确生成,也许在指定 x86_64-linux-gnu-gcc 之前应该传递一个标志?我也不确定指定x86_64-linux-gnu-gcc应该完成什么。

Finally, this makefile was generated by configure, so once we narrow down the cause of the error, I'll have to figure out what files to modify in order to fix this. (I'm a CMake kind of guy myself, but of course I didn't choose the build system for this project.) My OS is Debian.

最后,这个 makefile 是由 configure 生成的,所以一旦我们缩小了错误的原因,我就必须弄清楚要修改哪些文件才能解决这个问题。(我自己就是一个 CMake 类型的人,但我当然没有为这个项目选择构建系统。)我的操作系统是 Debian。

I've tried building this branch as well: https://github.com/kanzure/nanoengineer/branches/kirka-updates

我也试过建立这个分支:https: //github.com/kanzure/nanoengineer/branches/kirka-updates

If you can try getting this to build on your system, I would greatly appreciate it! Thanks!

如果您可以尝试将其构建在您的系统上,我将不胜感激!谢谢!

采纳答案by mdadm

After a fair amount of work, I was able to get it to build on Ubuntu 12.04 x86 and Debian 7.4 x86_64. I wrote up a guide below. Can you please try following it to see if it resolves the issue?

经过大量的工作,我能够让它在 Ubuntu 12.04 x86 和 Debian 7.4 x86_64 上构建。我在下面写了一个指南。您可以尝试关注它,看看它是否解决了问题?

If not please let me know where you get stuck.

如果没有,请让我知道你在哪里卡住了。

Install Common Dependencies

安装通用依赖

sudo apt-get install build-essential autoconf libtool pkg-config python-opengl python-imaging python-pyrex python-pyside.qtopengl idle-python2.7 qt4-dev-tools qt4-designer libqtgui4 libqtcore4 libqt4-xml libqt4-test libqt4-script libqt4-network libqt4-dbus python-qt4 python-qt4-gl libgle3 python-dev

Install NumArray 1.5.2

安装 NumArray 1.5.2

wget http://goo.gl/6gL0q3 -O numarray-1.5.2.tgz
tar xfvz numarray-1.5.2.tgz
cd numarray-1.5.2
sudo python setup.py install

Install Numeric 23.8

安装数字 23.8

wget http://goo.gl/PxaHFW -O numeric-23.8.tgz
tar xfvz numeric-23.8.tgz
cd Numeric-23.8
sudo python setup.py install

Install HDF5 1.6.5

安装 HDF5 1.6.5

wget ftp://ftp.hdfgroup.org/HDF5/releases/hdf5-1.6/hdf5-1.6.5.tar.gz
tar xfvz hdf5-1.6.5.tar.gz
cd hdf5-1.6.5
./configure --prefix=/usr/local
sudo make 
sudo make install

Install Nanoengineer

安装纳米工程师

git clone https://github.com/kanzure/nanoengineer.git
cd nanoengineer
./bootstrap
./configure
make
sudo make install

Troubleshooting

故障排除

On Debian Jessie, you will receive the error message that cant pants mentioned. There seems to be an issue in the automake scripts. x86_64-linux-gnu-gccis inserted in CFLAGSand gccwill interpret that as a name of one of the source files. As a workaround, let's create an empty file with that name. Empty so that it won't change the program and that very name so that compiler picks it up. From the cloned nanoengineer directory, run this command to make gcc happy (it is a hack yes, but it does work) ...

在 Debian Jessie 上,您将收到 cantpants 提到的错误消息。automake 脚本中似乎存在问题。x86_64-linux-gnu-gcc插入CFLAGSgcc会解释,作为一个源文件的名称。作为一种解决方法,让我们创建一个具有该名称的空文件。为空,以便它不会更改程序和名称,以便编译器选择它。从克隆的 nanoengineer 目录中,运行此命令以使 gcc 满意(这是一个 hack,是的,但它确实有效)...

touch sim/src/x86_64-linux-gnu-gcc

If you receive an error message when attemping to compile HDF5 along the lines of: "error: call to ‘__open_missing_mode' declared with attribute error: open with O_CREAT in second argument needs 3 arguments", then modify the file perform/zip_perf.c, line 548 to look like the following and then rerun make...

如果在尝试编译 HDF5 时收到错误消息:“错误:调用 '__open_missing_mode' 声明属性错误:在第二个参数中使用 O_CREAT 打开需要 3 个参数”,然后修改文件 perform/zip_perf.c,第 548 行如下所示,然后重新运行 make...

output = open(filename, O_RDWR | O_CREAT, S_IRUSR|S_IWUSR);

If you receive an error message about Numeric/arrayobject.h not being found when building Nanoengineer, try running

如果您在构建 Nanoengineer 时收到有关未找到 Numeric/arrayobject.h 的错误消息,请尝试运行

export CPPFLAGS=-I/usr/local/include/python2.7
./configure
make
sudo make install

If you receive an error message similar to "TRACE_PREFIX undeclared", modify the file sim/src/simhelp.c lines 38 to 41 to look like this and re-run make:

如果您收到类似于“TRACE_PREFIX undeclared”的错误消息,请修改文件 sim/src/simhelp.c 的第 38 至 41 行,使其看起来像这样并重新运行 make:

#ifdef DISTUTILS
static char tracePrefix[] = "";
#else
static char tracePrefix[] = "";

If you receive an error message when trying to launch NanoEngineer-1 that mentions something similar to "cannot import name GL_ARRAY_BUFFER_ARB", modify the lines in the following files

如果您在尝试启动 NanoEngineer-1 时收到一条错误消息,其中提到类似于“无法导入名称 GL_ARRAY_BUFFER_ARB”的内容,请修改以下文件中的行

/usr/local/bin/NanoEngineer1_0.9.2.app/program/graphics/drawing/setup_draw.py
/usr/local/bin/NanoEngineer1_0.9.2.app/program/graphics/drawing/GLPrimitiveBuffer.py
/usr/local/bin/NanoEngineer1_0.9.2.app/program/prototype/test_drawing.py

that look like this:

看起来像这样:

from OpenGL.GL import GL_ARRAY_BUFFER_ARB
from OpenGL.GL import GL_ELEMENT_ARRAY_BUFFER_ARB

to look like this:

看起来像这样:

from OpenGL.GL.ARB.vertex_buffer_object import GL_ARRAY_BUFFER_AR
from OpenGL.GL.ARB.vertex_buffer_object import GL_ELEMENT_ARRAY_BUFFER_ARB

I also found an additional troubleshooting text file that has been removed, but you can find it here

我还发现了一个已被删除的附加故障排除文本文件,但您可以在此处找到它

回答by stevek

apt-get install python-dev

...solved the problem for me.

...为我解决了这个问题。

回答by Liao Zhuodi

you just need:

您只需要:

sudo apt-get install gcc.

回答by Komu

sudo apt-get -y install python-software-properties && \
sudo apt-get -y install software-properties-common && \
sudo apt-get -y install gcc make build-essential libssl-dev libffi-dev python-dev

sudo apt-get -y install python-software-properties && \
sudo apt-get -y install software-properties-common && \
sudo apt-get -y install gcc make build-essential libssl-dev libffi-dev python-dev

You need the libssl-dev and libffi-dev if especially you are trying to install python's cryptography libraries or python libs that depend on it(eg ansible)

你需要 libssl-dev 和 libffi-dev 如果你特别想安装 python 的加密库或依赖它的 python 库(例如 ansible)

回答by StackUP

the error can be due to one of several missing package. Below command will install several packages like g++, gcc, etc.

该错误可能是由于几个丢失的包之一造成的。下面的命令将安装几个包,如 g++、gcc 等。

sudo apt-get install build-essential