|
36 | 36 | # Define base libraries needed across all platforms |
37 | 37 | base_libraries = ['folly', 'glog', 'double-conversion', 'fmt'] |
38 | 38 |
|
| 39 | +LD_PATH = 'LD_LIBRARY_PATH' |
39 | 40 | if sys.platform == 'darwin': |
40 | 41 | from distutils import sysconfig |
41 | 42 | cfg_vars = sysconfig.get_config_vars() |
42 | 43 | for key in ('CFLAGS', 'CCSHARED', 'LDSHARED', 'LDCXXSHARED', 'PY_LDFLAGS', 'PY_CFLAGS', 'PY_CPPFLAGS'): |
43 | 44 | if key in cfg_vars: |
44 | 45 | cfg_vars[key] = cfg_vars[key].replace('-mmacosx-version-min=10.9', '-mmacosx-version-min=12') |
| 46 | + |
45 | 47 | if platform.machine() == 'arm64': |
46 | 48 | # Macos (arm64, homebrew path is different than intel) |
47 | 49 | library_dirs = ['/opt/homebrew/lib'] |
48 | 50 | else: |
49 | 51 | library_dirs = ['/usr/local/lib', '/usr/lib'] |
| 52 | + |
| 53 | + LD_PATH='DYLD_LIBRARY_PATH' |
50 | 54 | else: |
51 | 55 | # Debian/Ubuntu |
52 | 56 | library_dirs = ['/usr/lib', '/usr/lib/x86_64-linux-gnu'] |
|
66 | 70 | os.environ['PYTHONPATH'] = pypath |
67 | 71 |
|
68 | 72 | # Add (prepend) library paths from LD_LIBRARY_PATHs |
69 | | -if ldpath := os.environ.get('LD_LIBRARY_PATH'): |
| 73 | +if ldpath := os.environ.get(LD_PATH): |
70 | 74 | ldpaths = ldpath.split(':') |
71 | 75 | library_dirs[:0] = ldpaths |
72 | 76 | # make sure folly library path is included |
73 | 77 | if folly_lib and folly_lib not in ldpaths: |
74 | | - print(f'export LD_LIBRARY_PATH="{folly_lib}:{ldpath}"\n') |
| 78 | + print(f'export {LD_PATH}="{folly_lib}:{ldpath}"\n') |
75 | 79 | else: |
76 | | - print(f'export LD_LIBRARY_PATH="{ldpath}"\n') |
| 80 | + print(f'export {LD_PATH}="{ldpath}"\n') |
77 | 81 |
|
78 | 82 | exts = [ |
79 | 83 | Extension( |
|
0 commit comments