Ubuntu 20.04: install MongoDB Driver for Lua – part 2


Part 2 install specific version of lua-mongo

Example we install version 1.1.0

Follow step 1 and 2 in part 1 : Ubuntu 20.04: install MongoDB Driver for Lua

Step 3: git clone https://github.com/neoxic/lua-mongo.git

root@Ubuntu-2004-focal-amd64-base ~ # git clone https://github.com/neoxic/lua-mongo.git
Cloning into 'lua-mongo'...
remote: Enumerating objects: 1081, done.
remote: Counting objects: 100% (141/141), done.
remote: Compressing objects: 100% (55/55), done.
remote: Total 1081 (delta 87), reused 133 (delta 82), pack-reused 940
Receiving objects: 100% (1081/1081), 261.63 KiB | 5.45 MiB/s, done.
Resolving deltas: 100% (770/770), done.

Step 4: cd lua-mongo

Step 5: git checkout 1.1.0

root@Ubuntu-2004-focal-amd64-base ~/lua-mongo # git checkout 1.1.0
Previous HEAD position was 73b4cd1 Version 1.2.2
HEAD is now at 57f7434 Version 1.1.0

Step 6: luarocks make

root@Ubuntu-2004-focal-amd64-base ~/lua-mongo # luarocks make
gcc -O2 -fPIC -I/usr/include/lua5.1 -c src/bson.c -o src/bson.o -I/usr/include/libmongoc-1.0 -I/usr/include/libbson-1.0
gcc -O2 -fPIC -I/usr/include/lua5.1 -c src/bsontype.c -o src/bsontype.o -I/usr/include/libmongoc-1.0 -I/usr/include/libbson-1.0
gcc -O2 -fPIC -I/usr/include/lua5.1 -c src/bulkoperation.c -o src/bulkoperation.o -I/usr/include/libmongoc-1.0 -I/usr/include/libbson-1.0
gcc -O2 -fPIC -I/usr/include/lua5.1 -c src/client.c -o src/client.o -I/usr/include/libmongoc-1.0 -I/usr/include/libbson-1.0
src/client.c: In function ‘m_command’:
src/client.c:33:2: warning: ‘mongoc_cursor_new_from_command_reply’ is deprecated: Use mongoc_cursor_new_from_command_reply_with_opts instead [-Wdeprecated-declarations]
   33 |  pushCursor(L, mongoc_cursor_new_from_command_reply(client, &reply, 0), 1);
      |  ^~~~~~~~~~
In file included from /usr/include/libmongoc-1.0/mongoc/mongoc-collection.h:28,
                 from /usr/include/libmongoc-1.0/mongoc/mongoc-client.h:26,
                 from /usr/include/libmongoc-1.0/mongoc/mongoc.h:29,
                 from /usr/include/libmongoc-1.0/mongoc.h:18,
                 from src/common.h:27,
                 from src/client.c:23:
