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

Static build support #1864

Merged
merged 4 commits into from Mar 13, 2024
Merged

Commits on Mar 7, 2024

  1. Fix a false positive "may be used uninitialized"

    Signed-off-by: Erik Boasson <eb@ilities.com>
    eboasson committed Mar 7, 2024
    Copy the full SHA
    504ef78 View commit details
    Browse the repository at this point in the history

Commits on Mar 13, 2024

  1. Support statically linked builds

    With apologies for the CMake abuse, this adds support for statically linking the Cyclone
    core library and the security and Iceoryx plugins.  It does not support statically linking
    IDLC because that would at best only support the C binding, but not other language
    bindings.  The recommendation for a static linked Cyclone is to build it as if it were a
    cross build to the native platform, that way the IDLC complications are avoided.
    
    Almost all the changes are in the build system, only the "dlopen" functions in ddsrt are
    modified to consult a table of compiled-in plugins first and some security tests need a
    small change in the specification of the security plugin wrapper libraries.
    
    The build system defines a global CMake property "plugin_list" containing a list of all
    the plugins to include, each plugin P defines a global "P_symbols" property that lists all
    the symbols to be exported from the library.  The modified "dlopen" functionality consults
    the table of plugins, the modified "dlsym" functionality consults the list of exported
    symbols.
    
    These properties are translated to macros on compiler command-line into comma-separated
    lists of plugin names (PLUGINS) and symbol names (PLUG_SUMBOLS_P for plugin P).  The
    macros are then expanded into static tables of names and addresses by the C preprocessor.
    
    For a static build, the plugins are defined as OBJECT libraries, "installed" because
    that's the only way I have found so far to keep CMake happy with the references, and
    pulled into the Cyclone library using the aforementioned properties.  For example:
    
      if(BUILD_SHARED_LIBS)
        add_library(dds_security_ac SHARED ${sources} ${private_headers})
      else()
        add_library(dds_security_ac OBJECT ${sources} ${private_headers})
        set_property(GLOBAL APPEND PROPERTY cdds_plugin_list dds_security_ac)
        set_property(GLOBAL PROPERTY dds_security_ac_symbols init_access_control finalize_access_control)
      endif()
    
    The other changes are then to only link the plugin against "ddsc" if building as a shared
    library and, sometimes, adding a bunch of include paths because it won't work otherwise.
    
    In a static build, the tests for PSMX that rely on the Cyclone-based plugin are disabled
    because of the complications that introduces.  Those tests do run if Iceoryx is available.
    
    Signed-off-by: Erik Boasson <eb@ilities.com>
    eboasson committed Mar 13, 2024
    Copy the full SHA
    701b927 View commit details
    Browse the repository at this point in the history
  2. Add static build on Linux to CI

    Signed-off-by: Erik Boasson <eb@ilities.com>
    eboasson committed Mar 13, 2024
    Copy the full SHA
    ed25331 View commit details
    Browse the repository at this point in the history
  3. Windows + choco OpenSSL 3.2.1 + CMake woes

    Installing openssl 3.2.1 with Chocolatey if openssl 1.x is already present gives
    interesting results (it uses the include files from 3.x but the libraries of 1.x).  You'd
    think that uninstalling openssl 1.x, then installing openssl 3.2.1 would solve all
    problems, but then CMake says it can't find OpenSSL at all, and indeed it can't find the
    libraries in the locations where it is looking for them.
    
    Signed-off-by: Erik Boasson <eb@ilities.com>
    eboasson committed Mar 13, 2024
    Copy the full SHA
    273b06b View commit details
    Browse the repository at this point in the history