sgerrand / alpine-pkg-glibc

A glibc compatibility layer package for Alpine Linux
2.05k stars 280 forks source link

mini_racer not working, __fprintf_chk: symbol not found #27

Closed Ehekatl closed 2 months ago

Ehekatl commented 8 years ago
LoadError: Error relocating /home/app/gems/gems/mini_racer-0.1.3/lib/mini_racer_extension.so: __fprintf_chk: symbol not found - /home/app/gems/gems/mini_racer-0.1.3/lib/mini_racer_extension.so
/home/app/gems/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:274:in `require'
/home/app/gems/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:274:in `block in require'
/home/app/gems/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:240:in `load_dependency'
/home/app/gems/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:274:in `require'
/home/app/gems/gems/mini_racer-0.1.3/lib/mini_racer.rb:2:in `<top (required)>'
/home/app/gems/gems/bundler-1.12.2/lib/bundler/runtime.rb:86:in `require'
/home/app/gems/gems/bundler-1.12.2/lib/bundler/runtime.rb:86:in `block (2 levels) in require'
/home/app/gems/gems/bundler-1.12.2/lib/bundler/runtime.rb:81:in `each'
/home/app/gems/gems/bundler-1.12.2/lib/bundler/runtime.rb:81:in `block in require'
/home/app/gems/gems/bundler-1.12.2/lib/bundler/runtime.rb:70:in `each'
/home/app/gems/gems/bundler-1.12.2/lib/bundler/runtime.rb:70:in `require'
/home/app/gems/gems/bundler-1.12.2/lib/bundler.rb:102:in `require'
/home/app/config/application.rb:11:in `<top (required)>'
/home/app/Rakefile:5:in `require'
/home/app/Rakefile:5:in `<top (required)>'

I'm using the latest version of glibc

sgerrand commented 8 years ago

The problem appears to be in the includes declared in mini_racer's ext/mini_racer_extension/mini_racer_extension.cc file which was fixed in https://github.com/discourse/mini_racer/commit/c9f141b58eac9ef293237bcda1c3929b2d3b5c6f.

sgerrand commented 8 years ago

Ah, ignore my previous comment. That relates to an issue I had installing the mini_racer gem to reproduce the issue.

sgerrand commented 8 years ago

I can only find one reference to fprintf in the mini_racer gem's ext/mini_racer_extension/mini_racer_extension.cc file. Have you tried recompiling the gem?

sgerrand commented 8 years ago

👋 @Ehekatl ☝️

fusillicode commented 8 years ago

Same problem here and it's kind of sad :( Because of this I can not build a react-on-rails app :(

3den commented 7 years ago

same problem

ggwzrd commented 7 years ago

I also have the same problem, is this issue solved?

mosheka commented 7 years ago

Same here :-(

mosheka commented 7 years ago

Same here :-( In the meantime another soluton by be using multistage builds, and do the assets precompile on ubuntu and copy the results to alpine

benoist commented 7 years ago

I'm also running in to this problem

Antiarchitect commented 7 years ago

Same for me.

ignisf commented 7 years ago

Hello all!

mini_racer depends on the libv8 gem which distributes a statically linked (against glibc) V8. At this point rubygems has no support for distributing binary gems that are linked against a specific standard library :(. I would really like to see this implemented there so I can release libv8 linked against musl.

Please take a look at these sections in libv8's README. I hope they're helpful for you:

https://github.com/cowboyd/libv8#use-with-different-standard-c-libraries

https://github.com/cowboyd/libv8#source-and-binary-releases

andreimc commented 6 years ago

Any work arounds for this ?

sgerrand commented 6 years ago

Not unless you can make the debugging symbols being referenced available to the runtime. Without those this will continue to happen.

andreimc commented 6 years ago

Is there a way to compile libv8 from source with the symbols?

ignisf commented 6 years ago

@andreimic, how exactly do you want to do that? Make Rubygems compile the gem from source or create a binary .gem file you can distribute?

ignisf commented 6 years ago

You can do both.

vraravam commented 6 years ago

I have the same problem. But, btw, would asset-precompilation on ubuntu, and copying to the main image (that uses alpine) work?

sgerrand commented 6 years ago

I have the same problem. But, btw, would asset-precompilation on ubuntu, and copying to the main image (that uses alpine) work?

It's worth trying. 👍

sgerrand commented 2 months ago

I'm so sorry for not responding to this bug report sooner. Without an example Dockerfile it's hard to know what's causing these segmentation faults. If you're still experiencing this problem then would you please reply with an example Dockerfile which reproduces the error.

I suggest that you and any other future readers in a situation like this consider running containers based on Docker images that are based on a GNU C library, rather than trying to run binaries which weren't compiled for musl inside Alpine Linux. As an example, Debian currently provide "slim" Docker images for each of their releases which are ~ 30 MB compressed.