Re: LuaJIT + shared library using iostream header = Undefined symbols.

  • From: Justin Cormack <justin@xxxxxxxxxxxxxxxxxxxxx>
  • To: luajit@xxxxxxxxxxxxx
  • Date: Fri, 27 Feb 2015 10:39:45 +0000

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

Other related posts: