ERROR: Error installing rmagick:
ERROR: Failed to build gem native extension.
current directory: /var/www/discourse/plugins/discourse-topic-previews-sidecar/gems/3.3.6/gems/rmagick-6.0.1/ext/RMagick
/usr/local/bin/ruby extconf.rb
checking for brew... no
checking for pacman... no
checking for Ruby version >= 3.0.0... yes
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include=${opt-dir}/include
--without-opt-include
--with-opt-lib=${opt-dir}/lib
--without-opt-lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/usr/local/bin/$(RUBY_BASE_NAME)
--with-pkg-config
--without-pkg-config
--with-override-variables
--without-override-variables
/var/www/discourse/plugins/discourse-topic-previews-sidecar/gems/3.3.6/gems/pkg-config-1.5.6/lib/pkg-config.rb:504:in `parse_pc': .pc doesn't exist: <MagickCore> (PackageConfig::NotFoundError)
Gem은 전체 빌드 시에만 빌드되나요? 아니면 전체 재빌드 시에만 수행되는 Ruby 버전 증가가 원인이어서(그로 인해 Gem의 재빌드가 강제되는 것일 수 있습니다) 그런 것일까요?
이미지를 업데이트하여 ImageMagick을 별도로 컴파일하고 최종 ImageMagick 바이너리만 포함하도록 했습니다. 이를 통해 ImageMagick의 컴파일 타임 라이브러리를 기본 이미지에서 더 이상 포함하지 않으며, 기본 이미지의 크기를 줄이려는 노력을 기울이고 있습니다.
ImageMagick 라이브러리를 설치하는 설치 스크립트를 단순히 추가하는 방법도 있지만, 플러그인의 rmagick gem 의존성을 제거하는 것을 권장합니다. 해당 gem이 어디서 호출되는지 명확하지 않으며, 코어 Discourse의 이미지 최적화 호출을 확장하는 것으로 보이며, 이는 결국 ImageMagick 바이너리를 직접 호출하는 방식이기 때문입니다.
워크어라운드를 찾아낼 수 있다 해도, rmagick 지움을 차단하는 것은 정말 아쉬운 일입니다. 대안은 ImageMagick에 대한 시스템 호출을 직접 다루는 방식인데, 이 방식은 다소 … 어색하고 … 언어 내에서 편리한 API를 사용하는 것에 비해 개발자 친화성이 훨씬 떨어지기 때문입니다.