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

'Failed to compile' error at runtime when missing build environment #76

Closed
zarqman opened this issue Oct 2, 2024 · 2 comments
Closed
Assignees
Labels

Comments

@zarqman
Copy link

zarqman commented Oct 2, 2024

Seeing the error below on v1.5.2 in production (works fine in 1.4.5; haven't tried 1.5.[01]).

The affected app runs inside a docker container. That container is built using separate build and runtime images. In the somewhat common pattern, the build image includes gcc and friends, but the runtime image does not. Gems are installed using the build image, and all compiled artifacts copied over to the smaller runtime image.

The stack trace makes me think it's trying to compile at runtime instead of during the gem's install, which is a bit unexpected for a gem (assuming I'm interpreting it correctly). Thoughts?

/usr/local/bundle/gems/mkmf-lite-0.7.1/lib/mkmf/lite.rb:238:in `block in try_to_execute': Failed to compile source code with command 'gcc -lrt -ldl -lcrypt -lm  -o conftest.exe conftest.c': (RuntimeError)
===
#include <stdio.h>
#include <stdio.h>
#include <stdlib.h>
int conftest_const = (int)(sizeof(int));
int main(){
printf("%d\n", conftest_const);
return 0;
}
===
from /usr/local/bundle/gems/mkmf-lite-0.7.1/lib/mkmf/lite.rb:216:in `chdir'
from /usr/local/bundle/gems/mkmf-lite-0.7.1/lib/mkmf/lite.rb:216:in `try_to_execute'
from /usr/local/bundle/gems/mkmf-lite-0.7.1/lib/mkmf/lite.rb:166:in `check_sizeof'
from /usr/local/bundle/gems/memoist-0.16.2/lib/memoist.rb:213:in `check_sizeof'
from /usr/local/bundle/gems/sys-filesystem-1.5.2/lib/sys/unix/sys/filesystem/structs.rb:249:in `<class:Statvfs>'
from /usr/local/bundle/gems/sys-filesystem-1.5.2/lib/sys/unix/sys/filesystem/structs.rb:151:in `<module:Structs>'
from /usr/local/bundle/gems/sys-filesystem-1.5.2/lib/sys/unix/sys/filesystem/structs.rb:8:in `<class:Filesystem>'
from /usr/local/bundle/gems/sys-filesystem-1.5.2/lib/sys/unix/sys/filesystem/structs.rb:7:in `<module:Sys>'
from /usr/local/bundle/gems/sys-filesystem-1.5.2/lib/sys/unix/sys/filesystem/structs.rb:6:in `<top (required)>'
from /usr/local/bundle/gems/sys-filesystem-1.5.2/lib/sys/unix/sys/filesystem.rb:2:in `require_relative'
from /usr/local/bundle/gems/sys-filesystem-1.5.2/lib/sys/unix/sys/filesystem.rb:2:in `<top (required)>'
from /usr/local/bundle/gems/sys-filesystem-1.5.2/lib/sys/filesystem.rb:8:in `require_relative'
from /usr/local/bundle/gems/sys-filesystem-1.5.2/lib/sys/filesystem.rb:8:in `<top (required)>'
from <internal:/usr/local/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:136:in `require'
from <internal:/usr/local/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:136:in `require'
@djberg96
Copy link
Owner

djberg96 commented Oct 3, 2024

You should be able to use 1.5.1. There was a recent change in 1.5.2 where I was trying to cope yet another 32 vs 64 bit issue. You can see it at #73, with original discussion at #71.

I wondered if this would cause issues. Ideas welcome.

@djberg96
Copy link
Owner

djberg96 commented Oct 4, 2024

@zarqman I've reverted the change that added it as a runtime dependency, and that change is reflected in 1.5.3.

@djberg96 djberg96 closed this as completed Oct 4, 2024
@djberg96 djberg96 self-assigned this Oct 4, 2024
@djberg96 djberg96 added the Misc label Oct 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants