Skip to content

Commit e3f3fad

Browse files
committed
Set LD_LIBRARY_PATH when running tests from cake
1 parent 7666375 commit e3f3fad

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

config.cake

+11
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,17 @@ elif cake.system.isLinux() or cake.system.isDarwin():
253253
platform=platform,
254254
architecture='x64')
255255

256+
# If libc++ is installed in a non-standard location, add the path to libc++.so
257+
# to the library search path by adding libc++'s /lib directory to LD_LIBRARY_PATH
258+
if libcxxInstallPrefix not in defaultInstallPaths:
259+
libcxxLibPath = os.path.abspath(cake.path.join(libcxxInstallPrefix, 'lib'))
260+
ldPaths = [libcxxLibPath]
261+
test = clangVariant.tools["test"]
262+
oldLdPath = test.env.get('LD_LIBRARY_PATH', None)
263+
if oldLdPath:
264+
ldPaths.append(oldLdPath)
265+
test.env['LD_LIBRARY_PATH'] = os.path.pathsep.join(ldPaths)
266+
256267
compiler = ClangCompiler(
257268
configuration=configuration,
258269
clangExe=clangExe,

tools/cake_extensions/testtool.py

+3
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
###############################################################################
55

66
import subprocess
7+
import os
78

89
import cake.filesys
910
import cake.path
@@ -22,6 +23,7 @@ def __init__(self, configuration):
2223
Tool.__init__(self, configuration)
2324
self.dependencies = []
2425
self.extraArgs = []
26+
self.env = dict(os.environ)
2527

2628
def run(self, program, results=None, cwd=None, extraArgs=[], dependencies=[]):
2729

@@ -106,6 +108,7 @@ def _launchTest(self, program, results, cwd, dependencies):
106108
stdout=stdout,
107109
stderr=subprocess.STDOUT,
108110
cwd=cwd,
111+
env=self.env
109112
)
110113
except EnvironmentError, e:
111114
msg = "cake: failed to launch %s: %s\n" % (programPath, str(e))

0 commit comments

Comments
 (0)