Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More user-friendly procedure to avoid crash due to wrong libstdc++.so #53

Open
BenjaminRodenberg opened this issue Apr 16, 2024 · 9 comments

Comments

@BenjaminRodenberg
Copy link
Member

BenjaminRodenberg commented Apr 16, 2024

In our README.md we suggest the following procedure to start MATLAB, if version GLIBCXX_#.#.## is not found:

LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libstdc++.so.6 matlab

This follows the suggested approach from here.

I'm a bit unsure whether we should generally follow this procedure (assuming it is always or in most cases required) or rather treat it as pure troubleshooting (exceptional cases). I was a bit surprised that I actually do not need to set LD_PRELOAD on my system. Running the example case from precice/tutorials#480 worked for me without the need to set LD_PRELOAD.

There is also a list of supported gcc versions and this looks like we don't need to worry a lot. I would still suggest to keep the remark in the troubleshooting section, because I'm not a big fan of the fact that MATLAB brings along its own libstdc++.so and I assume this might lead to compatibility problems sooner or later.

I think it would be helpful to collect some data here in the comments and then decide what we should tell our users (and how to design the tutorials).

suggested format

  • gcc version (gcc --version): ...
  • MATLAB version (matlab -nodisplay -r "disp(version);exit;"): ...
  • tutorial/solverdummy works without setting LD_PRELOAD: yes/no

Important: We should also check this for the VM.

@BenjaminRodenberg
Copy link
Member Author

  • gcc version (gcc --version): (Ubuntu 10.5.0-1ubuntu1~20.04) 10.5.0
  • MATLAB version (matlab -nodisplay -r "disp(version);exit;"): 24.1.0.2537033 (R2024a)
  • tutorials/resonant-circuit works without setting LD_PRELOAD: yes

@NiklasVin
Copy link
Collaborator

NiklasVin commented Apr 17, 2024

  • gcc version (gcc --version): (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
  • MATLAB version (matlab -nodisplay -r "disp(version);exit;"): 23.2.0.2515942 (R2023b) Update 7
  • tutorials/resonant-circuit works without setting LD_PRELOAD: no

@BenjaminRodenberg
Copy link
Member Author

  • gcc version (gcc --version): (Ubuntu 10.5.0-1ubuntu1~20.04) 10.5.0
  • MATLAB version (/usr/local/MATLAB/R2022b/bin/matlab -nodisplay -r "disp(version);exit;"): 9.13.0.2105380 (R2022b) Update 2
  • tutorials/resonant-circuit works without setting LD_PRELOAD: yes

I also tried it out with an older MATLAB version on my system. This makes things even more confusing...

@BenjaminRodenberg
Copy link
Member Author

  • gcc version (gcc --version): (Ubuntu 10.5.0-1ubuntu1~20.04) 10.5.0
  • MATLAB version (~/Software/MATLAB/R2023b/bin/matlab -nodisplay -r "disp(version);exit;"): 23.2.0.2515942 (R2023b) Update 7
  • tutorials/resonant-circuit works without setting LD_PRELOAD: yes

Also no problems with MATLAB R2023b on my system. This is confusing for me considering what @NiklasVin reports above. Currently it looks like I cannot reproduce the problem.

@BenjaminRodenberg
Copy link
Member Author

  • gcc version (gcc --version): (Ubuntu 10.5.0-1ubuntu1~20.04) 10.5.0
  • MATLAB version (~/Software/MATLAB/R2020b/bin/matlab -nodisplay -r "disp(version);exit;"): 9.9.0.2037887 (R2020b) Update 8
  • tutorials/resonant-circuit works without setting LD_PRELOAD: no.

With R2020b I can reproduce the problem and get the following error:

Warning: The following error was caught while executing 'precice.Participant' class destructor:
Invalid MEX-file '/home/benjamin/Programming/matlab-bindings/+precice/@Participant/private/preciceGateway.mexa64': /home/benjamin/Software/MATLAB/R2020b/bin/glnxa64/../../sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.26' not found (required by /usr/local/lib/libprecice.so.3)

Error in precice.Participant/delete (line 40)
            preciceGateway(uint8(1));

Error in coil (line 4)
interface = precice.Participant("Coil", "../precice-config.xml", 0, 1); 
> In coil (line 4) 
Invalid MEX-file '/home/benjamin/Programming/matlab-bindings/+precice/@Participant/private/preciceGateway.mexa64': /home/benjamin/Software/MATLAB/R2020b/bin/glnxa64/../../sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.26' not found (required by /usr/local/lib/libprecice.so.3)

Error in precice.Participant (line 34)
            preciceGateway(uint8(0),ParticipantName,configFileName,int32(ProcessIndex),int32(ProcessSize));

Error in coil (line 4)
interface = precice.Participant("Coil", "../precice-config.xml", 0, 1);

@BenjaminRodenberg
Copy link
Member Author

  • gcc version (gcc --version): (Ubuntu 10.5.0-1ubuntu1~20.04) 10.5.0
  • MATLAB version (~/Software/MATLAB/R2021b/bin/matlab -nodisplay -r "disp(version);exit;"): 9.11.0.2358333 (R2021b) Update 7
  • tutorials/resonant-circuit works without setting LD_PRELOAD: no.
Warning: The following error was caught while executing 'precice.Participant' class destructor:
Invalid MEX-file '/home/benjamin/Programming/matlab-bindings/+precice/@Participant/private/preciceGateway.mexa64': /home/benjamin/Software/MATLAB/R2021b/bin/glnxa64/../../sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.26' not found (required by /usr/local/lib/libprecice.so.3)

Error in precice.Participant/delete (line 40)
            preciceGateway(uint8(1));

Error in coil (line 4)
interface = precice.Participant("Coil", "../precice-config.xml", 0, 1); 
> In coil (line 4) 
Invalid MEX-file '/home/benjamin/Programming/matlab-bindings/+precice/@Participant/private/preciceGateway.mexa64': /home/benjamin/Software/MATLAB/R2021b/bin/glnxa64/../../sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.26' not found (required by /usr/local/lib/libprecice.so.3)

Error in precice.Participant (line 34)
            preciceGateway(uint8(0),ParticipantName,configFileName,int32(ProcessIndex),int32(ProcessSize));

Error in coil (line 4)
interface = precice.Participant("Coil", "../precice-config.xml", 0, 1);

@BenjaminRodenberg
Copy link
Member Author

I tried to find a bugfix or similar hinting in this direction in the changelogs of MATLAB, but could not find anything. Therefore, I asked a question in the MATLAB Community forum: https://de.mathworks.com/matlabcentral/answers/2108031-has-issue-with-libstdc-so-6-been-fixed.

BenjaminRodenberg added a commit that referenced this issue Apr 17, 2024
Refer to #53 and provide more information.
@NiklasVin
Copy link
Collaborator

  • gcc version (gcc --version): (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
  • MATLAB version (matlab -nodisplay -r "disp(version);exit;"): 24.1.0.2568132 (R2024a) Update 1
  • tutorials/resonant-circuit works without setting LD_PRELOAD: no

@NiklasVin
Copy link
Collaborator

  • gcc version (gcc --version): (Ubuntu 10.5.0-1ubuntu1~20.04) 10.5.0

    • MATLAB version (~/Software/MATLAB/R2023b/bin/matlab -nodisplay -r "disp(version);exit;"): 23.2.0.2515942 (R2023b) Update 7

    • tutorials/resonant-circuit works without setting LD_PRELOAD: yes

Also no problems with MATLAB R2023b on my system. This is confusing for me considering what @NiklasVin reports above. Currently it looks like I cannot reproduce the problem.

Were the MATLAB versions for which the resonant circuit example worked for you fresh installations?
I checked whether you got an answer to your question in the MATLAB forum. The answer links to another thread explaining two different solutions how to avoid the issues I encountered. The first one is with the LD_PRELOAD and the other ansatz is to rename one problematic library in the MATLAB installation path. Maybe you did the renaming for your working examples in advance? Because I reinstalled the newest MATLAB version and it didn't work without the LD_PRELOAD out of the box, but as soon as I renamed the mentioned file, everything worked fine without the preload.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants