如何在Numpy库上运行Facebook?
我想在Numpy库上运行以检测其弱点。当我运行以下命令时:
infer run -- gcc -c /numpy/numpy/numpy/core/src/multiarrayabstractdtypes.c
它会引发以下错误:
Capturing in make/cc mode...
abstractdtypes.c:5:10: fatal error: 'Python.h' file not found
#include <Python.h>
^~~~~~~~~~
1 error generated.
Error: the following clang command did not run successfully:
/opt/infer-linux64-v1.0.0/lib/infer/facebook-clang-plugins/clang/install/bin/clang-9
@/media/nimashiri/DATA/vsprojects/ICSE23/ml_repos_cloned/numpy/numpy/numpy/core/src/multiarray/infer-out/tmp/clang_command_.tmp.a9d22f.txt
++Contents of '/media/nimashiri/DATA/vsprojects/ICSE23/ml_repos_cloned/numpy/numpy/numpy/core/src/multiarray/infer-out/tmp/clang_command_.tmp.a9d22f.txt':
"-cc1" "-load"...
如何在具有特殊编译器(例如Numpy或Tensorflow)的项目中针对各个源文件运行。这些编译器不明确使用Make或Cmake。
谢谢。
I want to run Infer on numpy library to detect its weaknesses. When I run the following command:
infer run -- gcc -c /numpy/numpy/numpy/core/src/multiarrayabstractdtypes.c
it throws the following error:
Capturing in make/cc mode...
abstractdtypes.c:5:10: fatal error: 'Python.h' file not found
#include <Python.h>
^~~~~~~~~~
1 error generated.
Error: the following clang command did not run successfully:
/opt/infer-linux64-v1.0.0/lib/infer/facebook-clang-plugins/clang/install/bin/clang-9
@/media/nimashiri/DATA/vsprojects/ICSE23/ml_repos_cloned/numpy/numpy/numpy/core/src/multiarray/infer-out/tmp/clang_command_.tmp.a9d22f.txt
++Contents of '/media/nimashiri/DATA/vsprojects/ICSE23/ml_repos_cloned/numpy/numpy/numpy/core/src/multiarray/infer-out/tmp/clang_command_.tmp.a9d22f.txt':
"-cc1" "-load"...
How can I run infer against individual source files in project having special compilers, e.g. numpy or tensorflow. These compilers do not use make or cmake explicitly.
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我想出了如何做到这一点。这些是要遵循的步骤:
编译和构建项目,例如,当您想从源构建时,对于Numpy,您必须运行
python setup.py build_ext-inplace-inplace-place
。编译项目时,在终端中,您可以看到编译日志。您必须在编译日志中搜索编译命令。例如,当从源中编译numpy时,您可以看到类似的内容:
以前的命令是编译所需的标头文件的路径。请注意,以前的标头文件是
numpy/andural/src/distributions/logfactorial.c
。您必须使用某些解析器手动或自动找到相应的文件。在此步骤中,您需要运行
capture
命令如下:Analyaze
命令分析可能的错误,如下:I figured out how to do that. These are steps to follow:
Compile and build the project, e.g. for numpy when you want to build from source, you have to run
python setup.py build_ext --inplace
.When you compile the project, in the terminal, you can see the compilation log. You have to search for compilation commands in the compilation log. For example, when compiling numpy from source, you can see something like this:
The previous commands are path to header files needed for compilation. Please note that the previous header files are for
numpy/random/src/distributions/logfactorial.c
. You have to find the corresponding files either manually or automatically using some parsers.In this step, you need to run
capture
command as follows:analyze
command as follows: