[liblua] Enable Position Independent Code by default.

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

[liblua] Enable Position Independent Code by default.

connor horman
Hello all,
I maintain a fork of lua to patch the makefile to include -fPIC, so I could link liblua.a to a shared library. I was wondering if there was a reason this wasn’t default, along with why only the executable(s) and the static lua was built by default? It seems like a limitation, as it prevents using lua in shared libraries, only in static libraries, or top level executables.
Thank you in advance for any input.
Reply | Threaded
Open this post in threaded view
|

Re: [liblua] Enable Position Independent Code by default.

Luiz Henrique de Figueiredo
> I maintain a fork of lua to patch the makefile to include -fPIC, so I could link liblua.a to a shared library. I was wondering if there was a reason this wasn’t default, along with why only the executable(s) and the static lua was built by default? It seems like a limitation, as it prevents using lua in shared libraries, only in static libraries, or top level executables.

See http://lua-users.org/lists/lua-l/2014-05/msg00381.html

Reply | Threaded
Open this post in threaded view
|

Re: [liblua] Enable Position Independent Code by default.

connor horman
Thank you. On -fPIC, is it a similar reason? While building a shared library is not directly a goal, the ability to link to a shared library is necessary.

On Mon, Dec 9, 2019 at 06:34 Luiz Henrique de Figueiredo <[hidden email]> wrote:
> I maintain a fork of lua to patch the makefile to include -fPIC, so I could link liblua.a to a shared library. I was wondering if there was a reason this wasn’t default, along with why only the executable(s) and the static lua was built by default? It seems like a limitation, as it prevents using lua in shared libraries, only in static libraries, or top level executables.

See http://lua-users.org/lists/lua-l/2014-05/msg00381.html

Reply | Threaded
Open this post in threaded view
|

Re: [liblua] Enable Position Independent Code by default.

Luiz Henrique de Figueiredo
> On -fPIC, is it a similar reason? While building a shared library is not directly a goal, the ability to link to a shared library is necessary.

AFAIK, a main program that embeds Lua does not need to be built with
-fPIC to be able to link to a shared library: lua.c has been doing it
forever.