I’d like to know whether to use static library or not.
My aim is to conduct FSI simulations utilising CalculiX and OpenFoam.
If I have to use it as a static library, how do I specify the dependencies correctly?
If I shouldn’t use it as a static library, what else should I use it as? How do I build it?
P.S. I am almost there. Thanks for all the help until now.
I edited the title of your post to better describe the actual question: does one need to use preCICE as a static library (Linux: libprecice.a) or as a shared library (libprecice.so)?
Short answer: Shared library is enough and is preferred.
Long answer: You can use both, but keep in mind that:
Some linkers in some cases prefer static libraries over shared libraries. If you have both in the same path and in the same name (just different extension), you may get your code linked to the static library by default. This could be complicated, as you would need to also link to the dependencies of preCICE. If you have both without needing the static library, it would be easier to just delete it.
Even if you use preCICE as a shared library and the linker can find it (no problems in wmake.log), the runtime linker also needs to be able to find it. For this reason you need (when you don’t have preCICE installed in a directory known to the linker) to set your LD_LIBRARY_PATH.
In your case, the error has nothing to do with using preCICE as a static library (you actually use it as a shared library and this I get from your ldd.log, where I see that it is looking for libprecice.so.1.6.1, but it cannot find it:
libprecice.so.1.6.1 => not found
It is the follwed by a long list of undefined symbols related to precice::SolverInterface:
As I see in your Allwmake output, preCICE is not in your LD_LIBRARY_PATH. Where have you installed it? This is a common problem, as I explained before: libprecice cannot be found (at runtime).
Maybe irrelevant, but in your Allwmake output I also see:
ADAPTER_PKG_CONFIG_CFLAGS = -I/usr/local/include
I don’t understand why you have your PKG_CONFIG_PATH (which is where this is extracted from) set to /usr/local/include, while you have preCICE installed in your home directory (from the previous discussion).
Sorry for the late reply…
I’d really like to thank you for all the time and efforts you put into replying my topics.
All credit to you, I was successfully able to run my first FSI simulation.
I was perplexed at the start of my project whether to opt for opensource solvers or commercial software.
After the amount of support I received from this community, I am switching to opensource for every one of my needs.
Lastly, thanks for developing preCICE itself.
I shall definitely try to contribute whatever I can to the discussions in this forum.
And obviously, I’ll be sure to add citations in whatever humble work I wish to produce.
Thank you.
Thank you very much for your kind words, @nithinadidela, your comment made my day!
The community contributing here would be crucial, as we want to help users help themselves (and each other). We hope that the discussions here serve as self-learning material.
When you get results, we would be happy to showcase your work in our Testimonials page.