Uploaded image for project: 'C++ Driver'
  1. C++ Driver
  2. CXX-210

Linking issue with libssh: multiple definition of `md5_init'

      I have a project which links to the libmongoclient and also to the libssh library.

      I either need to modify the libssh or the libmongoclient sources to get my project working, or it is going to crash like:

      MD5 ("") = adb82c4fe4a8d1b59c67f4b1ad76421f

            • ERROR, should be: d41d8cd98f00b204e9800998ecf8427e
              MD5 ("a") = 11282f436d90590eaf271e0d3caeb674
            • ERROR, should be: 0cc175b9c0f1b6a831c399e269772661
              MD5 ("abc") = 0e4175f2c3092db94d9a9a3eb8957e86
            • ERROR, should be: 900150983cd24fb0d6963f7d28e17f72
              MD5 ("message digest") = 2d40a812b33624ada656771ddfb256b4
            • ERROR, should be: f96b697d7cb7938d525a2f31aaf161d0
              MD5 ("abcdefghijklmnopqrstuvwxyz") = 94cd6bc9e2dbfe855b9f6174304aebb2
            • ERROR, should be: c3fcd3d76192e4007dfb496cca67e13b
              MD5 ("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789") = fd45297f8251ded620a6ef5ef71465b2
            • ERROR, should be: d174ab98d277d9f5a5611c2c9f419d9f
              MD5 ("12345678901234567890123456789012345678901234567890123456789012345678901234567890") = 72a81a34d0319a4df6bbd1932657a007
            • ERROR, should be: 57edf4a22be3c955ac49da2e2107b67a
              terminate called after throwing an instance of 'mongo::MsgAssertionException'
              what(): md5 unit test fails
              Aborted (core dumped)

      This happens if i link dynamically to libssh, currently it is not possible to link both libraries statically because of the following error:

      /usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../lib/libmongoclient.a(md5.o): In function `md5_init':
      (.text+0xc40): multiple definition of `md5_init'
      /usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/libssh.a(libcrypto.c.o).text+0x730): first defined here
      collect2: error: ld returned 1 exit status

      Package versions:
      $ dpkg -l | grep libssh-dev
      ii libssh-dev 0.6.1-0ubuntu3 amd64 tiny C SSH library. Development files
      ii mongodb-dev 1:2.4.9-1ubuntu2 amd64 object/document-oriented database (development)

      The problem seems to be still exists in the current git version, I am going to create a pull request with a small possibly fix for the issue...

            Assignee:
            andrew.morrow@mongodb.com Andrew Morrow (Inactive)
            Reporter:
            kedazo David Kedves
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: