Skip to content

Source-build OpenSSL linker errors #41768

Closed

Description

@crummel

Source build is trying to build preview8 and we're running into linker errors in coreclr installer with what looks like OpenSSL:

RHEL7

  /home/chris/dotnet_source-build/artifacts/src/runtime.bf456654f9a4f9a86c15d9d50095ff29cde5f0a4/artifacts/bin/native/net5.0-Linux-Release-x64/libSystem.Security.Cryptography.Native.OpenSsl.a(apibridge.c.o): In function `local_X509_get_version':
  /home/chris/dotnet_source-build/artifacts/src/runtime.bf456654f9a4f9a86c15d9d50095ff29cde5f0a4/src/libraries/Native/Unix/System.Security.Cryptography.Native/apibridge.c:65: undefined reference to `ASN1_INTEGER_get'
  /home/chris/dotnet_source-build/artifacts/src/runtime.bf456654f9a4f9a86c15d9d50095ff29cde5f0a4/artifacts/bin/native/net5.0-Linux-Release-x64/libSystem.Security.Cryptography.Native.OpenSsl.a(apibridge.c.o): In function `local_OpenSSL_version_num':
  /home/chris/dotnet_source-build/artifacts/src/runtime.bf456654f9a4f9a86c15d9d50095ff29cde5f0a4/src/libraries/Native/Unix/System.Security.Cryptography.Native/apibridge.c:146: undefined reference to `SSLeay'
  /home/chris/dotnet_source-build/artifacts/src/runtime.bf456654f9a4f9a86c15d9d50095ff29cde5f0a4/artifacts/bin/native/net5.0-Linux-Release-x64/libSystem.Security.Cryptography.Native.OpenSsl.a(apibridge.c.o): In function `local_DSA_set0_pqg':
  /home/chris/dotnet_source-build/artifacts/src/runtime.bf456654f9a4f9a86c15d9d50095ff29cde5f0a4/src/libraries/Native/Unix/System.Security.Cryptography.Native/apibridge.c:214: undefined reference to `BN_free'
  /home/chris/dotnet_source-build/artifacts/src/runtime.bf456654f9a4f9a86c15d9d50095ff29cde5f0a4/src/libraries/Native/Unix/System.Security.Cryptography.Native/apibridge.c:220: undefined reference to `BN_free'
  /home/chris/dotnet_source-build/artifacts/src/runtime.bf456654f9a4f9a86c15d9d50095ff29cde5f0a4/src/libraries/Native/Unix/System.Security.Cryptography.Native/apibridge.c:226: undefined reference to `BN_free'

RHEL8:

  /usr/bin/ld: /mnt/sdc/chris/dotnet_source-build/artifacts/src/runtime.bf456654f9a4f9a86c15d9d50095ff29cde5f0a4/artifacts/bin/native/net5.0-Linux-Release-x64/libSystem.Security.Cryptography.Native.OpenSsl.a(pal_evp_cipher.c.o): undefined reference to symbol 'EVP_des_ecb@@OPENSSL_1_1_0'
  //usr/lib64/libcrypto.so.1.1: error adding symbols: DSO missing from command line

Full logs are attached. It seems like this might be related to https://github.com/dotnet/runtime/pull/39490/files. Any ideas what could be going on? cc @jeffschwMSFT @VSadov @safern @ViktorHofer @vitek-karas @swaroop-sridhar @agocke @omajid
rhel7-Linux.x64.Release-CMakeError.log
rhel7-Linux.x64.Release-CMakeOutput.log
rhel7-net5.0-Linux-Release-x64-CMakeError.log
rhel7-net5.0-Linux-Release-x64-CMakeOutput.log
rhel7-runtime.log
rhel.7-x64.Release-CMakeError.log
rhel.7-x64.Release-CMakeOutput.log
rhel8-net5.0-Linux-Release-x64-CMakeError.log
rhel8-net5.0-Linux-Release-x64-CMakeOutput.log
rhel8-runtime.log
rhel.8-x64.Release-CMakeError.log
rhel.8-x64.Release-CMakeOutput.log
rhel8-Linux.x64.Release-CMakeError.log
rhel8-Linux.x64.Release-CMakeOutput.log

Activity

  1. VSadov commented on Sep 2, 2020

    @VSadov
    Member

    CC: @janvorli - in case this looks familiar.

  2. janvorli commented on Sep 2, 2020

    @janvorli
    Member

    I think the source build doesn't use shim for OpenSSL and we are linking to it directly. This looks like we are missing libcrypto from the list of libraries. I wonder if we somehow incorrectly set the FEATURE_DISTRO_AGNOSTIC_SSL to true for source build on RHEL 8. That would cause the libcrypto and libssl to not to be included.

  3. crummel commented on Sep 3, 2020

    @crummel
    ContributorAuthor

    Thanks, I think that might be related:

    __CMakeArgs="-DFEATURE_DISTRO_AGNOSTIC_SSL=$__PortableBuild $__CMakeArgs"

    We set PortableBuild both true and false so I'll try forcing FEATURE_DISTRO_AGNOSTIC_SSL to false for both.

  4. added a commit that references this issue on Sep 3, 2020
  5. crummel commented on Sep 3, 2020

    @crummel
    ContributorAuthor

    Oh, I think this might actually go the other way. Setting it to true seems to fix the problem, although I haven't built all the way through yet.

  6. janvorli commented on Sep 3, 2020

    @janvorli
    Member

    Portable build is a build that supports all Linux distros. I have thought that source build is used to build just for a single specific distro. In that case, we don't need to search for SSL version (1.0.0, 1.0.2, 1.1 or version specified explicitly by CLR_OPENSSL_VERSION_OVERRIDE) at runtime, as it is known at build time. Thus the FEATURE_DISTRO_AGNOSTIC_SSL should be false.

  7. dagood commented on Sep 3, 2020

    @dagood
    Member

    I have thought that source build is used to build just for a single specific distro.

    Source-build needs to support both types: we (Microsoft) need(-ish) to produce a source tarball that is runnable on a variety of potentially unknown distros, so we should be as portable as we can. When a distro then runs that tarball, it will build non-portable, using the same sources but different flags. (However, someone building their own tarball for a specific distro--rather than using our tarball--can also I believe choose to build it non-portable.)

    (At a high level, this is complicated because the tarball contains a prebuilt SDK and some other artifacts to bootstrap the process if the build is being done offline.)

    In any case... dotnet/runtime should be able to rely on the infra passing in portable build params correctly. There's some more discussion at dotnet/source-build#1529 about the tarball scenarios wrt. portable/non-portable.

  8. omajid commented on Sep 16, 2020

    @omajid
    Member

    It seems like this might be related to https://github.com/dotnet/runtime/pull/39490/files. Any ideas what could be going on?

    It looks like the single file host simply forgot to check for the distro-agnostic-ssl mode and to link with the system OpenSSL if it's false.

  9. added a commit that references this issue on Sep 21, 2020
    3d325d4
  10. ghost closed this as completedin #42415on Sep 23, 2020
  11. ghost added a commit that references this issue on Sep 23, 2020
    eac3423
  12. ghost locked as resolved and limited conversation to collaborators on Dec 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions