Conversation
|
I'm guessing you have gcc15? Would you add a comment about what this is fixing, and maybe a link to https://bugs.ruby-lang.org/issues/21290 assuming that's the same issue? |
|
From RubyCrypto/ed25519#45, I wondered if the correct fix might be to use geoip2_c/ext/geoip2/extconf.rb Line 37 in e247959 I'm not able to reproduce the problem with gcc 15.1.1 on the fedora 42 docker image with ruby 3.4.2 though, so not sure I follow the issue properly. |
|
as far as i understand it isnt anything to do with gcc15, or fedora. Using bool without <stdbool.h> will compile only if: Relying on b is fragile, so the explicit #include <stdbool.h> is a portable fix |
|
Mm, ok - some more context here https://bugs.ruby-lang.org/issues/21340 Agree we ought to include stdbool where we're using |
|
-- aside -- i was going to edit the above comment -- but i'm a bit murkier on this -- the $CFLAGS << " -std=c99" won't ensure c99, so it's not very good. append_cflags("-std=gnu99") would, but is having a spefic requirement the right thing? |
Won't it? How come?
because of replacing c99 with gnu99, or the append_cflags, or are both needed?
A compiler that supports c99 is necessary to build ruby, so I don't think it's a bad thing if you need c99 to compile the gem. |
i dont think so, this whole thing started because my ruby was built with c89 and then 'mkmf' reuses those flags, so $CFLAGS << " -std=c99" gives you '-std=c89 -std=c99', which resolves to c89 |
hm. Presumably |
|
i believe it de-dupes - but that's only what i've read - (and if it's true) then in your build you would have had '-std=gnu17 -std=c99' resolved to c99, which i'm not sure is what you want |
I don't have any
I'm 99% sure it just appends, so long as that flag is valid. If I change extconf.rb to include: $CFLAGS << "-std=gnu99"
append_cflags(%w[-std=gnu99 -std=c99 -fPIC -fms-extensions -somebullshitflags])Then it invokes clang with: Which successfully compiles. I think the last flag takes precedence, but not sure. append_cflags sounds more sensible than blindly appending to $CFLAGS, but I can't reproduce the problems you're seeing so I'm reluctant to just change it for the sake of it. |
sorry, yers that's correct. i meant Clang defaults to gnu17. I might well be wrong about the de-duping, append_cflags seems less fragile than << |
https://bugs.ruby-lang.org/issues/21290
support 'CFLAGS=-std=gnu99' on ruby 3.4 and above (which removed #include <stdbool.h> from the ruby headers).
I think this is good practice, and if we are maintaining this gem we should probably add it.
It's also completely inadequate because so many gems are broken in this way and i think the real problem is that you have to build ruby with at least
CFLAGS=-std=gnu17
which.. i'm surprised.. given that i install an app just to build ruby for me.. but it doesnt seem to have an opinion on that