Skip to content

Commit

Permalink
fix static lib search when cross compiling
Browse files Browse the repository at this point in the history
  • Loading branch information
leofang committed Jan 20, 2024
1 parent 1c6d1bb commit e26ee3d
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions recipe/support_new_cuda_layout.diff
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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))

Expand Down

0 comments on commit e26ee3d

Please sign in to comment.