如何自动使用 /usr/include/glib-2.0 而不是 /usr/local/include/glib-2.0
我不确定我的系统何时发生此更改,但我曾经能够构建使用 /usr/include/glib-2.0 的东西。但现在我的构建由于 glib 而失败,并且我注意到它正在使用另一个版本的 /usr/local/include/glib-2.0。
我怎样才能让它使用 /usr/lib 而不是 /usr/local/lib 来进行 glib ?我尝试删除 /usr/local/include/glib-2.0 和 /usr/local/lib/glib-2.0,但它仍然尝试使用这些路径并失败。
I am not sure when this change occurred on my system, but I used to be able to build something that used /usr/include/glib-2.0. But now my build is failing due to glib, and I notice that it is using another version of /usr/local/include/glib-2.0.
How can I get it to use /usr/lib instead of /usr/local/lib for glib? I tried removing /usr/local/include/glib-2.0 and /usr/local/lib/glib-2.0, but it still tries to use those paths and fails.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
好吧,我发现的一个解决方案是下载 glib 源代码,构建它并将其安装到 /usr/local,然后运行“sudo make uninstall”......有点黑客,但它有效
well, a solution I found was to download the glib source, build it and install it to /usr/local, and then run "sudo make uninstall" ... kind of a hack, but it worked
在构建脚本中获取 glib 的正确路径的最佳方法是使用 pkg-config 工具获取 gcc 的标志。
例如
gcc $(pkg-config --cflags glib-2.0) foo.c
The best way of getting the proper path to glib in your buildscripts is to use the pkg-config tool to get the flags for gcc.
E.g
gcc $(pkg-config --cflags glib-2.0) foo.c
如果您曾经自己编译并安装过 glib 并且没有更改前缀,则 pkg-config 的默认搜索路径中可能有
glib-2.0.pc
。您可以通过--debug
选项检查使用了哪个.pc
文件。或者,您可以检查
glib-2.0.pc
的内容,看看它是否具有正确的前缀
。If you have eveer compiled and installed glib by yourself and did not change the prefix, you might have
glib-2.0.pc
in pkg-config's default search path. You can check which.pc
file is used with--debug
option.Or, you can check the contents of
glib-2.0.pc
to see it has the rightprefix
or not.