@@ -45,15 +45,17 @@ jobs:
4545 # run: |
4646 # conda activate mhkit_conda_env
4747 # conda install numpy cython pip pytest hdf5 libnetcdf cftime netcdf4
48- #
49- # - name: Fix libstdc++ compatibility
50- # if: matrix.os == 'ubuntu-22.04'
51- # run: |
52- # # Force MATLAB to use system libstdc++ instead of its bundled (older) version
53- # # LD_PRELOAD forces the library to be loaded first
54- # # LD_LIBRARY_PATH ensures symbol resolution finds the system library
55- # echo "LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libstdc++.so.6" >> "$GITHUB_ENV"
56- # echo "LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu:$LD_LIBRARY_PATH" >> "$GITHUB_ENV"
48+
49+ # OutOfProcess mode runs Python in a separate process, so LD_PRELOAD
50+ # can force system libstdc++ for Python without affecting MATLAB's internals
51+ - name : Fix libstdc++ compatibility
52+ if : matrix.os == 'ubuntu-22.04'
53+ run : |
54+ # Force MATLAB to use system libstdc++ instead of its bundled (older) version
55+ # LD_PRELOAD forces the library to be loaded first
56+ # LD_LIBRARY_PATH ensures symbol resolution finds the system library
57+ echo "LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libstdc++.so.6" >> "$GITHUB_ENV"
58+ echo "LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu:$LD_LIBRARY_PATH" >> "$GITHUB_ENV"
5759
5860 - name : Check out MHKiT-MATLAB
5961 uses : actions/checkout@v4
98100 release : ${{ matrix.matlab-version }}
99101
100102 # Generate run.m using Python to match Windows workflow approach
101- # Using InProcess mode for cache_population job
103+ # OutOfProcess mode with LD_PRELOAD allows Python to use system libstdc++
102104 - name : Generate run.m
103105 shell : bash -l {0}
104106 run : |
@@ -108,7 +110,7 @@ jobs:
108110
109111 python_exe = sys.executable
110112
111- content = f'''pyenv(Version='{python_exe}', ExecutionMode='InProcess ')
113+ content = f'''pyenv(Version='{python_exe}', ExecutionMode='OutOfProcess ')
112114 % Verify Python environment
113115 pe = pyenv;
114116 disp(pe);
0 commit comments