-
Notifications
You must be signed in to change notification settings - Fork 70
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
Limited support for stand-alone clients on Linux/macOS #8
Comments
So as it turns out, this is a fundamental issue with Unix-like operating systems — Linux same as macOS. I don't think it will ever be resolved in the way I was hoping. The problem starts with the fact that relying on Comsol is just one example of many. Such as Firefox and Chrome/Chromium were, until they fixed that. Whereas on Windows the Comsol executable is a binary file, The problem is exacerbated by the fact that the system function that loads external shared libraries on Linux, This explains why the script Commonly suggested work-arounds are re-starting the original Python process via Microsoft, for once, got this right. On Windows, the library loader does heed live changes to the search path, which is just |
As detailed in issue #8, setting the environment variable for the search path of shared libraries has no effect on the current process on Unix-like systems. And on Windows is not even needed. The code that does this was therefore removed. But a check was added for Linux and macOS that tests if the environment variable has been correctly set by the user beforehand if, and only if, a stand-alone client is to be initialized. Updated the documentation accordingly.
As detailed in issue #8, starting a stand-alone client does not work out of the box on Unix-like operating systems. Relying on the client-server mode instead seems to be the way forward. The test suite now uses that mode by default. Stand-alone clients can still be tested by passing the command-line argument "stand-alone" to a test script.
MPh 0.9.0, released today, provides the new convenience function |
MPh 0.8.0, released today, adds support for Linux. That support is slightly limited in that it does not fully work out of the box. In order to start a stand-alone client (as opposed to running the Comsol session in client-server mode), it requires the user take an extra step and configure the search path for shared libraries as described in the documentation.
This is fine, but not ideal. For one thing, it's not just
pip install
and be done with it. And for another, it prevents users from easily selecting a specific Comsol version as the computation back-end, which is sometimes useful when reproducing earlier simulation results. So ideally, the manual configuration would not be necessary, but instead be done from Python code.To perhaps track progress on this, or discuss a possible solution, here are some additional details. MPh now follows the instructions exactly as given in Comsol's Programming Manual (specifically, on pages 23 and 916) for running Java applications from the Eclipse IDE. That is, it sets up the environment in that same way before "initializing" the "stand-alone" client. (As opposed to a client-server connection, which works anyway, without any additional configuration.)
However, that alone does not do it. While all appears to be in working order as far as the Java Virtual Machine is concerned, in that it is aware of the locations of the external (native) libraries, these libraries themselves, which are dynamically loaded, have trouble finding each other, leading to a
java.lang.UnsatisfiedLinkError
. Which is odd: One would think that these child processes inherit the environment set up in the parent process.To showcase all of this, I have added the demo script
test_Linux
to thesandbox
branch.The text was updated successfully, but these errors were encountered: