Linux Modules not loading

I downloaded and compiled the example binary module and compiled it. I tried requiring it in game, and it gave me an error saying “Couldn’t load module!” with a very small and unhelpful stack trace. On Ubuntu 12.04, module saved as gmcl_example_linux.dll inside garrysmod/lua/bin

Any ideas?

for server or client?

This test was with client, I haven’t tried server yet.

[editline]30th June 2014[/editline]

Just tried server, same thing.



lua_run require'example'
> require'example'...

[ERROR] lua_run:1: Couldn't load module library!
  1. require - [C]:-1
   2. unknown - lua_run:1


[ERROR] lua_run:1: Couldn't load module library!
  1. require - [C]:-1
   2. unknown - lua_run:1



try launching the server with LD_DEBUG=files to see more debug info.



lua_run require'example'
> require'example'...
      2952:	
      2952:	file=/home/gmod/server/garrysmod/lua/bin/gmsv_example_linux.dll [0];  dynamically loaded by /home/gmod/server/garrysmod/bin/lua_shared_srv.so [0]

[ERROR] lua_run:1: Couldn't load module library!
  1. require - [C]:-1
   2. unknown - lua_run:1


[ERROR] lua_run:1: Couldn't load module library!
  1. require - [C]:-1
   2. unknown - lua_run:1



…what?

okay that didn’t reveal anything. you can try LD_DEBUG=libs next. After that I’m not sure what to try.



lua_run require'example'
> require'example'...

[ERROR] lua_run:1: Couldn't load module library!
  1. require - [C]:-1
   2. unknown - lua_run:1


[ERROR] lua_run:1: Couldn't load module library!
  1. require - [C]:-1
   2. unknown - lua_run:1



Nothing.

[editline]30th June 2014[/editline]

Like I don’t even know how to debug, there’s no debugging tools for this as far as I can tell.

LD_DEBUG=libs should have printed a lot of info but yeah, it’s a bit tricky, but usually there aren’t many reasons for it to fail.

You’ll want to inspect the dependencies with ldd. You mentioned you used Ubuntu 12.04 so it’s possible you might be dynamically linked against a newer version of glibc or libstdc++ than what’s distributed with the game.

How would I check for something like this?

Rate this dumb all you want I dont no anything about C++ but I do know Linux cannot recognize capitals In addons/job codes for Servers Not sure it applies here if it doesnt sorry :frowning: Just trying to help

Thanks for the input, but that doesn’t really matter in this case. You can tell the game is detecting the module because it’s an error in loading the module itself, if it were a problem with finding it, you would get an error saying the module was not found.

[editline]30th June 2014[/editline]

aha, using ldd, I have discovered libstdc++ isn’t being found!



matt@vps:/home/gmod/server$ ldd srcds_linux
	linux-gate.so.1 =>  (0xf777e000)
	libm.so.6 => /lib32/libm.so.6 (0xf774b000)
	libdl.so.2 => /lib32/libdl.so.2 (0xf7746000)
	libstdc++.so.6 => not found
	libpthread.so.0 => /lib32/libpthread.so.0 (0xf772b000)
	libc.so.6 => /lib32/libc.so.6 (0xf7584000)
	/lib/ld-linux.so.2 (0xf777f000)


[editline]30th June 2014[/editline]

Update: fixed the issue with libstdc++ by installing lib32stdc++6, but that didn’t fix my issue.

[editline]30th June 2014[/editline]

Okay, final update. I fixed the problem, the Makefiles were building it against the 64 bit version of libc, I had to manually edit the Makefile to use a 32 bit version.