[CXX-210] Linking issue with libssh: multiple definition of `md5_init' Created: 24/Apr/14  Updated: 03/Jul/14  Resolved: 05/May/14

Status: Closed
Project: C++ Driver
Component/s: Implementation
Affects Version/s: None
Fix Version/s: legacy-0.9.0

Type: Bug Priority: Major - P3
Reporter: David Kedves Assignee: Andrew Morrow (Inactive)
Resolution: Done Votes: 0
Labels: legacy-cxx
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Ubuntu 14.04 LTS


Issue Links:
Duplicate
is duplicated by CXX-248 md5_* cause symbol clashes Closed

 Description   

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...



 Comments   
Comment by Andrew Morrow (Inactive) [ 01/May/14 ]

https://github.com/mongodb/mongo-cxx-driver/pull/69

And see also: https://github.com/mongodb/mongo-cxx-driver/pull/64

Comment by David Kedves [ 24/Apr/14 ]

A possibly fix could be this:
https://github.com/mongodb/mongo/pull/668

(or really rename those methods to be 'mongo' specific... it is always bad idea to have too generic names in libraries, even if it is a static one...)

Br,
David

Generated at Wed Feb 07 21:58:31 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.