Giter Club home page Giter Club logo

Comments (12)

Semphriss avatar Semphriss commented on June 4, 2024 1

It works!

Thanks so much for your help!

from lua-mongo.

neoxic avatar neoxic commented on June 4, 2024

Note : the compiler gave me some trouble (I had to specify that I was using Lua 5.2, and it said : -- Using Lua '5.2', version 5.1.5), not sure if it's related.

This is probably related. Your mongo.so is probably built against Lua 5.1 and not Lua 5.2. You can check this by issuing a command:

ldd /usr/local/lib/lua/5.2/mongo.so

Also, why use CMake? Try installing via LuaRocks.

from lua-mongo.

Semphriss avatar Semphriss commented on June 4, 2024

I'm not sure which library is Lua, so here's the whole output :

	linux-vdso.so.1 (0x00007ffe94eee000)
	libmongoc-1.0.so.0 => /usr/local/lib/libmongoc-1.0.so.0 (0x00007f3576947000)
	libbson-1.0.so.0 => /usr/local/lib/libbson-1.0.so.0 (0x00007f3576908000)
	libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f3576717000)
	libsasl2.so.2 => /lib/x86_64-linux-gnu/libsasl2.so.2 (0x00007f35766fa000)
	libssl.so.1.1 => /lib/x86_64-linux-gnu/libssl.so.1.1 (0x00007f3576668000)
	libcrypto.so.1.1 => /lib/x86_64-linux-gnu/libcrypto.so.1.1 (0x00007f3576393000)
	librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f3576386000)
	libresolv.so.2 => /lib/x86_64-linux-gnu/libresolv.so.2 (0x00007f357636b000)
	libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f3576348000)
	/lib64/ld-linux-x86-64.so.2 (0x00007f3576a2d000)
	libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f3576342000)

I tried building with LuaRocks, but it couldn't detect libbson :

$ sudo luarocks make
[sudo] password for user: 

Error: Could not find library file for LIBBSON
  No file bson-1.0 in /usr/local/lib
  No file bson-1.0 in /usr/local/lib/x86_64-linux-gnu
  No file bson-1.0 in /usr/lib
  No file bson-1.0 in /usr/lib/x86_64-linux-gnu
You may have to install LIBBSON in your system and/or pass LIBBSON_DIR or LIBBSON_LIBDIR to the luarocks command.
Example: luarocks install lua-mongo LIBBSON_DIR=/usr/local

Libbson was installed as a dependency when I installed the Mongo C Driver, but I can't seem to find any file names "bson-1.0" anywhere in any related folder.


Now that I notice it, it says "libbson-1.0.so.0" and the dependency asks for 1.16+. Am I looking at the correct place for the version number?

from lua-mongo.

Semphriss avatar Semphriss commented on June 4, 2024

Alright, I think I got it :

$ apt-cache show libbson-1.0
Package: libbson-1.0-0
Architecture: amd64
Version: 1.15.0-1
Priority: optional
Section: universe/libs
Source: mongo-c-driver
Origin: Ubuntu

"Version: 1.15.0-1", literally one below.

Do you know where I can find an up-to-date version of libbson? The Mongo C Driver site only tells me to download it from apt...

from lua-mongo.

neoxic avatar neoxic commented on June 4, 2024

from lua-mongo.

Semphriss avatar Semphriss commented on June 4, 2024

I've played a bit with the paths and found that both are in /usr/local.

Now I get a compilation error :

$ sudo luarocks install lua-mongo LIBBSON_DIR=/usr/local/ LIBMONGOC_DIR=/usr/local/
Installing https://luarocks.org/lua-mongo-1.2.1-1.src.rock
gcc -O2 -fPIC -I/usr/include/lua5.2 -c src/bson.c -o src/bson.o -I/usr/local/include/libmongoc-1.0 -I/usr/local/include/libbson-1.0
In file included from src/bson.c:23:
src/common.h:25:10: fatal error: lauxlib.h: No such file or directory
   25 | #include <lauxlib.h>
      |          ^~~~~~~~~~~
compilation terminated.

Error: Build error: Failed compiling object src/bson.o

Any ideas?

from lua-mongo.

neoxic avatar neoxic commented on June 4, 2024

Is there lauxlib.h in /usr/include/lua5.2 ?

from lua-mongo.

Semphriss avatar Semphriss commented on June 4, 2024

I think I found something...

/usr/include/lua5.1/lauxlib.h

Yes, Lua 5.1... No idea why, because running lua5.2 works, but running Lua5.1 only prompts me to install it through apt.

I manually renamed the folder to lua5.2 (I know I shouldn't do this but I'm investigating) and it compiled properly.

I'll keep following the installation steps and I'll come back with news ASAP. Thanks for putting me on the right road!

from lua-mongo.

neoxic avatar neoxic commented on June 4, 2024

Yes, it looks more and more that you have Lua 5.1 vs 5.2 messed up in the system. You need to untangle that first. Otherwise, things will go wonky.

from lua-mongo.

neoxic avatar neoxic commented on June 4, 2024

It also could be that you have Lua 5.1 headers installed but not for Lua 5.2. Try installing a lua5.2-devel package or whatever is relevant for your system. Note that you always need Lua headers to build modules written in C.

from lua-mongo.

Semphriss avatar Semphriss commented on June 4, 2024

It seems to work!

I did sudo apt-get install lua5.2-dev, recompiled the module with LuaRocks, and the test script isn't printing any error anymore!

I'll try editing a collection to see if it really works :)

from lua-mongo.

neoxic avatar neoxic commented on June 4, 2024

Great! I’m closing this then....

from lua-mongo.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.