在使用`bundle install'时,添加C的最佳方法包括路径?

发布于 2025-01-30 10:04:35 字数 1563 浏览 3 评论 0 原文

作为背景,我对软件构建系统,UNIX(在这种情况下正在使用Debian 11)和Python环境有广泛的了解,但几乎没有对现代红宝石环境的了解。

我想在与杰基尔(Jekyll)建立的朋友博客中写一篇文章,因此正在尝试将他的博客构建在我的系统上的开发模式下。我想最大程度地减少我使用系统软件包带来的红宝石东西的数量,因此我使用捆绑式安装-Path供应商/捆绑来设置项目依赖项,其中包括 rmagick gem。

我已经安装了 libmagickcore-6.q16-dev 软件包,它给了我/usr/include/imagemagick-6/wand/magickwand.h 。但是,Bundler无法安装Rmagick 2.16.0 GEM。

查看供应商/捆绑/ruby/2.7.0/extensions/x86_64-linux/2.7.0/rmagick-2.16.0/mkmf.log

have_header: checking for wand/MagickWand.h... -------------------- no
                                                                                
"x86_64-linux-gnu-gcc -E -I/usr/include/x86_64-linux-gnu/ruby-2.7.0 -I/usr/include/ruby-2.7.0/ruby/backward -I/usr/include/ruby-2.7.0 -I.      conftest.c -o conftest.i"
conftest.c:3:10: fatal error: wand/MagickWand.h: No such file or directory      
    3 | #include <wand/MagickWand.h>                                            
      |          ^~~~~~~~~~~~~~~~~~~
compilation terminated.

调查,我猜这是由于包括路径不正确。这种提示是关于rmagick gem被折断的,因为 pkg-config 确实提供了这一点:

$ pkg-config --cflags MagickCore
-fopenmp -DMAGICKCORE_HDRI_ENABLE=0 -DMAGICKCORE_QUANTUM_DEPTH=16 -I/usr/include/x86_64-linux-gnu//ImageMagick-6 -I/usr/include/ImageMagick-6

我无法升级他使用的宝石,甚至不容易测试我可能会做出的任何更改我的系统在他使用的系统上工作。因此,要解决此问题,我想获得捆绑添加 -i/usr/includs/imagemagick-6 (或进行道德同等学历)。

实现这一目标的最佳方法是什么?我看不到捆绑包命令行选项。也许我可以设置一个环境变量?

As background, I have extensive knowledge of software build systems, Unix (I'm using Debian 11 in this instance) and Python environments, but almost no knowledge of modern Ruby environments.

I'm wanting to write a post in a friend's blog built with Jekyll and so am trying to get his blog building in development mode on my system. I'm wanting to minimise the amount of Ruby stuff I bring in using system packages, so I'm using bundle install --path vendor/bundle to set up the project dependencies, which include the rmagick gem.

I've installed the libmagickcore-6.q16-dev package, which gives me /usr/include/ImageMagick-6/wand/MagickWand.h. However, bundler is unable to install the RMagick 2.16.0 gem.

Looking in vendor/bundle/ruby/2.7.0/extensions/x86_64-linux/2.7.0/rmagick-2.16.0/mkmf.log, this seems to be the failure:

have_header: checking for wand/MagickWand.h... -------------------- no
                                                                                
"x86_64-linux-gnu-gcc -E -I/usr/include/x86_64-linux-gnu/ruby-2.7.0 -I/usr/include/ruby-2.7.0/ruby/backward -I/usr/include/ruby-2.7.0 -I.      conftest.c -o conftest.i"
conftest.c:3:10: fatal error: wand/MagickWand.h: No such file or directory      
    3 | #include <wand/MagickWand.h>                                            
      |          ^~~~~~~~~~~~~~~~~~~
compilation terminated.

Without doing extensive further investigation, I'm guessing that this is due to the include path being incorrect. This kind of hints at the RMagick gem being broken, since pkg-config does supply this:

$ pkg-config --cflags MagickCore
-fopenmp -DMAGICKCORE_HDRI_ENABLE=0 -DMAGICKCORE_QUANTUM_DEPTH=16 -I/usr/include/x86_64-linux-gnu//ImageMagick-6 -I/usr/include/ImageMagick-6

I'm not able to upgrade the Gems that he's using, nor even easily test that any changes I might make on my system work on the systems he's using. So to work around this I'd like to get bundle to add -I /usr/include/ImageMagick-6 (or do the moral equivalent).

What's the best way to make this happen? I don't see a bundle command line option for this. Perhaps there's an environment variable I can set?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

〗斷ホ乔殘χμё〖 2025-02-06 10:04:35

事实证明,rmagick正在使用正确的包含路径,尽管这些路径未显示在上面的 mkmf.log 文件中。问题是,尽管 pkg-config -fflags magickcore 给出了 wand/ subdirectory的路径。

我已经安装了 magickcore.pc ,我将安装debian 11包 libmagickcore-6.q16.pc 失败。但是, rmagic 软件包实际上需要由 libmagickwand-6.q16-dev package提供的不同库/标题。安装后, Bundle 似乎毫无困难地构建了Rmagick Gem。

在调试此问题时,我确实遇到了a GCC环境变量列表似乎 c_include_path 有人提到的一个人可能会解决我上面发布的原始问题。但是,我现在没有简单的测试方法。

It turns out that the RMagick was using the correct include paths, though these were not displayed in the mkmf.log file above. The issue was that I actually didn't have the include file itself, despite pkg-config --cflags MagickCore giving the path to the wand/ subdirectory.

I'd installed the Debian 11 package libmagickcore-6.q16-dev, which supplies MagickCore.pc, based on an earlier error indicating that pkg-config MagickCore was failing. However, the RMagic package actually requires a different library/set of headers, supplied by the libmagickwand-6.q16-dev package. After installing that, bundle appeared to build the RMagick gem without difficulty.

While debugging this I did come across a list of GCC environment variables, and it seems as if the C_INCLUDE_PATH one mentioned there might solve the original problem I'd posted above. However, I've no easy way of testing this right now.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文