Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

implicit declaration of function 'thin_http_parser_init' is invalid in C99 #174

Closed
martinoz opened this issue Dec 21, 2020 · 8 comments
Closed
Milestone

Comments

@martinoz
Copy link

gem install smashing

Building native extensions. This could take a while...
ERROR: Error installing smashing:
ERROR: Failed to build gem native extension.

current directory: /usr/local/lib/ruby/gems/2.7.0/gems/thin-1.7.2/ext/thin_parser

/usr/local/opt/ruby/bin/ruby -I /usr/local/Cellar/ruby/2.7.2/lib/ruby/2.7.0 -r ./siteconf20201221-16646-1290i2o.rb extconf.rb
checking for main() in -lc... yes
creating Makefile

current directory: /usr/local/lib/ruby/gems/2.7.0/gems/thin-1.7.2/ext/thin_parser
make "DESTDIR=" clean

current directory: /usr/local/lib/ruby/gems/2.7.0/gems/thin-1.7.2/ext/thin_parser
make "DESTDIR="
compiling parser.c
parser.c:31:18: warning: unused variable 'http_parser_en_main' [-Wunused-const-variable]
static const int http_parser_en_main = 1;
^
1 warning generated.
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
VALUE Thin_HttpParser_execute(VALUE self, VALUE req_hash, VALUE data, VALUE start)
^
thin.c:338:8: error: implicit declaration of function 'thin_http_parser_has_error' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
if(thin_http_parser_has_error(http)) {
^
thin.c:338:8: note: did you mean 'http_parser_has_error'?
./parser.h:44:5: note: 'http_parser_has_error' declared here
int http_parser_has_error(http_parser *parser);
^
thin.c:359:10: error: implicit declaration of function 'thin_http_parser_has_error' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
return thin_http_parser_has_error(http) ? Qtrue : Qfalse;
^
thin.c:374: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;
^
9 errors generated.
make: *** [thin.o] Error 1

make failed, exit code 2

Gem files will remain installed in /usr/local/lib/ruby/gems/2.7.0/gems/thin-1.7.2 for inspection.
Results logged to /usr/local/lib/ruby/gems/2.7.0/extensions/x86_64-darwin-20/2.7.0/thin-1.7.2/gem_make.out

@TuxmAL
Copy link

TuxmAL commented Dec 21, 2020

It seems an error related to the "thin" gem (version 1.7.2)...

@martinoz
Copy link
Author

installed also 1.8.0, yet thin-1.7.2 is still getting used, any idea....

@TuxmAL
Copy link

TuxmAL commented Dec 21, 2020

You may try changing line 37 of gemspec file from
s.add_dependency('thin', '~> 1.7.2')
to
s.add_dependency('thin', '~> 1.8.0')
Then running bundle install again.

@JCluzet
Copy link

JCluzet commented Feb 21, 2021

same error for me :/

@JCluzet
Copy link

JCluzet commented Feb 21, 2021

I have found a solution that works for me:
sudo gem install thin -v '1.8.0' -n /usr/local/bin -- --with-cflags="-Wno-error=implicit-function-declaration" local/usr/bin then
sudo gem install smashing -n /usr/local/bin

@kinow
Copy link
Member

kinow commented Feb 21, 2021

Thanks @JCluzet ! I'll take a look at the linked issue, and try to understand the source of the problem. If it's something we can fix in Smashing so users don't need this, we can try to fix it and cut a release.

But if that's due to an issue with some of our dependencies, I'll add your workaround somewhere in our installation wiki and/or README.

Cheers!
Bruno

@quanganh
Copy link

quanganh commented May 2, 2021

solution that has worked for me was

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

@kinow
Copy link
Member

kinow commented May 4, 2021

Added the suggested workaround in the troubleshooting section of our Wiki: https://github.com/Smashing/smashing/wiki/Installation#troubleshooting

Thanks everyone!

@kinow kinow closed this as completed May 4, 2021
@kinow kinow added this to the 1.3.5 milestone May 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants