Linux: scripts/build-info.sh: 31: Syntax error: end of file unexpected (expecting “then“) 解决方案

问题描述

今天在尝试运行make指令时,make中间突然出现了

: not foundld-info.sh: 2: 
: not foundld-info.sh: 4: 
: not foundld-info.sh: 9: 
scripts/build-info.sh: 31: Syntax error: end of file unexpected (expecting "then")
make: *** [Makefile:682: common/build-info.cpp] Error 2

经查阅,该错误是因为在windows系统下使用git clone下载得到文件夹后,上传至linux系统中运行引起的。具体来说,是windows系统下和linux系统下文件结尾字符不一样(一个是CRLF一个是LF)引起的。

解决方案

在clone下来的文件夹下,执行

sudo apt install dos2unix

find -type f -print0 | xargs -0 dos2unix

# 如果想不改变某些文件
find -type f \
     -not -path "./<dir_to_exclude>/*" \
     -not -path "./<other_dir_to_exclude>/*" \
     -print0 | xargs -0 dos2unix

执行完之后再次运行make指令,完美解决。 

参考链接

https://github.com/ggerganov/llama.cpp/issues/2430 

windows - How can I make all line endings (EOLs) in all files in Visual Studio Code, Unix-like? - Stack Overflow

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值