V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
amiwrong123
V2EX  ›  程序员

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

  •  
  •   amiwrong123 · 26 天前 · 930 次点击

    我在使用 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'
    
    • 请问各位大佬,这是 make 的问题吗?
    • 还是说,make 的输出就是对的没有问题,但是我得自己 特殊处理一下 make 的输出,再给到 compiledb ?
    4 条回复    2024-08-25 10:45:19 +08:00
    julyclyde
        1
    julyclyde  
       26 天前
    Make 的输出大体上是给人类看的东西
    用文本内容做跨系统集成通常就会遇到你今天这种问题

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

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

    但问题还是没解决。。。
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   964 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 22ms · UTC 21:50 · PVG 05:50 · LAX 14:50 · JFK 17:50
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.