|
|
Experimental Physics and
| ||||||||||||||
|
|
Hi David,
There are 2 different static/shared switches in the EPICS build system, which have different effects.
When building a library, the setting SHARED_LIBRARIES=YES/NO tells the build whether to create a shared library or not. On Linux, setting it to YES to create a shared library (libXXX.so) also builds a static library (libXXX.a).
When building an executable or a shared library, the setting STATIC_BUILD=YES/NO tells the compiler & linker whether it may use shared libraries or not to resolve symbols at link-time. Setting it to YES should prevent linking to shared application libraries
while creating that target. Some targets don’t support completely static builds though: MacOS doesn’t come with static versions of some of the system libraries for example, so static builds fail here; on Linux the system libraries are always linked shared.
If your IOC executable is built by a different Makefile than the one that builds the library, the IOC’s Makefile is the one that needs the STATIC_BUILD=YES setting. However if you only need to control whether a particular library you’re building will be linked
statically or not, setting SHARED_LIBRARIES=NO when building that library will force all downstream linking of that library to use the static one without having to set STATIC_BUILD=YES in its Makefile — IOC executable builds can’t be linked to a shared library
that doesn’t exist.
If you do try this, make sure that you’ve removed all copies of the shared library, because if both exist most linkers will use the shared one by preference. Running ‘make distclean’ in the application’s top directory will remove all those files.
You can find out what shared libraries an IOC executable was linked against with ‘ldd’. It won’t list static libraries at all.
HTH,
- Andrew
-- Complexity comes for free, Simplicity you have to work for.
| ||||||||||||||
| ANJ, 19 Mar 2026 |
·
Home
·
News
·
About
·
Talk
·
Base
·
Modules
·
Extensions
·
· Distributions · Download · Documents · Links · Licensing · |