Skip to content

Remove std compile flag - #28

Closed
fcortes wants to merge 1 commit into
cabo:masterfrom
fcortes:remove-explicit-cstd-compile-flag
Closed

fcortes wants to merge 1 commit into
cabo:masterfrom
fcortes:remove-explicit-cstd-compile-flag

Conversation

@fcortes

@fcortes fcortes commented Jul 6, 2025

Copy link
Copy Markdown

Fixes #27

GCC 15 was released on April and is starting to be rolled into distros package managers. For some reason the extension compilation fails when used with GCC 15 with some type errors (I suspect some import path rule changed as inspecting the files do show the types correctly imported).

It is exactly the same as this bug reported on Fedora 42 and seems to be related to this GCC regresion bug but I'm not 100% sure as they talk about some errors coming up when LTOs are enabled (which I'm not sure whether they are or not enabled). May also be related to this other bug but they report that GCC 15 defaults to C23 and that makes extension builds fail.

Anyways, removing the flag and letting gcc use its default value seems to work fine for GCC14 and GCC15

@fcortes
fcortes marked this pull request as draft July 6, 2025 02:43
@fcortes

fcortes commented Jul 6, 2025 •

Copy link
Copy Markdown
Author

Set as draft as after some experimentation I could reliable replicate it with docker. On my machine the gcc version installed is 15.1.1 but GCC releases and repositories only go up to 15.1.0. The patch seems to come from arch but haven't found the source yet.

I was trying to test different combinations of GCC and ruby version with this:

# Dockerfile

ARG GCC_VERSION=14
ARG RUBY_VERSION=3.4.4

FROM ruby:${RUBY_VERSION} AS ruby-source
FROM gcc:${GCC_VERSION}

COPY --from=ruby-source /usr/local /usr/local

# Update shared library cache
RUN ldconfig

# Install runtime dependencies
RUN apt update && \
    apt install -y libssl3 libreadline8 zlib1g libffi8 libyaml-0-2 \
    build-essential

WORKDIR /app
COPY . /app

RUN bundle install

CMD ["rake", "compile"]

And trying combinations of GCC and ruby versions with

docker build \
  --build-arg GCC_VERSION=15.1.0 \
  --build-arg RUBY_VERSION=3.4.4 \
  -t cbor-ruby .

docker run --rm cbor-ruby

Version is 15.1.1 is not (yet) available in the official GCC docker images

@stanhu

stanhu commented Jul 23, 2025 •

Copy link
Copy Markdown
Contributor

#29 is an alternative approach.

@cabo

cabo commented Aug 2, 2025

Copy link
Copy Markdown
Owner

Underlying issue #27 is fixed by #29 now.

@cabo cabo closed this Aug 2, 2025
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

Successfully merging this pull request may close these issues.

Gem not compatible with gcc 15

3 participants