PKG_CONFIG_PATH变量,如何在编译RRDtool时设置LDFLAGS和CPPFLAGS [英] PKG_CONFIG_PATH variable, how to set LDFLAGS and CPPFLAGS when compiling RRDtool

查看:1447
本文介绍了PKG_CONFIG_PATH变量,如何在编译RRDtool时设置LDFLAGS和CPPFLAGS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

任务是安装rrdtool在红帽派生和yum或包被禁止。将rrdtool的所有依赖项从源代码编译到
单独的目录中:
/ apps / run / sepatare_folder

The mission is install rrdtool on Red Hat derivate and yum or packages are forbidden. Compiling all dependencies for rrdtool from source into separate directory: /apps/run/sepatare_folder

所以basicaly都有这样的样子: / p>

So basicaly all i have looks like this:

ls
cairo        glib         pango        pixman
--
pwd
/apps/run

编译四个依赖项后rrdtool在./configure --prefix = / apps / run / rrdtool

After compiling four dependencies rrdtool complains during ./configure --prefix=/apps/run/rrdtool

编译器无法找到库[因为我将它们编译成单独的文件夹而不是标准库,因为这是禁止的]

Compiler cannot find libs [because i compliled them into separate folder not the standard as this is prohibited]

Find 3rd-Party Libraries
checking dbi/dbi.h usability... no
checking dbi/dbi.h presence... no
checking for dbi/dbi.h... no
checking tcpd.h usability... no
checking tcpd.h presence... no
checking for tcpd.h... no
checking for cairo_font_options_create in -lcairo... no
checking for pkg-config... pkg-config
configure: WARNING:
----------------------------------------------------------------------------
* I found a copy of pkgconfig, but there is no cairo-png.pc file around.
  You may want to set the PKG_CONFIG_PATH variable to point to its
  location.
----------------------------------------------------------------------------

configure: WARNING:
----------------------------------------------------------------------------
* I could not find a working copy of cairo-png. Check config.log for hints on why
  this is the case. Maybe you need to set LDFLAGS and CPPFLAGS appropriately
  so that compiler and the linker can find libcairo and its header files. If
  you have not installed cairo-png, you can get it either from its original home on

     http://cairographics.org/releases/

  You can find also find an archive copy on

     http://oss.oetiker.ch/rrdtool/pub/libs

  The last tested version of cairo-png is 1.10.2.

       LIBS=-lm
   LDFLAGS=
  CPPFLAGS=

----------------------------------------------------------------------------

checking for cairo_svg_surface_create in -lcairo... no
checking for pkg-config... (cached) pkg-config
configure: WARNING:
----------------------------------------------------------------------------
* I found a copy of pkgconfig, but there is no cairo-svg.pc file around.
  You may want to set the PKG_CONFIG_PATH variable to point to its
  location.
----------------------------------------------------------------------------

configure: WARNING:
----------------------------------------------------------------------------
* I could not find a working copy of cairo-svg. Check config.log for hints on why
  this is the case. Maybe you need to set LDFLAGS and CPPFLAGS appropriately
  so that compiler and the linker can find libcairo and its header files. If
  you have not installed cairo-svg, you can get it either from its original home on

     http://cairographics.org/releases/

  You can find also find an archive copy on

     http://oss.oetiker.ch/rrdtool/pub/libs

  The last tested version of cairo-svg is 1.10.2.

       LIBS=-lm
   LDFLAGS=
  CPPFLAGS=

----------------------------------------------------------------------------

checking for cairo_pdf_surface_create in -lcairo... no
checking for pkg-config... (cached) pkg-config
configure: WARNING:
----------------------------------------------------------------------------
* I found a copy of pkgconfig, but there is no cairo-pdf.pc file around.
  You may want to set the PKG_CONFIG_PATH variable to point to its
  location.
----------------------------------------------------------------------------

configure: WARNING:
----------------------------------------------------------------------------
* I could not find a working copy of cairo-pdf. Check config.log for hints on why
  this is the case. Maybe you need to set LDFLAGS and CPPFLAGS appropriately
  so that compiler and the linker can find libcairo and its header files. If
  you have not installed cairo-pdf, you can get it either from its original home on

     http://cairographics.org/releases/

  You can find also find an archive copy on

     http://oss.oetiker.ch/rrdtool/pub/libs

  The last tested version of cairo-pdf is 1.10.2.

       LIBS=-lm
   LDFLAGS=
  CPPFLAGS=

----------------------------------------------------------------------------

checking for cairo_ps_surface_create in -lcairo... no
checking for pkg-config... (cached) pkg-config
configure: WARNING:
----------------------------------------------------------------------------
* I found a copy of pkgconfig, but there is no cairo-ps.pc file around.
  You may want to set the PKG_CONFIG_PATH variable to point to its
  location.
----------------------------------------------------------------------------

configure: WARNING:
----------------------------------------------------------------------------
* I could not find a working copy of cairo-ps. Check config.log for hints on why
  this is the case. Maybe you need to set LDFLAGS and CPPFLAGS appropriately
  so that compiler and the linker can find libcairo and its header files. If
  you have not installed cairo-ps, you can get it either from its original home on

     http://cairographics.org/releases/

  You can find also find an archive copy on

     http://oss.oetiker.ch/rrdtool/pub/libs

  The last tested version of cairo-ps is 1.10.2.

       LIBS=-lm
   LDFLAGS=
  CPPFLAGS=

----------------------------------------------------------------------------

checking for pango_cairo_context_set_font_options in -lpangocairo-1.0... no
checking for pkg-config... (cached) pkg-config
configure: WARNING:
----------------------------------------------------------------------------
* I found a copy of pkgconfig, but there is no pangocairo.pc file around.
  You may want to set the PKG_CONFIG_PATH variable to point to its
  location.
----------------------------------------------------------------------------

configure: WARNING:
----------------------------------------------------------------------------
* I could not find a working copy of pangocairo. Check config.log for hints on why
  this is the case. Maybe you need to set LDFLAGS and CPPFLAGS appropriately
  so that compiler and the linker can find libpangocairo-1.0 and its header files. If
  you have not installed pangocairo, you can get it either from its original home on

     http://ftp.gnome.org/pub/GNOME/sources/pango/1.28

  You can find also find an archive copy on

     http://oss.oetiker.ch/rrdtool/pub/libs

  The last tested version of pangocairo is 1.28.4.

       LIBS=-lm
   LDFLAGS=
  CPPFLAGS=

----------------------------------------------------------------------------

checking for glib_check_version in -lglib-2.0... no
checking for pkg-config... (cached) pkg-config
configure: WARNING:
----------------------------------------------------------------------------
* I found a copy of pkgconfig, but there is no glib-2.0.pc file around.
  You may want to set the PKG_CONFIG_PATH variable to point to its
  location.
----------------------------------------------------------------------------

configure: WARNING:
----------------------------------------------------------------------------
* I could not find a working copy of **glib-2.0**. Check config.log for hints on why
  this is the case. Maybe you need to set LDFLAGS and CPPFLAGS appropriately
  so that compiler and the linker can find libglib-2.0 and its header files. If
  you have not installed glib-2.0, you can get it either from its original home on

     ftp://ftp.gtk.org/pub/glib/2.28/

  You can find also find an archive copy on

     http://oss.oetiker.ch/rrdtool/pub/libs

  The last tested version of glib-2.0 is 2.28.7.

       LIBS=-lm
   LDFLAGS=
  CPPFLAGS=

----------------------------------------------------------------------------

checking for xmlParseFile in -lxml2... yes
checking libxml/parser.h usability... yes
checking libxml/parser.h presence... yes
checking for libxml/parser.h... yes
configure: error: Please fix the library issues listed above and try again.






我有所有缺失的库,告诉编译器如何找到它们是一个很大的痛苦。例如,缺少 glib-2.0 位于此处:

