--enable-ssl not working

1,598 views
Skip to first unread message

Rao Saifullah

unread,
Feb 22, 2017, 3:32:39 AM2/22/17
to mongodb-user
I am using mongo-c driver ( 1.5.4). I followed the instructions mentioned here and ran this command.

$ sudo apt-get install pkg-config libssl-dev libsasl2-dev

after this i ran configure command as follows, 

./configure --enable-ssl=openssl --enable-sasl=yes --prefix=/path/to/mongoc_ssl/ --disable-automatic-init-and-cleanup --enable-static=yes --enable-examples=yes


This is my ./configure command results


But when i running a simple mongoc- code and connecting mLab



    mongoc_client_t *client;
    mongoc_collection_t *collection;
    bson_error_t error;
    int64_t count;

    mongoc_init ();

    client = mongoc_client_new ("mongodb://username:p...@ds000000.mlab.com:00000/db");
    collection = mongoc_client_get_collection (client, "db", "fs");
    count = mongoc_collection_count (collection, MONGOC_QUERY_NONE, NULL, 0, 0, NULL, &error);

    if (count < 0) {
        fprintf (stderr, "%s\n", error.message);
    } else {
        printf ("%" PRId64 "\n", count);
    }

    mongoc_collection_destroy (collection);
    mongoc_client_destroy (client);
    mongoc_cleanup ();


It is giving me error.

2017/02/22 17:09:48.0144: [31116]:    DEBUG:      cluster: Authentication failed: The "SCRAM-SHA-1" authentication mechanism requires libmongoc built with --enable-ssl
The "SCRAM-SHA-1" authentication mechanism requires libmongoc built with --enable-ssl


Any hint. When i built these drivers on windows platform and tried to connect the same db on mLab, it just displaying the collections and when i tried to get the list of grdifs files, it gave me error 

precondition failed.

I am using example from this link
my mLab deployment is using free SandBox.

Wan Bachtiar

unread,
Feb 27, 2017, 10:19:15 PM2/27/17
to mongodb-user

But when i running a simple mongoc- code and connecting mLab

Hi Rao,

I’ve tested your configure command, using mongo-c driver v1.5.4  (and latest v.1.6.0) also utilising your example snippet code and it's connected successfully.

My example code was compiled using below line:

$ gcc -o connect connect.c $(pkg-config --cflags --libs libmongoc-1.0)

Which in my case has expanded to:

$ gcc -o connect connect.c -I/path/to/mongoc_ssl/include/libmongoc-1.0 -I/path/to/mongoc_ssl/include/libbson-1.0 -L/path/to/mongoc_ssl/lib -lmongoc-1.0 -lsasl2 -lssl -lcrypto -lrt -lbson-1.0

Test was done on Ubuntu 16.04, connecting to mLab free SandBox.

Could you provide the following information:

  • What command did you use to compile your code ?
  • Did you make and make install after executing configure ?
  • Was there a previous compilation of mongo-c driver that wasn’t compiled with ssl option ?

Regards,

Wan.

Rao Saifullah

unread,
Mar 2, 2017, 7:43:48 PM3/2/17
to mongod...@googlegroups.com
Dear Wan,

Thanks for replying. I am using QtCreator on Ubuntu 14.04. Here is the pic explaining all of your questions and yes i ran make and make install. Even i tried to run all commands with root user. 

Inline image 1

In the above picture, you can see my .pro file and the libraries file folder. But still i am getting the same error which i mentioned in my original question. Here is my simple code output.

Inline image 2

Also, i have one question, can you get the list of GridFS files using mongoc driver connecting with SandBox? I am not getting success in this while working on windows platform.

Thanks for your support.

--
You received this message because you are subscribed to the Google Groups "mongodb-user"
group.
 
For other MongoDB technical support options, see: https://docs.mongodb.com/manual/support/
---
You received this message because you are subscribed to a topic in the Google Groups "mongodb-user" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/mongodb-user/sFubeEFxnOE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to mongodb-user+unsubscribe@googlegroups.com.
To post to this group, send email to mongod...@googlegroups.com.
Visit this group at https://groups.google.com/group/mongodb-user.
To view this discussion on the web visit https://groups.google.com/d/msgid/mongodb-user/29324a87-9abb-4e27-9563-ee9770ead9bc%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Wan Bachtiar

unread,
Mar 14, 2017, 9:42:21 PM3/14/17
to mongodb-user

Hi Rao,

$ gcc -o connect connect.c -I/path/to/mongoc_ssl/include/libmongoc-1.0 -I/path/to/mongoc_ssl/include/libbson-1.0 -L/path/to/mongoc_ssl/lib -lmongoc-1.0 -lsasl2 -lssl -lcrypto -lrt -lbson-1.0

Please see the expanded flags specified above again, especially related to SSL that your Makefile is missing.

Also, i have one question, can you get the list of GridFS files using mongoc driver connecting with SandBox? I am not getting success in this while working on windows platform.

You should be able to connect to GridFS using mongoc_client_get_gridfs(). See also Example: mongoc_gridfs_t . Make sure you are able to establish connection using SSL first.

Regards,

Wan.

Reply all
Reply to author
Forward
0 new messages