GVKun编程网logo

Cython:“致命错误:numpy/arrayobject.h:没有这样的文件或目录”(gcc编译出现:致命错误,没有输入文件)

7

本文的目的是介绍Cython:“致命错误:numpy/arrayobject.h:没有这样的文件或目录”的详细情况,特别关注gcc编译出现:致命错误,没有输入文件的相关信息。我们将通过专业的研究、有关

本文的目的是介绍Cython:“致命错误:numpy/arrayobject.h:没有这样的文件或目录”的详细情况,特别关注gcc编译出现:致命错误,没有输入文件的相关信息。我们将通过专业的研究、有关数据的分析等多种方式,为您呈现一个全面的了解Cython:“致命错误:numpy/arrayobject.h:没有这样的文件或目录”的机会,同时也不会遗漏关于arm-linux-gnu-gcc致命错误:stdio.h:没有这样的文件或目录、asm / errno.h:没有这样的文件或目录、Bash on cygwin:没有这样的文件或目录、build – 致命错误:vector:没有这样的文件或目录的知识。

本文目录一览:

Cython:“致命错误:numpy/arrayobject.h:没有这样的文件或目录”(gcc编译出现:致命错误,没有输入文件)

Cython:“致命错误:numpy/arrayobject.h:没有这样的文件或目录”(gcc编译出现:致命错误,没有输入文件)

我正在尝试使用
Cython加快这里的答案。我尝试编译代码(在完成此处cygwinccompiler.py解释的 hack之后),但出现错误。谁能告诉我这是我的代码有问题,还是
Cython 有一些深奥的微妙之处?fatal error: numpy/arrayobject.h: No such file ordirectory...compilation terminated

下面是我的代码。

import numpy as npimport scipy as spcimport numpy as npcimport cythoncdef inline np.ndarray[np.int, ndim=1] fbincount(np.ndarray[np.int_t, ndim=1] x):    cdef int m = np.amax(x)+1    cdef int n = x.size    cdef unsigned int i    cdef np.ndarray[np.int_t, ndim=1] c = np.zeros(m, dtype=np.int)    for i in xrange(n):        c[<unsigned int>x[i]] += 1    return ccdef packed struct Point:    np.float64_t f0, f1@cython.boundscheck(False)def sparsemaker(np.ndarray[np.float_t, ndim=2] X not None,                np.ndarray[np.float_t, ndim=2] Y not None,                np.ndarray[np.float_t, ndim=2] Z not None):    cdef np.ndarray[np.float64_t, ndim=1] counts, factor    cdef np.ndarray[np.int_t, ndim=1] row, col, repeats    cdef np.ndarray[Point] indices    cdef int x_, y_    _, row = np.unique(X, return_inverse=True); x_ = _.size    _, col = np.unique(Y, return_inverse=True); y_ = _.size    indices = np.rec.fromarrays([row,col])    _, repeats = np.unique(indices, return_inverse=True)    counts = 1. / fbincount(repeats)    Z.flat *= counts.take(repeats)    return sp.sparse.csr_matrix((Z.flat,(row,col)), shape=(x_, y_)).toarray()

答案1

小编典典

在你的setup.pyExtension应该有说法include_dirs=[numpy.get_include()]

此外,您的代码中缺少np.import_array()您的代码。

--

示例 setup.py:

from distutils.core import setup, Extensionfrom Cython.Build import cythonizeimport numpysetup(    ext_modules=[        Extension("my_module", ["my_module.c"],                  include_dirs=[numpy.get_include()]),    ],)# Or, if you use cythonize() to make the ext_modules list,# include_dirs can be passed to setup()setup(    ext_modules=cythonize("my_module.pyx"),    include_dirs=[numpy.get_include()])

arm-linux-gnu-gcc致命错误:stdio.h:没有这样的文件或目录

arm-linux-gnu-gcc致命错误:stdio.h:没有这样的文件或目录

这些是/ usr / bin中的文件

