@@ -152,17 +152,33 @@ pub fn discover_cuda_config() -> Result<CudaConfig, BuildError> {
152152 } ;
153153
154154 // Add standard include directories
155- // Check both old-style (include) and new-style (targets/x86_64-linux/include) CUDA installations
156- for include_subdir in & [ "include" , "targets/x86_64-linux/include" ] {
155+ // Check both old-style (include) and new-style target-specific paths
156+ // Support both x86_64 and aarch64/ARM architectures
157+ for include_subdir in & [
158+ "include" ,
159+ "targets/x86_64-linux/include" ,
160+ "targets/aarch64-linux/include" ,
161+ "targets/sbsa-linux/include" ,
162+ ] {
157163 let include_dir = cuda_home_path. join ( include_subdir) ;
158164 if include_dir. exists ( ) {
159165 config. include_dirs . push ( include_dir) ;
160166 }
161167 }
162168
163169 // Add standard library directories
164- // Check both old-style (lib64, lib) and new-style (targets/x86_64-linux/lib) CUDA installations
165- for lib_subdir in & [ "lib64" , "lib" , "lib/x64" , "targets/x86_64-linux/lib" ] {
170+ // Check both old-style and new-style CUDA installations for both x86_64 and aarch64
171+ // Try architecture-specific paths first, then generic paths
172+ for lib_subdir in & [
173+ "lib64" , // Common x86_64 location
174+ "lib" , // Common aarch64 location
175+ "lib/x64" , // Windows x64
176+ "targets/x86_64-linux/lib" , // CUDA toolkit x86_64
177+ "targets/aarch64-linux/lib" , // CUDA toolkit aarch64
178+ "targets/sbsa-linux/lib" , // CUDA toolkit ARM server
179+ "lib/aarch64-linux-gnu" , // Debian/Ubuntu aarch64
180+ "lib/x86_64-linux-gnu" , // Debian/Ubuntu x86_64
181+ ] {
166182 let lib_dir = cuda_home_path. join ( lib_subdir) ;
167183 if lib_dir. exists ( ) {
168184 config. lib_dirs . push ( lib_dir) ;
@@ -201,8 +217,16 @@ pub fn get_cuda_lib_dir() -> Result<String, BuildError> {
201217 // Try to deduce from CUDA configuration
202218 let cuda_config = discover_cuda_config ( ) ?;
203219 if let Some ( cuda_home) = cuda_config. cuda_home {
204- // Check both old-style and new-style CUDA library paths
205- for lib_subdir in & [ "lib64" , "lib" , "targets/x86_64-linux/lib" ] {
220+ // Check both x86_64 and aarch64 CUDA library paths
221+ for lib_subdir in & [
222+ "lib64" , // Common x86_64 location
223+ "lib" , // Common aarch64 location
224+ "targets/x86_64-linux/lib" , // CUDA toolkit x86_64
225+ "targets/aarch64-linux/lib" , // CUDA toolkit aarch64
226+ "targets/sbsa-linux/lib" , // CUDA toolkit ARM server
227+ "lib/aarch64-linux-gnu" , // Debian/Ubuntu aarch64
228+ "lib/x86_64-linux-gnu" , // Debian/Ubuntu x86_64
229+ ] {
206230 let lib_path = cuda_home. join ( lib_subdir) ;
207231 if lib_path. exists ( ) {
208232 return Ok ( lib_path. to_string_lossy ( ) . to_string ( ) ) ;
0 commit comments