美文网首页
解决 error: implicit declaration o

解决 error: implicit declaration o

作者: 前端技术小咖 | 来源:发表于2020-10-21 20:17 被阅读0次

    今天在安装zat软件的时候遇到问题ruby运行环境中的thin_parser扩展库报错的问题,错误信息如下:

    Building native extensions. This could take a while...
    ERROR:  Error installing zendesk_apps_tools:
        ERROR: Failed to build gem native extension.
    
        current directory: /Library/Ruby/Gems/2.6.0/gems/thin-1.7.2/ext/thin_parser
    /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby -I /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0 -r ./siteconf20201021-92246-lmkt32.rb extconf.rb
    checking for main() in -lc... yes
    creating Makefile
    
    current directory: /Library/Ruby/Gems/2.6.0/gems/thin-1.7.2/ext/thin_parser
    make "DESTDIR=" clean
    
    current directory: /Library/Ruby/Gems/2.6.0/gems/thin-1.7.2/ext/thin_parser
    make "DESTDIR="
    compiling parser.c
    compiling thin.c
    thin.c:242:3: error: implicit declaration of function 'thin_http_parser_init' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
      thin_http_parser_init(hp);
      ^
    thin.c:242:3: note: did you mean 'http_parser_init'?
    ./parser.h:41:5: note: 'http_parser_init' declared here
    int http_parser_init(http_parser *parser);
        ^
    thin.c:260:3: error: implicit declaration of function 'thin_http_parser_init' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
      thin_http_parser_init(http);
      ^
    thin.c:277:3: error: implicit declaration of function 'thin_http_parser_init' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
      thin_http_parser_init(http);
      ^
    thin.c:294:3: error: implicit declaration of function 'thin_http_parser_finish' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
      thin_http_parser_finish(http);
      ^
    thin.c:294:3: note: did you mean 'Thin_HttpParser_finish'?
    thin.c:290:7: note: 'Thin_HttpParser_finish' declared here
    VALUE Thin_HttpParser_finish(VALUE self)
          ^
    thin.c:296:10: error: implicit declaration of function 'thin_http_parser_is_finished' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
      return thin_http_parser_is_finished(http) ? Qtrue : Qfalse;
             ^
    thin.c:334:5: error: implicit declaration of function 'thin_http_parser_execute' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
        thin_http_parser_execute(http, dptr, dlen, from);
        ^
    thin.c:334:5: note: did you mean 'Thin_HttpParser_execute'?
    thin.c:317:7: note: 'Thin_HttpParser_execute' declared here
    

    解决方案:

    在命令行执行以下命令即可:

    gem install thin -- --with-cflags="-Wno-error=implicit-function-declaration"
    

    如果遇到权限错误(例如:You don't have write permissions for the *),则使用以下命令:

    sudo gem install thin -- --with-cflags="-Wno-error=implicit-function-declaration"
    

    问题原因:

    有可能是XCode的更新版本的原因,XCode新版本将某些编译时问题的错误等级提升了。

    如果这个方案解决了您的问题,别忘了点赞♥️,让其他同学也知道这个正确的方法。
    另外大家在开发的过程中遇到其他问题,也欢迎在留言区留言交流

    参考链接:
    1. https://develop.zendesk.com/hc/en-us/community/posts/360051859693-ERROR-to-install-zendesk-apps-tools

    相关文章

      网友评论

          本文标题:解决 error: implicit declaration o

          本文链接:https://www.haomeiwen.com/subject/wfiemktx.html