为什么 make 输出 make: Entering directory 时,后面跟的路径的两边的字符不一样,是反引号和单引号?

26 天前
 amiwrong123

我在使用 compiledb 执行 make 的时候,我在使用 compiledb 执行 make 的时候会有类似这种错误提示( https://github.com/nickdiego/compiledb/issues/96 , 这个网页里面也提到了):

## Processing build commands from <fdopen>
Line 1: Failed to parse build command [Details: (<class 'bashlex.tokenizer.MatchedPairError'>) unexpected EOF while looking for matching '`' (position 78)]. Ignoring: 'make: Entering directory `/c/sw_package/sources/iot/hello/src''
New command: C:\tools\MinGW\bin\gcc.exe -IC:\tools\MinGW\i686-w64-mingw32\include hello.c -v --debug -o hello.exe
Line 3: Failed to parse build command [Details: (<class 'bashlex.tokenizer.MatchedPairError'>) unexpected EOF while looking for matching '`' (position 77)]. Ignoring: 'make: Leaving directory `/c/sw_package/sources/iot/hello/src''
## Loaded compilation database with 0 entries from compile_commands.json
## Writing compilation database with 0 entries to compile_commands.json
## Done.

很明显,compiledb 因为这个路径两边的字符不一样而报错了。进而导致生成的compile_commands.json是一个空文件。

我又单独执行了 make ,发现确实是这样的,就是 make 时,出现 make: Entering directory 时,那个路径的两边字符就是不一样的,分别是反引号和单引号。

make: Entering directory `/c/sw_package/sources/iot/hello/src'
932 次点击
所在节点    程序员
4 条回复
julyclyde
26 天前
Make 的输出大体上是给人类看的东西
用文本内容做跨系统集成通常就会遇到你今天这种问题

看看有没有可以越过命令行直接调底层库的方法,把通信手段从文本解析改为 API 调用,试试?
agagega
26 天前
vk42
26 天前
@agagega 这是英语国家普遍都有的习惯吧,LaTeX 里面一般也这样用
amiwrong123
25 天前
破案了,我自己 特殊处理了 make 的输出,替换反引号为单引号,再给到 compiledb 。生成的 compile_commands.json 还是一个空文件。

看来和这个路径字符没有关系。

但问题还是没解决。。。

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/1067538

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX