Debian, Custom LUA module - "Couldn't load module library!"

Hi, I’m trying to compile a simple testing module for debian (x64, jessie), but require(‘module’) gives me an error: Couldn’t load module library!
After that I run the server with “LD_LIBRARY_PATH=garrysmod/bin:bin:. LD_DEBUG=libs”, and got this:


28514:     <...>/garrysmod/lua/bin/gmsv_testmodule_linux.dll: error: symbol lookup error: undefined symbol: _Z14Sys_GetFactoryPKc (fatal)

[ERROR] addons/testmodule/lua/autorun/autoload.lua:18: Couldn't load module library!
  1. require - [C]:-1
   2. unknown - addons/testmodule/lua/autorun/autoload.lua:18


Module code:


#include <Lua/Interface.h>
#include <tier1.h>
#include <eiface.h>

GMOD_MODULE_OPEN()
{
	printf( "
[li] Opening test module ...[/li]" );
	auto engineFn = Sys_GetFactory( "engine.so" );
	...

	return 0;
}

GMOD_MODULE_CLOSE()
{
	printf( "[li] Test module exited[/li]" );
	return 0;
}


Module info:


$ ldd <...>/garrysmod/lua/bin/gmsv_testmodule_linux.dll
        linux-gate.so.1 (0xf7704000)
        libtier0.so => not found
        libvstdlib.so => not found
        libstdc++.so.6 => /usr/lib32/libstdc++.so.6 (0xf7601000)
        libm.so.6 => /lib/i386-linux-gnu/i686/cmov/libm.so.6 (0xf75bb000)
        libgcc_s.so.1 => /lib/i386-linux-gnu/libgcc_s.so.1 (0xf759e000)
        libc.so.6 => /lib/i386-linux-gnu/i686/cmov/libc.so.6 (0xf73f1000)
        /lib/ld-linux.so.2 (0xf7707000)


IIRC Sys_GetFactory is defined in the tier1 library. Make sure your module is linking with tier1.a

There appears to be a missing referece to libtier0 and libvstdlib also.

That actually has nothing to do with it. Those libraries will already be loaded into gmod by the time this module loads, and won’t be an issue.

Thank you, I’ve been change the linker order to “-l:tier1.a -lvstdlib -ltier0” and that’s help.