From mboxrd@z Thu Jan 1 00:00:00 1970 From: john at keeping.me.uk (John Keeping) Date: Sun, 23 Oct 2016 16:55:39 +0100 Subject: Linking cgit with Lua using -Wl,-E In-Reply-To: <564914cc-2ae6-ad15-f40c-4f033788999c@aegee.org> References: <7dcc34c2-6494-137b-79cb-0a3eb664e49a@aegee.org> <20161016115547.GG22407@john.keeping.me.uk> <564914cc-2ae6-ad15-f40c-4f033788999c@aegee.org> Message-ID: <20161023155539.GB3542@john.keeping.me.uk> I assume it's possible to build a shared library; I get both shared and static installed by my package manager. It looks like there is some performance concern about using a shared libary for Lua[1], but I doubt performance is critical for most uses with CGit so I would recommend building and linking to the Lua shared library if possible. If you need to link to the static library, I think it will be safer to use: -rdynamic -fvisibility=hidden but that will still expose all of the symbols from libgit.a, which was not designed to be used as a library by third-party code and thus does not prefix its symbols, so you still have to be wary of symbol collisions with other libraries. [1] http://article.gmane.org/gmane.comp.lang.lua.general/18519 On Fri, Oct 21, 2016 at 09:54:23AM +0200, ????? ???????? wrote: > liblua is linked statically. This is what you get, when you compile > Lua from source (no liblua.so). > > On 10/16/2016 01:55 PM, John Keeping wrote: > > On Sun, Oct 16, 2016 at 07:30:08AM +0200, ????? ???????? wrote: > >> on my system I wanted to link cgit with lua, so that lua can load the > >> (lua)crypto.so module. For this to work the symbol lua_gettop has to > >> be exported by cgit. I managed this by passing "-Wl,-E" to the > >> linker, when compiling cgit. > > > > How are you linking to liblua? I thought we normally linked that > > dynamically so the symbol should be exported from the shared library > > even if the cgit binary does not export symbols. > >