Ticket #525 (accepted fixme)

Opened 2 years ago

Last modified 14 months ago

scons ignores PKG_CONFIG_PATH

Reported by: ichthyo Owned by: ichthyo
Priority: lesser Milestone: 0integration
Component: infrastructure Keywords: scons
Cc: plouj Blocked By:
Blocking:

Description

...which causes problems when someone installs custom built libraries at non standard locations.

Change History

comment:1 Changed 2 years ago by ichthyo

  • Cc plouj added

Plouj wrote: I'm unable to make it find nobug and other libraries installed in non-standard paths:

$ scons
...
Checking for library configuration: nobugmt
Package nobugmt was not found in the pkg-config search path.
Perhaps you should add the directory containing `nobugmt.pc'
to the PKG_CONFIG_PATH environment variable

I tried this, but it didn't work:

$ PKG_CONFIG_PATH=/home/plouj/work/build/lib/pkgconfig/ scons

comment:2 Changed 2 years ago by ichthyo

  • Owner set to ichthyo
  • Status changed from new to accepted

Strange.... works for me on Python 2.5 / Debian Lenny.

I am running pkg-config with a os.sys(...) call, which is kind of deprecated in newer python ("use the subprocess module instead"). Maybe they changed the way the environment is reflected into the sub-process?

Plouj, could you maybe try out the following change:


diff --git a/admin/scons/LumieraEnvironment.py b/admin/scons/LumieraEnvironment.py
index 44b76ed..7d665e0 100644
--- a/admin/scons/LumieraEnvironment.py
+++ b/admin/scons/LumieraEnvironment.py
@@ -68,6 +68,7 @@ class LumieraEnvironment(Environment):
             Don't add this defs to the current Environment, rather store
             them in the libInfo Dictionary. 
         """
+        os.system('echo "check pkg-config: PKG_CONFIG_PATH=$PKG_CONFIG_PATH"');
         minVersion = str(minVersion)
         if 0 != os.system('pkg-config --print-errors --exists "%s >= %s"' % (libID,minVersion)):
             print "Problems configuring the Library %s (>= %s)" % (libID,minVersion)

This runns an echo command the same way as we run pkg-config. This allows us to see how the environment is passed.
On my system, I see the PKG_CONFIG_PATH given on the scons commandline

comment:3 Changed 2 years ago by ichthyo

For documentation: We're using two calls to pkg_config, one via os.system() and one via the env.ParseConfig(..) provided by scons.
Scons has the policy not to propagate the environment automatically.

17:40 < loonycyborg> Plouj: The issue is that it doesn't propagate PKG_CONFIG_PATH unless you do env["ENV"]["PKG_CONFIG_PATH"] = os.environ.get("PKG_CONFIG_PATH")

[23:43]	<Plouj>	heh, it's actually working
[23:44]	<ichthyo>	self.libInfo[libID] = libInfo = LumieraEnvironment()
[23:44]	<ichthyo>	libInfo["ENV"]["PKG_CONFIG_PATH"] = os.environ.get("PKG_CONFIG_PATH")
[23:44]	<ichthyo>	libInfo.ParseConfig ('pkg-config --cflags --libs '+ libID )

comment:4 Changed 14 months ago by ichthyo

  • Priority changed from normal to lesser

still not sure if its a good idea to pollute the build with values of the current environment. Maybe better setting the path to custom libs/nonstandard lib locations explicitly by parameter? Another idea would be an option to enable/disable isolation from the environment.

Note: See TracTickets for help on using tickets.