最近在移植uboot支持nandflash的过程中,我遇到了一个错误,困扰了我两天。经过仔细查找,终于找到了问题所在。以下是具体的错误信息:
make[1]: *** No rule to make target '.depend.s3c2440_nand', needed by '.depend'. Stop. make[1]: Leaving directory '/work/system/u-boot-2012.04.01/drivers/mtd/nand' Makefile:485: recipe for target 'drivers/mtd/nand/libnand.o' failed make: *** [drivers/mtd/nand/libnand.o] Error 2
这个错误大致意思是在链接libnand.o时找不到s3c2440_nand的依赖文件。接着,我仔细检查了Makefile,确保已经在Makefile中添加了s3c2440_nand.c的依赖文件,如图所示:
![make[1]: *** No rule to make target ‘.depend.XXXX‘, needed by ‘.XX‘. Stop.解决](https://img.php.cn/upload/article/001/503/042/175867368657369.jpg)
然后,我考虑是否是代码编写错误。对照自己修改的部分如下:
![make[1]: *** No rule to make target ‘.depend.XXXX‘, needed by ‘.XX‘. Stop.解决](https://img.php.cn/upload/article/001/503/042/175867368693639.jpg)
![make[1]: *** No rule to make target ‘.depend.XXXX‘, needed by ‘.XX‘. Stop.解决](https://img.php.cn/upload/article/001/503/042/175867368755727.jpg)
![make[1]: *** No rule to make target ‘.depend.XXXX‘, needed by ‘.XX‘. Stop.解决](https://img.php.cn/upload/article/001/503/042/175867368748429.jpg)
![make[1]: *** No rule to make target ‘.depend.XXXX‘, needed by ‘.XX‘. Stop.解决](https://img.php.cn/upload/article/001/503/042/175867368712216.jpg)
![make[1]: *** No rule to make target ‘.depend.XXXX‘, needed by ‘.XX‘. Stop.解决](https://img.php.cn/upload/article/001/503/042/175867368851503.jpg)
经过多次检查,发现代码并没有错误。宏开关也都已打开,初始化、内存、寄存器等都已配置。如果是代码错误,编译不应该报这样的错误。通过Google查找了一些文章,解决方法各不相同,但问题都出在Makefile上。最后确定是Makefile的问题,可能是我没有发现。以下是参考的文章:
仔细检查s3c2440_nand.c的文件名,也确认没有写错。
![make[1]: *** No rule to make target ‘.depend.XXXX‘, needed by ‘.XX‘. Stop.解决](https://img.php.cn/upload/article/001/503/042/175867368898392.jpg)
![make[1]: *** No rule to make target ‘.depend.XXXX‘, needed by ‘.XX‘. Stop.解决](https://img.php.cn/upload/article/001/503/042/175867368810227.jpg)
接着,我重新复制Windows下的文件名到Makefile中,更改.o依赖的名字,发现多了一个空格。
![make[1]: *** No rule to make target ‘.depend.XXXX‘, needed by ‘.XX‘. Stop.解决](https://img.php.cn/upload/article/001/503/042/175867368916900.jpg)
第一次修改时,我没有注意到这个空格,所以我将其删除了。今天才发现这里有问题,接着删除了Windows下的文件和Ubuntu下Makefile中的空格符号,编译就通过了。
![make[1]: *** No rule to make target ‘.depend.XXXX‘, needed by ‘.XX‘. Stop.解决](https://img.php.cn/upload/article/001/503/042/175867368963129.jpg)
真是太大意了。这个错误困扰了我两天。第一天我仔细检查了代码,Google查找资料,但没有解决。今天再次拿出来看,才发现了这个错误。有时候错误并不能一眼看出来。换个时间再回来看,或许会有不一样的结果!
以上就是make[1]: *** No rule to make target ‘.depend.XXXX‘, needed by ‘.XX‘. Stop.解决的详细内容,更多请关注php中文网其它相关文章!
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号