[root@xilinx bin]# ls -ld arm*-rwxr-xr-x. 1 root root  691752 Feb  5  2013 arm-linux-gnu-addr2line-rwxr-xr-x. 1 root root  721416 Feb  5  2013 arm-linux-gnu-ar-rwxr-xr-x. 1 root root 1297632 Feb  5  2013 arm-linux-gnu-as-rwxr-xr-x. 1 root root  689168 Feb  5  2013 arm-linux-gnu-c++filt-rwxr-xr-x. 1 root root  545664 Feb  6  2013 arm-linux-gnu-cpp-rwxr-xr-x. 1 root root   34176 Feb  5  2013 arm-linux-gnu-elfedit-rwxr-xr-x. 1 root root  544624 Feb  6  2013 arm-linux-gnu-gcc-rwxr-xr-x. 1 root root  214400 Feb  6  2013 arm-linux-gnu-gcov-rwxr-xr-x. 1 root root  760640 Feb  5  2013 arm-linux-gnu-gprof-rwxr-xr-x. 2 root root 1177528 Feb  5  2013 arm-linux-gnu-ld-rwxr-xr-x. 2 root root 1177528 Feb  5  2013 arm-linux-gnu-ld.bfd-rwxr-xr-x. 1 root root  704672 Feb  5  2013 arm-linux-gnu-nm-rwxr-xr-x. 1 root root  875456 Feb  5  2013 arm-linux-gnu-objcopy-rwxr-xr-x. 1 root root 1096992 Feb  5  2013 arm-linux-gnu-objdump-rwxr-xr-x. 1 root root  721456 Feb  5  2013 arm-linux-gnu-ranlib-rwxr-xr-x. 1 root root  389040 Feb  5  2013 arm-linux-gnu-readelf-rwxr-xr-x. 1 root root  693608 Feb  5  2013 arm-linux-gnu-size-rwxr-xr-x. 1 root root  691648 Feb  5  2013 arm-linux-gnu-strings-rwxr-xr-x. 1 root root  875456 Feb  5  2013 arm-linux-gnu-strip

我正在按照本教程交叉编译一个简单的C程序:

/* myinit.c * Build instructions: * ${CROSS_COMPILE}gcc -static init.c -o init * */#include <stdio.h>intmain (){    printf ("\n");    printf ("Hello world from %s!\n", __FILE__);    while (1) { }    return 0;}

现在,我将其保存为.c文件,并尝试对其进行编译;

[root@xilinx Xilinx-ZC702-14.7]# arm-linux-gnu-gcc myinit.c myinit.c:6:19: fatal error: stdio.h: No such file or directorycompilation terminated.

仅当我使用arm-linux-gnu-gcc时,这才令人发指。

但是当我使用gcc时,它工作正常。

为什么arm-linux *会出现此错误?

更新资料

[root@xilinx Xilinx-ZC702-14.7]# arm-linux-gnu-cpp -Wp,-vignoring nonexistent directory "/usr/lib/gcc/arm-linux-gnueabi/4.7.2/../../../../arm-linux-gnueabi/sys-include"ignoring nonexistent directory "/usr/lib/gcc/arm-linux-gnueabi/4.7.2/../../../../arm-linux-gnueabi/include"#include "..." search starts here:#include <...> search starts here: /usr/lib/gcc/arm-linux-gnueabi/4.7.2/include /usr/lib/gcc/arm-linux-gnueabi/4.7.2/include-fixedEnd of search list.

详细

