https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97369
--- Comment #3 from Seager Du <xianping.du at gmail dot com> --- (In reply to Jonathan Wakely from comment #1) > You haven't provided sufficient information to tell, but I doubt there's a > bug here. > > Please read these links and confirm if you're using the right libstdc++.so > at run time (the one from your self-compile GCC 6.3.0, not the system > compiler): > https://gcc.gnu.org/onlinedocs/libstdc++/faq.html#faq.how_to_set_paths > https://gcc.gnu.org/onlinedocs/libstdc++/manual/using_dynamic_or_shared. > html#manual.intro.using.linkage.dynamic > > I've said it before, but the fact that matlab 2020 only works with a GCC > version that has been unsupported for two years is stupid. You are right. I checked the manually compiled GCC6.3 and found the lib64 was not exported to the path. This fixed the compiling problem with the S-function. Thank you! Now, a new error appeared as using Simulink to call S-function: "Stack Trace (from fault): [ 0] 0x00007fc361b66d11 /cache/sw/packages/MATLAB/R2020a/bin/glnxa64/mkl.so+23264529 mkl_blas_avx2_xidamax_nonan+00000417 [ 1] 0x00007fc361a33a0c /cache/sw/packages/MATLAB/R2020a/bin/glnxa64/mkl.so+22006284 mkl_blas_avx2_xidamax+00000060 [ 2] 0x00007fc360bff186 /cache/sw/packages/MATLAB/R2020a/bin/glnxa64/mkl.so+07111046 mkl_blas_xidamax+00000086 [ 3] 0x00007fc360b831ad /cache/sw/packages/MATLAB/R2020a/bin/glnxa64/mkl.so+06603181 mkl_blas_idamax+00000861 [ 4] 0x00007fc36132acdf /cache/sw/packages/MATLAB/R2020a/bin/glnxa64/mkl.so+14630111 mkl_lapack_dgetf2_team+00000975 [ 5] 0x00007fc36132a84c /cache/sw/packages/MATLAB/R2020a/bin/glnxa64/mkl.so+14628940 mkl_lapack_dgetrf_local_team+00002812 [ 6] 0x00007fc36132a00b /cache/sw/packages/MATLAB/R2020a/bin/glnxa64/mkl.so+14626827 mkl_lapack_dgetrf_local_team+00000699 [ 7] 0x00007fc36132a00b /cache/sw/packages/MATLAB/R2020a/bin/glnxa64/mkl.so+14626827 mkl_lapack_dgetrf_local_team+00000699 [ 8] 0x00007fc36132a00b /cache/sw/packages/MATLAB/R2020a/bin/glnxa64/mkl.so+14626827 mkl_lapack_dgetrf_local_team+00000699 [ 9] 0x00007fc36132a00b /cache/sw/packages/MATLAB/R2020a/bin/glnxa64/mkl.so+14626827 mkl_lapack_dgetrf_local_team+00000699 [ 10] 0x00007fc36132a00b /cache/sw/packages/MATLAB/R2020a/bin/glnxa64/mkl.so+14626827 mkl_lapack_dgetrf_local_team+00000699 [ 11] 0x00007fc360a83888 /cache/sw/packages/MATLAB/R2020a/bin/glnxa64/mkl.so+05556360 mkl_lapack_dgetrf+00001816 [ 12] 0x00007fc79d50f9f3 /cache/sw/packages/MATLAB/R2020a/bin/glnxa64/../../sys/os/glnxa64/libiomp5.so+00973299 __kmp_invoke_microtask+00000147 [ 13] 0x00007fc79d4cff96 /cache/sw/packages/MATLAB/R2020a/bin/glnxa64/../../sys/os/glnxa64/libiomp5.so+00712598 [ 14] 0x00007fc79d4cef81 /cache/sw/packages/MATLAB/R2020a/bin/glnxa64/../../sys/os/glnxa64/libiomp5.so+00708481 [ 15] 0x00007fc79d50fe8b /cache/sw/packages/MATLAB/R2020a/bin/glnxa64/../../sys/os/glnxa64/libiomp5.so+00974475 [ 16] 0x00007fc7b4cd2e65 /lib64/libpthread.so.0+00032357 [ 17] 0x00007fc7b446388d /lib64/libc.so.6+01042573 clone+00000109 Abnormal termination: Segmentation violation Register State (from fault): RAX = 0000000000000001 RBX = 00007fc1253f1798 RCX = 0000000000000000 RDX = 0000000000000001 RSP = 00007fc1253f0318 RBP = 0000000000000000 RSI = 000000004aaaaaa8 RDI = 00007fc1253f1798 R8 = 00007fe3a0cba0d0 R9 = 000000004aaaaaa8 R10 = 4b7649c000000000 R11 = 0000000000000000 R12 = 00007fe3a0cba0d0 R13 = 00007fc365ec5ac8 R14 = 00007fc365ec57d8 R15 = 00007fc1253f2048 RIP = 00007fc361b66d11 EFL = 0000000000010246 CS = 0033 FS = 0000 GS = 0000 Stack Trace (from fault): ** This crash report has been saved to disk as /home/xd101/matlab_crash_dump.9925-6 **" It seems the MKL related lib was used but I did use the blas and lapack for software compiling. I am not sure if this is related to the GCC. Maybe, it is related to the Matlab, so I am waiting the response from the developer of that software to see what is the exact problem. In addition, I agree with you that the Matlab should compatible with more GCC versions for facilitating users. I know they just support more versions in their MATLAB 2020b, but we do not have it in our cluster now.