在Vagrant VM中从Python调用make

2024-04-19 10:36:08 发布

您现在位置:Python中文网/ 问答频道 /正文

好吧,这个问题是非常具体的项目,但对我来说是个问题。你知道吗

我有一个Python/django网站,由Vagrant安装的ubuntuvm在localhost上托管。从这个网站我想粘贴在C代码和编译它通过一系列的Python函数。在其中一个函数中,我这样调用make

arg2 = os.path.join(Default_SDK_PATH, "examples/peripheral/blinky")
arg4 = os.path.join(Default_SDK_PATH, "examples/peripheral/blinky/makefile")
args = ' '.join(['make', '-C', arg2, '-f', arg4])

p = subprocess.Popen(
    args,
    stdout=subprocess.PIPE,
    stderr=subprocess.STDOUT,
    shell=True
)
output, errors = p.communicate()
p.wait()

我为测试指定的arg2arg4比其他任何东西都多——这只是为了100%确保使用了正确的makefile。你知道吗

############

好的! 所以当子进程运行时,我的问题就来了。用make调用makefile,但失败。当我检查构建日志时,我可以看到错误消息arm-none-eabi-gcc: error: nano.specs: No such file or directory。你知道吗

当我第一次调用vagrant up一个名为引导.sh被称为。我已尝试向该文件添加新命令

sudo apt-get remove binutils-arm-none-eabi gcc-arm-none-eabi
sudo add-apt-repository ppa:terry.guo/gcc-arm-embedded
sudo apt-get update
sudo apt-get install gcc-arm-none-eabi=4.9.3.2015q1-0trusty13

卸载Ubuntu的原始GCC并安装最新的GCC工具链。也没有成功。我还尝试将整个文件结构返回到文件,只是为了检查有问题的文件是否存在,它们确实存在!你知道吗

有人能给我指出正确的方向吗? 提前谢谢。你知道吗


Tags: 文件nonegetmake网站sudoaptmakefile
1条回答
网友
1楼 · 发布于 2024-04-19 10:36:08

呜呜,我解决了!你知道吗

我不知道为什么,但是sudo apt-get remove binutils-arm-none-eabi gcc-arm-none-eabi似乎什么也做不了,所以当我试图安装新的GCC时,原始的GCC文件仍然存在。你知道吗

另外,新的GCC安装在/usr/bin,而旧的GCC有自己指定的文件夹。你知道吗

所以我编辑了Makefile,从/usr/bin获取arm-none-eabi-gcc-4.9.3,而不是旧的arm-none-eabi-gcc。{

相关问题 更多 >