ecmwf / ecflow

ECMWF's workflow manager
Apache License 2.0
41 stars 15 forks source link

Is it possible to build a statically linked ecflow? #5

Closed tstrempel closed 1 year ago

tstrempel commented 3 years ago

I would like to build ecflow with static linked binaries (ecflow_server, ecflow_client etc.), is this possible?

iainrussell commented 3 years ago

Hi @tstrempel,

ecFlow's own libraries are already built and linked statically, and boost will be linked statically by default (-DENABLE_STATIC_BOOST_LIBS=ON) so I think the only remaining issue is all the other libraries that it links in, e.g. libc, libm, Qt etc (if building the UI). I'm really not aware of a way to link these statically if you do not have static versions of them on your system, and I've never seem a system with static versions of them, they are usually (always?) shared.

I don't know if this answers your question, or if I maybe misunderstood - let me know :)

Best regards, Iain

AlexanderRichert-NOAA commented 1 year ago

I'm interested in doing the same, and have basically had luck with getting it to work, except that from what I can tell it doesn't seem to accommodate static openssl. In the Spack recipe, we get around it by patching the cmake and adding some link flags: https://github.com/JCSDA/spack/blob/jcsda_emc_spack_stack/var/spack/repos/builtin/packages/ecflow/package.py Would it be possible to either query the flags from openssl (i.e., from pkg-config), or if not, then have a cmake variable that can be used to customize the openssl flags (I seem to recall that modifying, e.g., $LIBS did not help, I forget exactly what the issue was though).

AlexanderRichert-NOAA commented 1 year ago

@marcosbento can you please address the question about openssl, or I can create a new issue if you prefer?

marcosbento commented 1 year ago

Hi @AlexanderRichert-NOAA

Sorry, I missed the outstanding question.

with the latest changes to the CMake files (currently still only in branch develop, but eventually to be released in 5.12), we are now using CMake targets instead of actually naming the libs. So, you should be able to define CMake hints such as -DOPENSSL_ROOT_DIR=/path/to/root/dir/to/openssl and set -DOPENSSL_USE_STATIC_LIBS=TRUE to search for static libraries instead of dynamic libraries.

Unfortunately, in our systems (both Linux and macOS) we only ever use dynamic libraries so I cannot guarantee that it works out of the box. Maybe you can tell us if something still prevents you from using static OpenSSL libraries.

marcosbento commented 1 year ago

Just for reference, the CMake hints for OpenSSL can be found in the usual documentation: https://cmake.org/cmake/help/v3.16/module/FindOpenSSL.html

AlexanderRichert-NOAA commented 1 year ago

Thanks @marcosbento, that sounds good. I'll test this out when I get a chance and update here with results.