[root@xilinx Xilinx-ZC702-14.7]# arm-linux-gnu-gcc -v myinit.c Using built-in specs.COLLECT_GCC=arm-linux-gnu-gccCOLLECT_LTO_WRAPPER=/usr/libexec/gcc/arm-linux-gnueabi/4.7.2/lto-wrapperTarget: arm-linux-gnueabiConfigured with: ../gcc-4.7.2-20121114-aarch64/configure --disable-dependency-tracking --disable-silent-rules --prefix=/usr --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --sysconfdir=/etc --datadir=/usr/share --includedir=/usr/include --libexecdir=/usr/libexec --localstatedir=/var --sharedstatedir=/var/lib --mandir=/usr/share/man --infodir=/usr/share/info --build=x86_64-redhat-linux-gnu --host=x86_64-redhat-linux-gnu --target=arm-linux-gnueabi --enable-targets=all --program-prefix=arm-linux-gnu- --enable-languages=c --with-newlib --without-headers --disable-sjlj-exceptions --with-system-libunwind --disable-nls --disable-threads --disable-shared --disable-libmudflap --disable-libssp --disable-libgomp --disable-libquadmath --disable-gold --disable-decimal-float --enable-checking= --enable-gnu-unique-object --enable-linker-build-id --disable-plugin --enable-nls --with-system-zlib --with-bugurl=http://bugzilla.redhat.com/bugzilla/ --enable-obsoleteThread model: singlegcc version 4.7.2 20121105 (Red Hat 4.7.2-2.aa.20121114svn) (GCC) COLLECT_GCC_OPTIONS=''-v'' ''-mtls-dialect=gnu'' /usr/libexec/gcc/arm-linux-gnueabi/4.7.2/cc1 -quiet -v myinit.c -quiet -dumpbase myinit.c -mtls-dialect=gnu -auxbase myinit -version -o /tmp/ccZNNlzj.sGNU C (GCC) version 4.7.2 20121105 (Red Hat 4.7.2-2.aa.20121114svn) (arm-linux-gnueabi)    compiled by GNU C version 4.4.6 20120305 (Red Hat 4.4.6-4), GMP version 4.3.1, MPFR version 2.4.1, MPC version 0.8GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072ignoring nonexistent directory "/usr/lib/gcc/arm-linux-gnueabi/4.7.2/../../../../arm-linux-gnueabi/sys-include"ignoring nonexistent directory "/usr/lib/gcc/arm-linux-gnueabi/4.7.2/../../../../arm-linux-gnueabi/include"#include "..." search starts here:#include <...> search starts here: /usr/lib/gcc/arm-linux-gnueabi/4.7.2/include /usr/lib/gcc/arm-linux-gnueabi/4.7.2/include-fixedEnd of search list.GNU C (GCC) version 4.7.2 20121105 (Red Hat 4.7.2-2.aa.20121114svn) (arm-linux-gnueabi)    compiled by GNU C version 4.4.6 20120305 (Red Hat 4.4.6-4), GMP version 4.3.1, MPFR version 2.4.1, MPC version 0.8GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072Compiler executable checksum: a19a7c6897fa348d9d5b59c718fa0648myinit.c:6:19: fatal error: stdio.h: No such file or directorycompilation terminated.

主机配置

Redhat 6,64位

答案1

小编典典

看来,这里的问题是您为目标安装了编译器工具链,但没有为目标安装标准库。您需要专门为目标平台编译的标准C库。您可以在找到编译器工具链的同一位置找到一个预编译器,或者下载一个并使用目标工具链进行交叉编译。

当您拥有目标的标准C库时,请使用标志-I(大写的i)告诉编译器在哪里可以找到头文件,并使用-L标志告诉链接器在哪里可以找到库,例如-lc(这是较低的-
情况L)告诉链接器与库链接。就像是

$ arm-linux-gnu-gcc -I/usr/local/target/include myinit.c -L/usr/local/target/lib -lc

asm / errno.h:没有这样的文件或目录

asm / errno.h:没有这样的文件或目录

在构buildgcc的时候,我得到这个错误:

