Awesome. That did the trick too, and much more cleanly, of course ;) Atenciosamente / Sincerely, Guilherme PrĂ¡ Vieira <http://www.linkedin.com/in/n2liquid> <http://www.linkedin.com/in/n2liquid> On Fri, Feb 27, 2015 at 7:39 AM, Justin Cormack < justin@xxxxxxxxxxxxxxxxxxxxx> wrote: > On 27 February 2015 at 05:20, Guilherme Vieira <super.driver.512@xxxxxxxxx > > wrote: > >> I just figured I can workaround that problem by using the LD_PRELOAD >> environment variable when invoking luajit, e.g.: >> `LD_PRELOAD=/path/to/libstdc++.so luajit main.lua'. >> >> I noticed lunar.so (my shared lib) doesn't appear to depend on >> libstdc++.so, so I guess this is why ffi.load / dlopen don't load it as a >> dependency: >> >> $ ldd lunar.so >> linux-vdso.so.1 => (0x00007fffb0a96000) >> libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f489b9ed000) >> /lib64/ld-linux-x86-64.so.2 (0x00007f489bfcd000) >> >> Does anyone know whether it's possible to make GCC specify libstdc++ as a >> dependency when building shared libraries? >> >> > Try adding -Wl,--no-as-needed -lstdc++ -Wl,--as-needed to your build > command > > Justin > > >