From e26ee3d297ad403720af736ae6dc1722df8a214b Mon Sep 17 00:00:00 2001 From: Leo Fang Date: Fri, 19 Jan 2024 18:55:49 -0800 Subject: [PATCH] fix static lib search when cross compiling --- recipe/support_new_cuda_layout.diff | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/recipe/support_new_cuda_layout.diff b/recipe/support_new_cuda_layout.diff index f2a7c548..b33302f1 100644 --- a/recipe/support_new_cuda_layout.diff +++ b/recipe/support_new_cuda_layout.diff @@ -11,23 +11,30 @@ index 914b62c00..6363c6b91 100644 print('NVTX could not be found') return None diff --git a/install/cupy_builder/cupy_setup_build.py b/install/cupy_builder/cupy_setup_build.py -index d53ceccec..147dec2fd 100644 +index d53ceccec..6c065dc02 100644 --- a/install/cupy_builder/cupy_setup_build.py +++ b/install/cupy_builder/cupy_setup_build.py -@@ -260,20 +260,22 @@ def _rpath_base(): +@@ -260,20 +260,28 @@ def _rpath_base(): def _find_static_library(name: str) -> str: if PLATFORM_LINUX: filename = f'lib{name}.a' - libdir = 'lib64' -+ libdirs = ['lib64', 'lib'] ++ if int(os.environ.get('CONDA_BUILD_CROSS_COMPILATION', 0)) == 1: ++ libdirs = ['lib'] ++ cuda_path = f'{os.environ["PREFIX"]}/targets/' ++ f'{build.conda_get_target_name()}/' ++ else: ++ libdirs = ['lib64', 'lib'] ++ cuda_path = build.get_cuda_path() elif PLATFORM_WIN32: filename = f'{name}.lib' - libdir = 'lib\\x64' + libdirs = ['lib\\x64', 'lib'] ++ cuda_path = build.get_cuda_path() else: raise Exception('not supported on this platform') - cuda_path = build.get_cuda_path() +- cuda_path = build.get_cuda_path() if cuda_path is None: raise Exception(f'Could not find {filename}: CUDA path unavailable') - path = os.path.join(cuda_path, libdir, filename) @@ -42,7 +49,7 @@ index d53ceccec..147dec2fd 100644 def make_extensions(ctx: Context, compiler, use_cython): -@@ -317,16 +319,42 @@ def make_extensions(ctx: Context, compiler, use_cython): +@@ -317,16 +325,42 @@ def make_extensions(ctx: Context, compiler, use_cython): settings['define_macros'].append(('__HIP_PLATFORM_HCC__', '1')) settings['define_macros'].append(('CUPY_CACHE_KEY', ctx.cupy_cache_key))