I understand that you would like to export a Simulink Model with S-Function Block as a standalone FMU.
Based on the error message you provided, I suspect that S-Function Block is can only detect the mex binaries but not the source code. For Simulink to generate code for this case, you will need to provide either source code or object file of the S-Function. I recommend you place the S-Function source code next to your mex file so that S-Function block can located it.
I attached a small example to export a timestwo s-function as FMU in 2020a for your reference. Please see the attachment.