diff options
| author | 2018-05-07 06:41:20 +0000 | |
|---|---|---|
| committer | 2018-05-07 07:46:16 +0000 | |
| commit | b3174d190e7e0167a9351f2153c1aa38370d8cbd (patch) | |
| tree | fc8e1c3b021262ead74603e03962798288230bbc | |
| parent | 93b48182016d46b0a117d455a0297328f972bada (diff) | |
Build System: Fix rpath error if native executable under testcase folder.
error while loading shared libraries: libc++.so:
cannot open shared object file: No such file or directory
BUG: N/A
Test: make -j16 hello_world_test
out/host/linux-x86/testcases/hello_world_test/x86_64/hello_world_test
out/host/linux-x86/testcases/hello_world_test/x86/hello_world_test
Change-Id: I0ecb1955cd67295abe12fc19ab811fe046ac5f23
| -rw-r--r-- | cc/test.go | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/cc/test.go b/cc/test.go index fef636780..5d0ef20b7 100644 --- a/cc/test.go +++ b/cc/test.go @@ -168,13 +168,17 @@ func (test *testDecorator) linkerDeps(ctx BaseModuleContext, deps Deps) Deps { } func (test *testDecorator) linkerInit(ctx BaseModuleContext, linker *baseLinker) { - // add ../../lib[64] to rpath so that out/host/linux-x86/nativetest/<test dir>/<test> can + // 1. Add ../../lib[64] to rpath so that out/host/linux-x86/nativetest/<test dir>/<test> can // find out/host/linux-x86/lib[64]/library.so - runpath := "../../lib" - if ctx.toolchain().Is64Bit() { - runpath += "64" + // 2. Add ../../../lib[64] to rpath so that out/host/linux-x86/testcases/<test dir>/<CPU>/<test> can + // also find out/host/linux-x86/lib[64]/library.so + runpaths := []string{"../../lib", "../../../lib"} + for _, runpath := range runpaths { + if ctx.toolchain().Is64Bit() { + runpath += "64" + } + linker.dynamicProperties.RunPaths = append(linker.dynamicProperties.RunPaths, runpath) } - linker.dynamicProperties.RunPaths = append(linker.dynamicProperties.RunPaths, runpath) // add "" to rpath so that test binaries can find libraries in their own test directory linker.dynamicProperties.RunPaths = append(linker.dynamicProperties.RunPaths, "") |