/usr/include/libmongoc-1.0/mongoc/mongoc-cursor.h:80:1: note: declared here
   80 | mongoc_cursor_new_from_command_reply (struct _mongoc_client_t *client,
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
gcc -O2 -fPIC -I/usr/include/lua5.1 -c src/collection.c -o src/collection.o -I/usr/include/libmongoc-1.0 -I/usr/include/libbson-1.0
src/collection.c: In function ‘m_count’:
src/collection.c:50:2: warning: ‘mongoc_collection_count_with_opts’ is deprecated: Use mongoc_collection_count_documents or mongoc_collection_estimated_document_count instead [-Wdeprecated-declarations]
   50 |  int64_t n = mongoc_collection_count_with_opts(collection, MONGOC_QUERY_NONE, query, 0, 0, options, 0, &error);
      |  ^~~~~~~
In file included from /usr/include/libmongoc-1.0/mongoc/mongoc-client.h:26,
                 from /usr/include/libmongoc-1.0/mongoc/mongoc.h:29,
                 from /usr/include/libmongoc-1.0/mongoc.h:18,
                 from src/common.h:27,
                 from src/collection.c:23:
/usr/include/libmongoc-1.0/mongoc/mongoc-collection.h:106:1: note: declared here
  106 | mongoc_collection_count_with_opts (mongoc_collection_t *collection,
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/collection.c: In function ‘m_stats’:
src/collection.c:141:2: warning: ‘mongoc_collection_stats’ is deprecated [-Wdeprecated-declarations]
  141 |  return commandReply(L, mongoc_collection_stats(collection, options, &reply, &error), &reply, &error);
      |  ^~~~~~
In file included from /usr/include/libmongoc-1.0/mongoc/mongoc-client.h:26,
                 from /usr/include/libmongoc-1.0/mongoc/mongoc.h:29,
                 from /usr/include/libmongoc-1.0/mongoc.h:18,
                 from src/common.h:27,
                 from src/collection.c:23:
/usr/include/libmongoc-1.0/mongoc/mongoc-collection.h:293:1: note: declared here
  293 | mongoc_collection_stats (mongoc_collection_t *collection,
      | ^~~~~~~~~~~~~~~~~~~~~~~
src/collection.c: In function ‘m_validate’:
src/collection.c:158:2: warning: ‘mongoc_collection_validate’ is deprecated [-Wdeprecated-declarations]
  158 |  return commandReply(L, mongoc_collection_validate(collection, options, &reply, &error), &reply, &error);
      |  ^~~~~~
In file included from /usr/include/libmongoc-1.0/mongoc/mongoc-client.h:26,
                 from /usr/include/libmongoc-1.0/mongoc/mongoc.h:29,
                 from /usr/include/libmongoc-1.0/mongoc.h:18,
                 from src/common.h:27,
                 from src/collection.c:23:
/usr/include/libmongoc-1.0/mongoc/mongoc-collection.h:331:1: note: declared here
  331 | mongoc_collection_validate (mongoc_collection_t *collection,
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~
gcc -O2 -fPIC -I/usr/include/lua5.1 -c src/cursor.c -o src/cursor.o -I/usr/include/libmongoc-1.0 -I/usr/include/libbson-1.0
src/cursor.c: In function ‘m_isAlive’:
src/cursor.c:26:2: warning: ‘mongoc_cursor_is_alive’ is deprecated: Use mongoc_cursor_more instead [-Wdeprecated-declarations]
   26 |  lua_pushboolean(L, mongoc_cursor_is_alive(checkCursor(L, 1)));
      |  ^~~~~~~~~~~~~~~
In file included from /usr/include/libmongoc-1.0/mongoc/mongoc-collection.h:28,
                 from /usr/include/libmongoc-1.0/mongoc/mongoc-client.h:26,
                 from /usr/include/libmongoc-1.0/mongoc/mongoc.h:29,
                 from /usr/include/libmongoc-1.0/mongoc.h:18,
                 from src/common.h:27,
                 from src/cursor.c:23:
/usr/include/libmongoc-1.0/mongoc/mongoc-cursor.h:54:1: note: declared here
   54 | mongoc_cursor_is_alive (const mongoc_cursor_t *cursor)
      | ^~~~~~~~~~~~~~~~~~~~~~
gcc -O2 -fPIC -I/usr/include/lua5.1 -c src/database.c -o src/database.o -I/usr/include/libmongoc-1.0 -I/usr/include/libbson-1.0
gcc -O2 -fPIC -I/usr/include/lua5.1 -c src/flags.c -o src/flags.o -I/usr/include/libmongoc-1.0 -I/usr/include/libbson-1.0
gcc -O2 -fPIC -I/usr/include/lua5.1 -c src/gridfs.c -o src/gridfs.o -I/usr/include/libmongoc-1.0 -I/usr/include/libbson-1.0
gcc -O2 -fPIC -I/usr/include/lua5.1 -c src/gridfsfile.c -o src/gridfsfile.o -I/usr/include/libmongoc-1.0 -I/usr/include/libbson-1.0
gcc -O2 -fPIC -I/usr/include/lua5.1 -c src/gridfsfilelist.c -o src/gridfsfilelist.o -I/usr/include/libmongoc-1.0 -I/usr/include/libbson-1.0
gcc -O2 -fPIC -I/usr/include/lua5.1 -c src/main.c -o src/main.o -I/usr/include/libmongoc-1.0 -I/usr/include/libbson-1.0
gcc -O2 -fPIC -I/usr/include/lua5.1 -c src/objectid.c -o src/objectid.o -I/usr/include/libmongoc-1.0 -I/usr/include/libbson-1.0
gcc -O2 -fPIC -I/usr/include/lua5.1 -c src/util.c -o src/util.o -I/usr/include/libmongoc-1.0 -I/usr/include/libbson-1.0
gcc -shared -o mongo.so -L/usr/local/lib src/bson.o src/bsontype.o src/bulkoperation.o src/client.o src/collection.o src/cursor.o src/database.o src/flags.o src/gridfs.o src/gridfsfile.o src/gridfsfilelist.o src/main.o src/objectid.o src/util.o -L/usr/lib -L/usr/lib -Wl,-rpath,/usr/lib: -Wl,-rpath,/usr/lib: -lmongoc-1.0 -lbson-1.0
lua-mongo git-1 is now installed in /usr/local (license: MIT)

Done!

Leave a Reply