Skip to content

Commit 29e944f

Browse files
committed
Use $ORIGIN/../lib64 as rpath for Rust binaries
Note that we still need to use the clang-r* path too here because of how tablegen and other tools get used in Rust's build. Bug: http://b/186438813 Test: ./build.py and inspect RUNPATH via llvm-readelf Change-Id: I21880e8cea9b8703fb10889781aa7cb05fd344b1
1 parent 3587771 commit 29e944f

File tree

2 files changed

+16
-6
lines changed

2 files changed

+16
-6
lines changed

build.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,17 @@ def main():
167167
paths.out_path('bin', 'cargo'),
168168
paths.out_path('bin', 'rustdoc')])
169169

170+
# Install the libc++ library to lib64/
171+
if build_platform.system() == 'darwin':
172+
libcxx_name = 'libc++.dylib'
173+
else:
174+
libcxx_name = 'libc++.so'
175+
lib64_path = paths.out_path('lib64')
176+
if not os.path.exists(lib64_path):
177+
os.makedirs(lib64_path)
178+
shutil.copy2(paths.cxx_linker_path(libcxx_name),
179+
paths.out_path('lib64', libcxx_name))
180+
170181
# Some stdlib crates might include Android.mk or Android.bp files.
171182
# If they do, filter them out.
172183
if build_platform.system() == 'linux':

config_toml.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,14 @@ def configure():
3636
ar = paths.llvm_prebuilt('bin', 'llvm-ar')
3737
cxxstd = paths.llvm_prebuilt('include', 'c++', 'v1')
3838
ranlib = paths.llvm_prebuilt('bin', 'llvm-ranlib')
39-
# Add the path at which libc++ can be found during the build
40-
cxx_linker_flags = ' -Wl,-rpath,' + paths.cxx_linker_path()
4139
# Add the path at which libc++ can be found in Android checkouts
42-
cxx_linker_flags += ' -Wl,-rpath,'
40+
cxx_linker_flags = ' -Wl,-rpath,'
4341
if build_platform.system() == 'darwin':
44-
cxx_linker_flags += '@loader_path/'
42+
cxx_linker_flags += '@loader_path/../lib64'
4543
else:
46-
cxx_linker_flags += '\\$ORIGIN/'
47-
cxx_linker_flags += paths.android_cxx_linker_path()
44+
cxx_linker_flags += '\\$ORIGIN/../lib64'
45+
# Add the path at which libc++ can be found during the build
46+
cxx_linker_flags += ' -Wl,-rpath,' + paths.cxx_linker_path()
4847

4948
def host_config(target):
5049
wrapper_name = paths.this_path('clang-%s' % target)

0 commit comments

Comments
 (0)