Skip to content

Commit ce7f79d

Browse files
committed
Actions: Use python to find system ssl on macos
1 parent 290c9dc commit ce7f79d

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

.github/workflows/unix_unit_tests.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -450,11 +450,25 @@ jobs:
450450
conda_lib_path = os.path.join(os.path.dirname(os.path.dirname(python_exe)), 'lib')
451451
dyld_line = f\"setenv('DYLD_FALLBACK_LIBRARY_PATH', '{conda_lib_path}');\"
452452
453+
# macOS: Preload conda's libssl with RTLD_GLOBAL so libcurl finds
454+
# SSL_get0_group_name in conda's library instead of MATLAB's older one
455+
ssl_preload = ''
456+
if is_macos:
457+
import ssl
458+
import ctypes.util
459+
# Get the libssl path that Python's ssl module uses
460+
ssl_lib = ctypes.util.find_library('ssl')
461+
if ssl_lib:
462+
ssl_preload = f'''% Preload conda's libssl with RTLD_GLOBAL to avoid MATLAB's older bundled version
463+
py.ctypes.CDLL(py.ctypes.util.find_library('ssl'), pyargs('mode', py.ctypes.RTLD_GLOBAL));
464+
disp('Preloaded libssl with RTLD_GLOBAL');'''
465+
453466
content = f'''pyenv(Version='{python_exe}', ExecutionMode='OutOfProcess')
454467
{dyld_line}
455468
% Verify Python environment
456469
pe = pyenv;
457470
disp(pe);
471+
{ssl_preload}
458472
% Warm up numpy - must call function to force resolution
459473
py.importlib.import_module('numpy');
460474
dummy = py.numpy.array([1,2,3]);

0 commit comments

Comments
 (0)