commonmarker: Building in Docker fails for alpine/musl
129.3 error: cannot produce cdylib for `commonmarker v1.0.0
129.3 (/usr/local/bundle/gems/commonmarker-1.0.4/ext/commonmarker)` as the target
129.3 `x86_64-unknown-linux-musl` does not support these crate types
129.3 make: *** [Makefile:566: target/release/libcommonmarker.so] Error 101
129.3
129.3 make failed, exit code 2
129.3
129.3 Gem files will remain installed in /usr/local/bundle/gems/commonmarker-1.0.4 for
129.3 inspection.
129.3 Results logged to
129.3 /usr/local/bundle/extensions/x86_64-linux-musl/3.3.0/commonmarker-1.0.4/gem_make.out
129.3
129.3 /usr/local/lib/ruby/3.3.0/rubygems/ext/builder.rb:125:in `run'
129.3 /usr/local/lib/ruby/3.3.0/rubygems/ext/builder.rb:51:in `block in make'
129.3 /usr/local/lib/ruby/3.3.0/rubygems/ext/builder.rb:43:in `each'
129.3 /usr/local/lib/ruby/3.3.0/rubygems/ext/builder.rb:43:in `make'
129.3 /usr/local/lib/ruby/3.3.0/rubygems/ext/ext_conf_builder.rb:42:in `build'
129.3 /usr/local/lib/ruby/3.3.0/rubygems/ext/builder.rb:193:in `build_extension'
129.3 /usr/local/lib/ruby/3.3.0/rubygems/ext/builder.rb:227:in `block in
129.3 build_extensions'
129.3 /usr/local/lib/ruby/3.3.0/rubygems/ext/builder.rb:224:in `each'
129.3 /usr/local/lib/ruby/3.3.0/rubygems/ext/builder.rb:224:in `build_extensions'
129.3 /usr/local/lib/ruby/3.3.0/rubygems/installer.rb:852:in `build_extensions'
129.3 /usr/local/bundle/gems/bundler-2.5.4/lib/bundler/rubygems_gem_installer.rb:76:in
129.3 `build_extensions'
129.3 /usr/local/bundle/gems/bundler-2.5.4/lib/bundler/rubygems_gem_installer.rb:28:in
129.3 `install'
129.3 /usr/local/bundle/gems/bundler-2.5.4/lib/bundler/source/rubygems.rb:205:in
129.3 `install'
129.3 /usr/local/bundle/gems/bundler-2.5.4/lib/bundler/installer/gem_installer.rb:54:in
129.3 `install'
129.3 /usr/local/bundle/gems/bundler-2.5.4/lib/bundler/installer/gem_installer.rb:16:in
129.3 `install_from_spec'
129.3 /usr/local/bundle/gems/bundler-2.5.4/lib/bundler/installer/parallel_installer.rb:132:in
129.3 `do_install'
129.3 /usr/local/bundle/gems/bundler-2.5.4/lib/bundler/installer/parallel_installer.rb:123:in
129.3 `block in worker_pool'
129.3 /usr/local/bundle/gems/bundler-2.5.4/lib/bundler/worker.rb:62:in `apply_func'
129.3 /usr/local/bundle/gems/bundler-2.5.4/lib/bundler/worker.rb:57:in `block in
129.3 process_queue'
129.3 <internal:kernel>:187:in `loop'
129.3 /usr/local/bundle/gems/bundler-2.5.4/lib/bundler/worker.rb:54:in
129.3 `process_queue'
129.3 /usr/local/bundle/gems/bundler-2.5.4/lib/bundler/worker.rb:90:in `block (2
129.3 levels) in create_threads'
129.3
129.3 An error occurred while installing commonmarker (1.0.4), and Bundler cannot
129.3 continue.
129.3
129.3 In Gemfile:
129.3 commonmarker
------
ERROR: failed to solve: executor failed running [/bin/sh -c apk add --update --no-cache build-base make gcc musl-dev && bundle install && rm -rf /usr/local/bundle/cache/*.gem && find /usr/local/bundle/gems/ -name "*.c" -delete && find /usr/local/bundle/gems/ -name "*.o" -delete && apk del make gcc musl-dev build-base]: exit code: 5
Exited with code exit status 1
This is a Ruby 3.3 (ruby:3.3.0-alpine) based image, that is simply doing a bundle install
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 2
- Comments: 23 (16 by maintainers)
v2.1.0 works on Alpine musl CI
Nothing fundamentally changed in 2.1.1, but the build was not packaging the gem for Ruby 3.3 correctly, so I had to cut a new release to fix that.
Looking at the build logs, I can’t help but laugh (from the pain): https://github.com/gjtorikian/commonmarker/actions/runs/13738548919/job/38425110606
Of all the builds, only
x86_64-linux-muslrandomly and inexplicably failed:I re-ran the job and confirmed the gem published.
Very glad to hear it!
Yes, sorry! Thank you! v2.1.0 should be on Rubygems for musl now, per 64c43818761b271d97130fe5bc72c70e2ad2f893 and https://github.com/gjtorikian/commonmarker/actions/runs/13535714128
Hello, i also have the same error in my docker build using
ruby:3.2.2-alpine3.19here is a sample of my Dockerfile
We still get an error even after adding
gcompat:(that was using Docker 4.7.1 on a Mac Sonoma 14.6.1, built using
ruby:3.3.0-alpineas a base image)We ran into the same problem when building a ruby:3.3.0-alpine based docker container with
bundle install. The error it threw was (for reference):This is probably caused by trying to run glibc programs in Alpine Linux that uses musl. According to the Alpine linux documentation there are multiple options to do this. We used the gcompat compatibility layer and added this to our
Dockerfile:This solved it for us.
To be honest, we’ve just pinned the version to 0.23.10 and it works for us. So don’t stress too much for now about it (at least from my perspective)
It was being built on an alpine base on CircleCI. So I don’t know what CPUs they use or why it comes as “unknown”.
Hi, I had a chance to look into this. I can adjust the project to build for
x86_64-linux-musl:But, I don’t know enough about musl to understand what your platform is. The build system I use doesn’t recognize it:
Would support for
x86_64-linux-muslbe enough for you? What exactly isunknown-linux-musl?Ah yeah I don’t support musl, it says so right in the first few lines:
I am not sure if I ever will tbh. Bluntly, it’s more work to figure out how to get it working in this environment. I have heard too many tales of alpine being “different” enough to not investigate it. I’d consider PRs that support it, though.