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

Verison 3.13.x crashes cmake - error in cache.c #689

Closed
RemcoVanDerVeen opened this issue Aug 10, 2021 · 14 comments
Closed

Verison 3.13.x crashes cmake - error in cache.c #689

RemcoVanDerVeen opened this issue Aug 10, 2021 · 14 comments

Comments

@RemcoVanDerVeen
Copy link

Updating oj to version 3.13.0 resulted in the following error in our deploy cycle. It was not solved by 3.13.1.
Here is the error log:

current directory: /usr/local/rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/oj-3.13.1/ext/oj
/usr/local/rbenv/versions/2.6.1/bin/ruby -I /usr/local/rbenv/versions/2.6.1/lib/ruby/site_ruby/2.6.0 -r ./siteconf20210810-49232-alhbhg.rb extconf.rb
>>>>> Creating Makefile for ruby version 2.6.1 on x86_64-linux <<<<<
checking for rb_time_timespec()... yes
checking for rb_ivar_count()... yes
checking for rb_ivar_foreach()... yes
checking for rb_gc_mark_movable()... no
checking for stpcpy()... yes
checking for pthread_mutex_init()... yes
checking for rb_enc_associate()... yes
checking for rb_ext_ractor_safe() in ruby.h... no
creating Makefile

current directory: /usr/local/rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/oj-3.13.1/ext/oj
make DESTDIR\= clean

