|
39 | 39 | os: [ubuntu-latest, macos-13, windows-latest] |
40 | 40 | matlab: [R2023a, latest] |
41 | 41 | solver: [uobyqa, newuoa, bobyqa, lincoa, cobyla] |
| 42 | + use_system_libgcc: [true] # Whether to use the system libgcc or the one shipped with MATLAB. |
42 | 43 |
|
43 | 44 |
|
44 | 45 | steps: |
@@ -121,6 +122,58 @@ jobs: |
121 | 122 | cache: true |
122 | 123 | products: Optimization_Toolbox Parallel_Computing_Toolbox |
123 | 124 |
|
| 125 | + - name: Link system libgcc to MATLAB if needed |
| 126 | + if: startsWith(matrix.os, 'ubuntu') |
| 127 | + shell: bash |
| 128 | + run: | |
| 129 | + matlab_root=$(realpath $(dirname $(which matlab))/../) |
| 130 | + echo "MATLAB root is ${matlab_root}" |
| 131 | +
|
| 132 | + matlab_libgcc="${matlab_root}/sys/os/glnxa64/libgcc_s.so.1" |
| 133 | + echo "MATLAB libgcc is:" |
| 134 | + ls -alh ${matlab_libgcc} || exit 42 |
| 135 | + echo "gcc strings in MATLAB libgcc are:" |
| 136 | + strings ${matlab_libgcc} | grep -iE "^GCC_" |
| 137 | + echo "latest gcc version string in MATLAB libgcc is:" |
| 138 | + readelf -V ${matlab_libgcc} | grep -oiE 'GCC_([0-9]+)(.[0-9]+){0,2}' | sort -V | tail -1 |
| 139 | +
|
| 140 | + system_libgcc="/usr/lib/x86_64-linux-gnu/libgcc_s.so.1" |
| 141 | + echo "System libgcc is:" |
| 142 | + ls -alh ${system_libgcc} || exit 42 |
| 143 | + echo "gcc strings in system libgcc are:" |
| 144 | + strings ${system_libgcc} | grep -iE "^GCC_" |
| 145 | + echo "latest gcc version string in system libgcc is:" |
| 146 | + readelf -V ${system_libgcc} | grep -oiE 'GCC_([0-9]+)(.[0-9]+){0,2}' | sort -V | tail -1 |
| 147 | +
|
| 148 | + if [[ "${{ matrix.use_system_libgcc }}" == "true" ]] ; then |
| 149 | + ln -sf ${system_libgcc} ${matlab_libgcc} || exit 42 |
| 150 | + echo "Linked ${system_libgcc} to ${matlab_libgcc}." |
| 151 | + else |
| 152 | + echo "Keep ${matlab_libgcc} untouched." |
| 153 | + fi |
| 154 | + echo "After the operation, MATLAB libgcc is:" |
| 155 | + ls -alh ${matlab_libgcc} || exit 42 |
| 156 | + echo "gcc strings in MATLAB libgcc are:" |
| 157 | + strings ${matlab_libgcc} | grep -iE "^GCC_" |
| 158 | + echo "latest gcc version string in MATLAB libgcc is:" |
| 159 | + readelf -V ${matlab_libgcc} | grep -oiE 'GCC_([0-9]+)(.[0-9]+){0,2}' | sort -V | tail -1 |
| 160 | +
|
| 161 | + - name: Revise getMexLibgcc and compiled.m to print necessary information |
| 162 | + run: | |
| 163 | + cd matlab/setup_tools || exit 42 |
| 164 | + $SEDI 's|\(.*lddOut.*\);|\1|' getMexLibgcc.m |
| 165 | + $SEDI 's|\(.*Path.*\);|\1|' getMexLibgcc.m |
| 166 | + $SEDI 's|\(.*String.*\);|\1|' getMexLibgcc.m |
| 167 | + $SEDI 's|\(.*Version.*\);|\1|' getMexLibgcc.m |
| 168 | + cat getMexLibgcc.m |
| 169 | + $SEDI 's|\(common_mex_options\s*=\s*.*$\)$|\1\ncommon_mex_options{:}|' compile.m |
| 170 | + $SEDI 's|\(.*\s*=\s*getMexLibgcc().gccVersion.*\)|\1\ngetMexLibgcc() |' compile.m |
| 171 | + $SEDI 's|\(.*_version\s*=\s*.*\);|\1 |' compile.m |
| 172 | + $SEDI 's|\(compiler_options\s*=\s*.*\);|\1 |' compile.m |
| 173 | + $SEDI "s|\(if\s*~support_internal_procedures\)|verLessThan('matlab', '25.1'), verLessThan('matlab', '25.2'), compiler_manufacturer, compiler_options, support_internal_procedures\n\1|" compile.m |
| 174 | + cat compile.m |
| 175 | +
|
| 176 | +
|
124 | 177 | - name: Conduct the test |
125 | 178 | uses: matlab-actions/[email protected] |
126 | 179 | with: |
|
0 commit comments