pwd
/apps/run/glib/lib
ls -la
total 2300
drwxr-xr-x 4 root root    4096 May  3 08:18 .
drwxr-xr-x 6 root root    4096 May  3 08:17 ..
drwxr-xr-x 3 root root    4096 May  3 08:17 glib-2.0
-rwxr-xr-x 1 root root     928 May  3 08:18 libgio-2.0.la
lrwxrwxrwx 1 root root      19 May  3 08:18 libgio-2.0.so -> libgio-2.0.so.0.0.0
lrwxrwxrwx 1 root root      19 May  3 08:18 libgio-2.0.so.0 -> libgio-2.0.so.0.0.0
-rwxr-xr-x 1 root root  712052 May  3 08:18 libgio-2.0.so.0.0.0
-rwxr-xr-x 1 root root     830 May  3 08:17 libglib-2.0.la
lrwxrwxrwx 1 root root      23 May  3 08:17 libglib-2.0.so -> libglib-2.0.so.0.1504.0
lrwxrwxrwx 1 root root      23 May  3 08:17 libglib-2.0.so.0 -> libglib-2.0.so.0.1504.0
-rwxr-xr-x 1 root root 1168721 May  3 08:17 libglib-2.0.so.0.1504.0
-rwxr-xr-x 1 root root     887 May  3 08:18 libgmodule-2.0.la
lrwxrwxrwx 1 root root      26 May  3 08:18 libgmodule-2.0.so -> libgmodule-2.0.so.0.1504.0
lrwxrwxrwx 1 root root      26 May  3 08:18 libgmodule-2.0.so.0 -> libgmodule-2.0.so.0.1504.0
-rwxr-xr-x 1 root root   16107 May  3 08:18 libgmodule-2.0.so.0.1504.0
-rwxr-xr-x 1 root root     882 May  3 08:18 libgobject-2.0.la
lrwxrwxrwx 1 root root      26 May  3 08:18 libgobject-2.0.so -> libgobject-2.0.so.0.1504.0
lrwxrwxrwx 1 root root      26 May  3 08:18 libgobject-2.0.so.0 -> libgobject-2.0.so.0.1504.0
-rwxr-xr-x 1 root root  378273 May  3 08:18 libgobject-2.0.so.0.1504.0
-rwxr-xr-x 1 root root     897 May  3 08:18 libgthread-2.0.la
lrwxrwxrwx 1 root root      26 May  3 08:18 libgthread-2.0.so -> libgthread-2.0.so.0.1504.0
lrwxrwxrwx 1 root root      26 May  3 08:18 libgthread-2.0.so.0 -> libgthread-2.0.so.0.1504.0
-rwxr-xr-x 1 root root   24126 May  3 08:18 libgthread-2.0.so.0.1504.0
drwxr-xr-x 2 root root    4096 May  3 08:17 pkgconfig






但不幸的是我不能理解他们:


There are nice advices but unfortunatly i cannot understand them:



  • 您可能想设置PKG_CONFIG_PATH变量以指向其位置。

  • 也许您需要适当地设置LDFLAGS和CPPFLAGS,以便编译器和链接器可以找到libglib-2.0及其头文件。

不足以设置 PKG_CONFIG_PATH 以包含多个所需库的目录[例如glib-2.0.pc,cairo-ps ,cairo-png,..]
可以找到。尝试这样:

Not skilled enought to set PKG_CONFIG_PATH to include the directory where multiple required libs [ for example glib-2.0.pc, cairo-ps, cairo-png,..] can be found. Tried something like this:

export LD_LIBRARY_PATH=/apps/run/glib/lib;export LD_LIBRARY_PATH=/apps/run//apps/run/cairo/lib

但不工作。
也不确定这是否足够,因为有关于正确设置 LDFLAGS CPPFLAGS 的建议。
试用这个:

but not working. Also not sure if this will be suficient as there are advices about seting LDFLAGS and CPPFLAGS appropriately. Tried this:

export LDFLAGS='-L/apps/run/cairo/libs'

但它似乎不正确。或者,我指定LDFLAGS和CPPFLAGS作为./configure的一部分?
语法应该是什么?请咨询,寻找一般howtos,但不能适应我的环境。 Thx

but it doesnt seems to be correct. Or shloud i specify LDFLAGS and CPPFLAGS as part of the ./configure ? What the syntax should be? Please advice, looking for general howtos but not able to fit into my enviroment. Thx

推荐答案

设置路径,例如 LD_LIBRARY_PATH PKG_CONFIG_PATH ,应使用单个 export 并使用分隔路径。例如:

To set paths, e.g. LD_LIBRARY_PATH of PKG_CONFIG_PATH, you should use a single export, and separate the paths using :. For example:

export PKG_CONFIG_PATH = / my / path:/ my / other / path:/ yet / another / path

运行mulitple在彼此之后导出,就像您在 LD_LIBRARY_PATH 中所显示的将会覆盖它们,一个将被保留。一般来说,总是包含当前值(如果它是空的),这是明智的:

Running mulitple exports after each other, like you showed for LD_LIBRARY_PATH will overwrite them, i.e. only the last one will be retained. Generally, it's wise to always include the current value (it's ok if it's empty):

export PKG_CONFIG_PATH = / my / path:其他/ path:/ yet / another / path:$ PKG_CONFIG_PATH

尝试找到 cairo-png.pc 文件,然后将 PKG_CONFIG_PATH 设置为它包含的目录。

Try finding the cairo-png.pc file on your system, and then set PKG_CONFIG_PATH to the directory it is contained in.

没有必要干扰 LDFLAGS LD_LIBRARY_PATH ,pkgconfig .pc 文件应该照顾你。

There should be no need to fiddle with LD_LIBRARY_PATH of LDFLAGS, the pkgconfig .pc file should take care of that for you.

这篇关于PKG_CONFIG_PATH变量,如何在编译RRDtool时设置LDFLAGS和CPPFLAGS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