current directory: /usr/local/rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/oj-3.13.1/ext/oj
make DESTDIR\=
compiling cache.c
cache.c: In function ‘rehash’:
cache.c:115:5: error: ‘for’ loop initial declarations are only allowed in C99 mode
     for (Slot *sp = c->slots; sp < end; sp++) {
     ^
cache.c:115:5: note: use option -std=c99 or -std=gnu99 to compile your code
cache.c: In function ‘cache_free’:
cache.c:133:5: error: ‘for’ loop initial declarations are only allowed in C99 mode
     for (uint32_t i = 0; i < c->size; i++) {
     ^
cache.c:135:9: error: ‘for’ loop initial declarations are only allowed in C99 mode
         for (Slot s = c->slots[i]; NULL != s; s = next) {
         ^
cache.c: In function ‘cache_mark’:
cache.c:146:9: error: ‘for’ loop initial declarations are only allowed in C99 mode
         for (uint32_t i = 0; i < c->size; i++) {
         ^
cache.c:147:13: error: ‘for’ loop initial declarations are only allowed in C99 mode
             for (Slot s = c->slots[i]; NULL != s; s = s->next) {
             ^
cache.c: At top level:
cc1: warning: unrecognized command line option "-Wno-tautological-compare" [enabled by default]
cc1: warning: unrecognized command line option "-Wno-self-assign" [enabled by default]
cc1: warning: unrecognized command line option "-Wno-parentheses-equality" [enabled by default]
cc1: warning: unrecognized command line option "-Wno-constant-logical-operand" [enabled by default]
cc1: warning: unrecognized command line option "-Wno-cast-function-type" [enabled by default]
make: *** [cache.o] Error 1

make failed, exit code 2
@ohler55
Copy link
Owner

ohler55 commented Aug 10, 2021

I suppose I'll have to continue to support old compilers. C99 is 22 years old at this point though. I'll get a fix in probably tomorrow.

@ohler55
Copy link
Owner

ohler55 commented Aug 11, 2021

Please try the c99 branch.

@ohler55
Copy link
Owner

ohler55 commented Aug 12, 2021

Can someone verify that the new c99 branch builds on a C99 compiler?

@andrepiske
Copy link
Contributor

andrepiske commented Aug 12, 2021

Can someone verify that the new c99 branch builds on a C99 compiler?

Got a few errors, made adjustments until it compiled. Changes are in #692

--

Actually, C99 works fine, it's about making it work on C90, no? :) (that's what I did in my linked pull request, unless I'm making a big confusion here)

@RemcoVanDerVeen
Copy link
Author

RemcoVanDerVeen commented Aug 12, 2021

Please try the c99 branch.

I tried it today, but the same error message occurs, unfortunately. I'm trying to find out which C-compiler I'm dealing with, perhaps that might help.

EDIT: The server that gives errors has the following gcc version installed: gcc (Ubuntu 4.8.4-2ubuntu1~14.04.4) 4.8.4.

@randyv12
Copy link

for a temp workaround, if anyone gets stuck and you are working on jenkins, you have the option to specify... something.. like this ...

bundle config build.oj --with-cflags="-std=gnu99 -Wno-error=implicit-function-declaration"

it seems like it builds on gnu99 for uh..
Ubuntu 4.8.4-2ubuntu1~14.04.4
:)

@ohler55
Copy link
Owner

ohler55 commented Aug 13, 2021

@RemcoVanDerVeen have you tried the c99 branch after the additional changed made by @andrepiske ?

@mathieujobin
Copy link

I am getting the same error on beanstalk, I will test with the c99 branch

  creating Makefile
  
  current directory: /var/app/ondeck/vendor/bundle/gems/oj-3.13.1/ext/oj
  make DESTDIR\= clean
  
  current directory: /var/app/ondeck/vendor/bundle/gems/oj-3.13.1/ext/oj
  make DESTDIR\=
  compiling cache.c
  cache.c: In function ‘rehash’:
  cache.c:115:5: error: ‘for’ loop initial declarations are only allowed in C99
  mode
       for (Slot *sp = c->slots; sp < end; sp++) {
       ^
  cache.c:115:5: note: use option -std=c99 or -std=gnu99 to compile your code
  cache.c: In function ‘cache_free’:
  cache.c:133:5: error: ‘for’ loop initial declarations are only allowed in C99
  mode
       for (uint32_t i = 0; i < c->size; i++) {
       ^
  cache.c:135:9: error: ‘for’ loop initial declarations are only allowed in C99
  mode
           for (Slot s = c->slots[i]; NULL != s; s = next) {
           ^
  cache.c: In function ‘cache_mark’:
  cache.c:146:9: error: ‘for’ loop initial declarations are only allowed in C99
  mode
           for (uint32_t i = 0; i < c->size; i++) {
           ^
  cache.c:147:13: error: ‘for’ loop initial declarations are only allowed in C99
  mode
               for (Slot s = c->slots[i]; NULL != s; s = s->next) {
               ^
  cache.c: At top level:
  cc1: warning: unrecognized command line option "-Wno-tautological-compare"
  [enabled by default]
  cc1: warning: unrecognized command line option "-Wno-self-assign" [enabled by
  default]
  cc1: warning: unrecognized command line option "-Wno-parentheses-equality"
  [enabled by default]
  cc1: warning: unrecognized command line option "-Wno-constant-logical-operand"
  [enabled by default]
  cc1: warning: unrecognized command line option "-Wno-cast-function-type"
  [enabled by default]
  make: *** [cache.o] Error 1
  
  make failed, exit code 2

  Gem files will remain installed in /var/app/ondeck/vendor/bundle/gems/oj-3.13.1

@mathieujobin
Copy link

I confirmed, my issue is fixed with c99 branch !

@ohler55
Copy link
Owner

ohler55 commented Aug 16, 2021

If no one else has this issue with the c99 branch I'll release tonight.

@RemcoVanDerVeen
Copy link
Author

I tried it today, and the issue is fixed with the new c99 branch!

@bheemreddy181-zz
Copy link

Waiting for a release

@ohler55
Copy link
Owner

ohler55 commented Aug 16, 2021

Released!

@ohler55
Copy link
Owner

ohler55 commented Aug 27, 2021

Closing as the people involved here seems to be satisfied.

@ohler55 ohler55 closed this as completed Aug 27, 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

6 participants