From 8621e8a3e5525b87af9ca0f1e35a847160b13a21 Mon Sep 17 00:00:00 2001 From: Stephen Nneji Date: Tue, 25 Aug 2026 14:56:48 +0100 Subject: [PATCH 1/2] Fix for failing ARM Mac build --- compile/customWrapper/wrapperMexBuild.m | 7 ++++++- compile/fullCompile/generateCpps.m | 2 +- compile/fullCompile/generateMexFromCpp.m | 4 +++- compile/fullCompile/ratMainMexBuild.m | 8 +++++++- 4 files changed, 17 insertions(+), 4 deletions(-) diff --git a/compile/customWrapper/wrapperMexBuild.m b/compile/customWrapper/wrapperMexBuild.m index 76083ad71..003b5628a 100644 --- a/compile/customWrapper/wrapperMexBuild.m +++ b/compile/customWrapper/wrapperMexBuild.m @@ -5,7 +5,12 @@ if isunix args = {'-ldl'}; end + +flags = ''; +if ismac && strcmp(computer('arch'), 'maca64') + flags = 'LDFLAGS=$LDFLAGS -ld_classic'; +end includeDirs = getappdata(0,'includeDirs'); includes = strcat(repmat({'-I'}, 1,length(includeDirs)), includeDirs); -mex(includes{:}, "wrapperMex.cpp", args{:}); +mex(includes{:}, flags, "wrapperMex.cpp", args{:}); disp("wrapperMex compiled successfully"); diff --git a/compile/fullCompile/generateCpps.m b/compile/fullCompile/generateCpps.m index 87563762b..cce95dff7 100644 --- a/compile/fullCompile/generateCpps.m +++ b/compile/fullCompile/generateCpps.m @@ -4,7 +4,7 @@ [compilePath, ~, ~] = fileparts(mfilename("fullpath")); cd(compilePath); -ratMainMexBuild; +ratMainMexBuild(true); ratMainCodeGen; cppDeploy; diff --git a/compile/fullCompile/generateMexFromCpp.m b/compile/fullCompile/generateMexFromCpp.m index dbe4b9fad..200bedbf2 100644 --- a/compile/fullCompile/generateMexFromCpp.m +++ b/compile/fullCompile/generateMexFromCpp.m @@ -18,12 +18,14 @@ main_file = [mex_interface_path, '_coder_RATMain_mex.cpp']; if ismac if strcmp(computer('arch'), 'maci64') + flags = ''; ompLib = {['-L', fullfile(matlabroot, 'sys', 'os', 'maci64')], '-liomp5'}; else + flags = 'LDFLAGS=$LDFLAGS -ld_classic'; ompLib = {['-L', fullfile(matlabroot, 'toolbox', 'eml', 'externalDependency', 'omp', 'maca64', 'lib')], '-lomp'}; end includes{end+1} = ['-I', fullfile(matlabroot, 'toolbox', 'eml', 'externalDependency', 'omp', computer('arch'), 'include')]; - mex(includes{:}, 'CXXFLAGS=$CXXFLAGS -fPIC -Xpreprocessor -fopenmp -fvisibility=default -ffp-contract=off -std=c++11 -stdlib=libc++', main_file, sources{:}, '-output', 'RATMain_mex', '-v', '-lemlrt', '-lmwmathutil', '-lmwblas', '-lmwlapack', ompLib{:}) + mex(includes{:}, flags, 'CXXFLAGS=$CXXFLAGS -fPIC -Xpreprocessor -fopenmp -fvisibility=default -ffp-contract=off -std=c++11 -stdlib=libc++', main_file, sources{:}, '-output', 'RATMain_mex', '-v', '-lemlrt', '-lmwmathutil', '-lmwblas', '-lmwlapack', ompLib{:}) elseif isunix mex(includes{:}, 'CXXFLAGS=$CXXFLAGS -fopenmp -fvisibility=default -std=c++11', main_file, sources{:}, '-output', 'RATMain_mex', '-v', '-lemlrt', '-lmwmathutil', '-lmwblas', '-lmwlapack', ['-L"', matlabroot, '/sys/os/glnxa64"'], '-liomp5') else diff --git a/compile/fullCompile/ratMainMexBuild.m b/compile/fullCompile/ratMainMexBuild.m index 8db99b21b..cc802c800 100644 --- a/compile/fullCompile/ratMainMexBuild.m +++ b/compile/fullCompile/ratMainMexBuild.m @@ -1,13 +1,18 @@ +function ratMainMexBuild(codeOnly) % ratMainMexBuild % % Generates MEX-function (RATMain_mex) from RATMain. - +arguments + codeOnly {logical} = false +end % Create configuration object of class 'coder.MexCodeConfig'. cfg = coder.config('mex'); cfg.GenerateReport = true; +cfg.GenCodeOnly = codeOnly; cfg.EnableJIT = false; cfg.EnableOpenMP = true; cfg.TargetLang = 'C++'; +cfg.SIMDAcceleration = 'None'; % Define the input argument types.. ARGS = makeCompileArgsFull(); @@ -18,3 +23,4 @@ includes(1:2:end) = {'-I'}; includes(2:2:end) = includeDirs; codegen('RATMain', '-config', cfg, '-args', ARGS{1}, includes{:}); +end From 7a392f87ef19b72c4771191c6cd3874a6f7348bc Mon Sep 17 00:00:00 2001 From: Stephen Nneji Date: Tue, 25 Aug 2026 15:26:44 +0100 Subject: [PATCH 2/2] 2023b --- .github/workflows/runTests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/runTests.yml b/.github/workflows/runTests.yml index d0c75d323..3bc25cfd4 100644 --- a/.github/workflows/runTests.yml +++ b/.github/workflows/runTests.yml @@ -51,7 +51,7 @@ jobs: - name: Set up MATLAB uses: matlab-actions/setup-matlab@v2 with: - release: R2023a + release: R2023b products: Parallel_Computing_Toolbox - name: Build Mex and Run Tests uses: matlab-actions/run-command@v2