|
13 | 13 | # determine CPU support for SSE2 and AVX2 |
14 | 14 | cpu_info = cpuinfo.get_cpu_info() |
15 | 15 | flags = cpu_info.get('flags', []) |
16 | | -have_sse2 = 'sse2' in flags |
17 | | -have_avx2 = 'avx2' in flags |
| 16 | +machine = cpuinfo.platform.machine() |
| 17 | + |
| 18 | +# only check for x86 features on x86_64 arch |
| 19 | +have_sse2 = False |
| 20 | +have_avx2 = False |
| 21 | +if machine == 'x86_64': |
| 22 | + have_sse2 = 'sse2' in flags |
| 23 | + have_avx2 = 'avx2' in flags |
| 24 | + |
18 | 25 | disable_sse2 = 'DISABLE_NUMCODECS_SSE2' in os.environ |
19 | 26 | disable_avx2 = 'DISABLE_NUMCODECS_AVX2' in os.environ |
20 | 27 |
|
|
24 | 31 | if have_cflags: |
25 | 32 | # respect compiler options set by user |
26 | 33 | pass |
27 | | -elif os.name == 'posix': |
| 34 | +elif os.name == 'posix' and machine == 'x86_64': |
28 | 35 | if disable_sse2: |
29 | 36 | base_compile_args.append('-mno-sse2') |
30 | 37 | elif have_sse2: |
@@ -53,8 +60,14 @@ def blosc_extension(): |
53 | 60 | info('setting up Blosc extension') |
54 | 61 |
|
55 | 62 | extra_compile_args = base_compile_args.copy() |
| 63 | + extra_link_args = [] |
56 | 64 | define_macros = [] |
57 | 65 |
|
| 66 | + # ensure pthread is properly linked on POSIX systems |
| 67 | + if os.name == 'posix': |
| 68 | + extra_compile_args.append('-pthread') |
| 69 | + extra_link_args.append('-pthread') |
| 70 | + |
58 | 71 | # setup blosc sources |
59 | 72 | blosc_sources = [f for f in glob('c-blosc/blosc/*.c') if 'avx2' not in f and 'sse2' not in f] |
60 | 73 | include_dirs = [os.path.join('c-blosc', 'blosc')] |
@@ -118,6 +131,7 @@ def blosc_extension(): |
118 | 131 | include_dirs=include_dirs, |
119 | 132 | define_macros=define_macros, |
120 | 133 | extra_compile_args=extra_compile_args, |
| 134 | + extra_link_args=extra_link_args, |
121 | 135 | extra_objects=extra_objects, |
122 | 136 | ), |
123 | 137 | ] |
@@ -307,8 +321,10 @@ class ve_build_ext(build_ext): |
307 | 321 |
|
308 | 322 | def run(self): |
309 | 323 | try: |
310 | | - if cpuinfo.platform.machine() == 'x86_64': |
311 | | - S_files = glob('c-blosc/internal-complibs/zstd*/decompress/*amd64.S') |
| 324 | + machine = cpuinfo.platform.machine() |
| 325 | + if machine in ('x86_64', 'aarch64'): |
| 326 | + pattern = '*amd64.S' if machine == 'x86_64' else '*aarch64.S' |
| 327 | + S_files = glob(f'c-blosc/internal-complibs/zstd*/decompress/{pattern}') |
312 | 328 | compiler = ccompiler.new_compiler() |
313 | 329 | customize_compiler(compiler) |
314 | 330 | compiler.src_extensions.append('.S') |
|
0 commit comments