From mboxrd@z Thu Jan 1 00:00:00 1970 From: Leo Famulari Subject: Re: [PATCH 2/5] gnu: Build lua-5.2 with dynamic library support. Date: Tue, 10 Nov 2015 19:53:59 -0500 Message-ID: <1447203239.1756982.435572169.304A01DF@webmail.messagingengine.com> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:46091) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZwJfs-00043X-UY for guix-devel@gnu.org; Tue, 10 Nov 2015 19:54:10 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZwJfo-00026k-Qm for guix-devel@gnu.org; Tue, 10 Nov 2015 19:54:08 -0500 Received: from out4-smtp.messagingengine.com ([66.111.4.28]:46393) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZwJfo-00026R-N7 for guix-devel@gnu.org; Tue, 10 Nov 2015 19:54:04 -0500 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 43D6D20E05 for ; Tue, 10 Nov 2015 19:53:59 -0500 (EST) List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org To: guix-devel@gnu.org Forgot to send this to the list... On Sun, Nov 8, 2015, at 16:08, Ludovic Court=C3=A8s wrote: > Leo Famulari skribis: >=20 > > * gnu/packages/lua.scm (lua-5.2)[arguments]: Rewrite make-flags so that > > Lua is built with platform-specific instructions for shared library > > loading (dlopen). >=20 > Please move the explanations as a comment in the code. Okay. =20 > > #:phases (alist-replace > > 'build > > - (lambda _ (zero? (system* "make" "CFLAGS=3D-fPIC" "li= nux"))) > > + (lambda _ (zero? (system* "make" > > + "PLAT=3Dlinux" > > + "MYCFLAGS=3D-fPIC" > > + "MYLDFLAGS=3D-fPIC"))) >=20 > How can I test whether this works as expected? I tried this, but I=E2=80= =99m > unsure whether it=E2=80=99s supposed to load OpenSSL=E2=80=99s libssl.so = directly or > not: There is a Lua library named luasec that provides SSL. Luasec only supports lua-5.1 except in an alpha release (luasec-0.6). [1] I am able to load luasec by telling Lua where to look. I have lua-5.1 and luasec in my profile: $ LUA_PATH=3D~/.guix-profile/share/lua/5.1/\?.lua LUA_CPATH=3D~/.guix-profile/lib/lua/5.1/\?.so lua -lssl Lua 5.1.5 Copyright (C) 1994-2012 Lua.org, PUC-Rio >=20 ^ That is the Lua prompt, indicating that the Lua interpreter has successfully imported the SSL libraries. The '?' character is replaced by the component that Lua is currently searching for. So, if you invoke `lua -ssl`, the "?.so" in LUA_CPATH is replaced by ssl.so. > Apologies in advance if I=E2=80=99m just asking stupid questions! Not at all, everything I know about Lua I have learned trying to get Prosody packaged for Guix. I am about 1 week ahead of you in terms of Lua knowledge ;) > Besides, it would be nice to get rid of these hard-coded /usr/local in a > subsequent patch. This is related to my next step and I need some advice. We need to set LUA_PATH and LUA_CPATH properly in order for programs to load external Lua libraries. I have been installing Lua libraries into ${out}/lib/lua/${LUA_VERSION} and ${out}/share/lua/${LUA_VERSION}, so that they end up at, for example, ~/.guix-profile/lib/lua/5.1/ssl.so [2] Nixpkgs makes it all work by setting the paths in wrappers around programs that need to find Lua libraries. I don't fully understand how they generate the paths but I get the idea. Some examples: https://github.com/NixOS/nixpkgs/blob/master/pkgs/servers/xmpp/prosody/defa= ult.nix https://github.com/NixOS/nixpkgs/blob/master/pkgs/applications/video/quvi/t= ool.nix What do you think? Leo=20 [1] I have some of these packages defined in a WIP branch: https://github.com/lfam/guix/commits/contrib-lua [2] bourne shell variable syntax (don't have paredit in my email client)