In file included from /usr/include/bits/errno.h:25,from /usr/include/errno.h:36,from ../.././gcc/tsystem.h:96,from ../.././gcc/crtstuff.c:68: /usr/include/linux/errno.h:4:23: error: asm/errno.h: No such file or directory make[2]: *** [crtbegin.o] Error 1 make[2]: Leaving directory `/opt/gcc-4.1.2/host-x86_64-unkNown-linux-gnu/gcc'

我从源代码构buildgcc 4.1。 我想我必须安装build-essential 。 然而,在Ubuntu 12.04中安装该软件包将自动下载并安装gcc 4.6,我不想这样做。

有没有其他的方法?

使用dlsym()在静态链接库中查找variables

gcc链接选项来查看为什么一些目标文件被链接到二进制文件

如何将单个头文件应用到C项目的其余部分,以便不再需要它?

_BitScanForward64在Windows上使用MinGW

在Linux x86上调用backtrace()时出现分段错误

如何在Linux上与.la库文件链接

使用RPATH而不是RUNPATH?

为什么inttypes在BSS段占用8个字节,而在DATA段占用4个字节

如何正确设置CMakeLists.txt文件?

GCC在64位平台上的基本堆使用统计

我想你想要的软件包是linux-libc-dev 。 我在32上建立64时遇到了这个问题; 所以我需要linux-libc-dev:i386 。

这对我工作:

ln -s /usr/include/asm-generic /usr/include/asm

这对我工作:

sudo ln -s /usr/include/asm-generic /usr/include/asm

原因在于GCC希望被称为/usr/include/asm在某些发行版中被重命名为/usr/include/asm-generic 。

/usr/include/asm/errno.h是linux头文件的一部分。 我不能直接对Ubuntu 12.04说话,但一般来说,你可以下载Linux源码作为你的发行包,它不应该要求你下载/安装gcc。 如果不这样做,你可以手动下载你的内核版本的linux头文件( uname -a ),并使用include指令来CFLAGS指定目录来查找这些目录。

编辑: sudo apt-get install linux-headers-generic可能适合你。

您缺少部分开发包。 我不知道Ubuntu,但你应该可以问它的包管理系统来安装包含/usr/include/asm/errno.h的包。

不要从系统的某个地方(或者更糟糕的情况下,从其他地方)复制一些类似的文件。 缺少文件可能意味着某些软件包已损坏; 再次,要求你的软件包管理器检查一切,并(重新)安装缺失/碎片。

除非你正在运行一些LTS版本,升级。 你的Ubuntu有两岁了,也就是古代。

当我们在这个时候,为什么在这个美丽的星球上,你在建造一个如此古老的编译器? 目前GCC刚刚发布4.9.0,4.7之前的任何东西都是古老的历史,不再支持。

如果你能找到:

usr/include/asm-generic/errno.h

通过执行:

find /usr/include -name errno.h

然后尝试执行:

cp --archive /usr/include/asm-generic /usr/include/asm

它可以解决这个问题。

我在编译Asterisk 1.8.24.0时遇到了这个问题,并解决了这个问题:

mkdir /usr/include/asm-generic cp /usr/include/asm/errno-base.h /usr/include/asm-generic/

不知道这是不是“正确的方式”,但我已阅读上面的意见,并给了我这个想法…,它的工作:)

Bash on cygwin:没有这样的文件或目录

Bash on cygwin:没有这样的文件或目录

commonMongo=s:/programs/mongodb/
dbpath=$commonMongo"data/"
logFile=$commonMongo"log.txt"
mongoprog=s:/programs/mongodb/mongodb/
mongoBin=$mongoprog"bin/"
mongod=$mongoBin"mongod.exe"
a=$1
if [ "$a" == "start" ];then
    "${mongod} --logpath ${logFile} --logappend --dbpath ${dbpath} &"
elif [ "$a" == "repair" ];then
    "${mongod} --dbpath ${dbpath} --repair"
else
    echo "Incorrect usage"
fi

./init.sh:line 11:s:/programs/mongodb/mongodb/bin/mongod.exe –dbpath s:/ programs / mongodb / data / –repair:没有这样的文件或目录

调用打印的命令工作正常:

s:/programs/mongodb/mongodb/bin/mongod.exe –dbpath s:/ programs / mongodb / data / –repair

解决方法

例如,如果你把DOS路径放在引号中,Cygwin实际上会为你做魔术

cd "C:\Program Files\"

build – 致命错误:vector:没有这样的文件或目录

build – 致命错误:vector:没有这样的文件或目录

我有一个 Android项目,包含很多C语言的本机代码.但是,我无法构建我的库,因为它无法找到vector.h头文件.可能是什么问题 ?
几乎所有页面中都包含了我的内容.
#include <jni.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <vector>

编译器能够在每个文件中找出除vector.h之外的所有其他头文件.关于我哪里出错的任何建议?

注意:文件名以.cpp结尾,我已经尝试过#include< vector.h>,#include“vector.h”

谢谢 !

解决方法

最后通过在项目的JNI文件夹中创建Application.mk并向其添加以下内容来解决该问题: –
APP_STL := stlport_static

有关更多详细信息,请参阅SO上的this问题

关于Cython:“致命错误:numpy/arrayobject.h:没有这样的文件或目录”gcc编译出现:致命错误,没有输入文件的问题就给大家分享到这里,感谢你花时间阅读本站内容,更多关于arm-linux-gnu-gcc致命错误:stdio.h:没有这样的文件或目录、asm / errno.h:没有这样的文件或目录、Bash on cygwin:没有这样的文件或目录、build – 致命错误:vector:没有这样的文件或目录等相关知识的信息别忘了在本站进行查找喔。

本文标签: