[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Building Lua 5.3 from Lua.org on FreeBSD
- From: Russell Haley <russ.haley@...>
- Date: Sat, 29 Jul 2017 10:00:27 -0700
On Fri, Jul 28, 2017 at 9:05 AM, Luiz Henrique de Figueiredo
<lhf@tecgraf.puc-rio.br> wrote:
>> I try to draw attention to the inconsistency, especially since you
>> went to the trouble to make a target for FreeBSD.
>
> I'd love if we could make the bsd and freebsd targets the same:
>
> bsd:
> $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_POSIX -DLUA_USE_DLOPEN" SYSLIBS="-Wl,-E"
>
>
> freebsd:
> $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_LINUX" SYSLIBS="-Wl,-E -lreadline"
>
> Currently, the difference is just support for LUA_USE_READLINE.
> Any bsd experts around? Does the bsd target work in freebsd or vice-versa?
>
> Support for readline is the major source of noise in the Makefile,
> even in Linux. It currently requires that the readline headers be
> installed, and they come from a dev package which is not in the default
> installation.
>
>> A mathematician's solution would be to generalize, Linux, Max OSX and
>> FreeBSD all being special cases of OSIX (something not quite POSIX,
>> get it?) Then LUA_USE_OSIX offends no one and is understood by
>> no one. Fair enough?
>
> I'd love if all *ix system were the same and reduce the targets to
> posix and ix, but alas life is not simple. Not even POSIX systems are
> the same: some support for dynamic loading, some don't. Some that do,
> required -ldl, others don't. Some require "-Wl,-E", others don't. Hence
> the many variations:
>
> bsd:
> SYSCFLAGS="-DLUA_USE_POSIX -DLUA_USE_DLOPEN" SYSLIBS="-Wl,-E"
>
> freebsd:
> SYSCFLAGS="-DLUA_USE_LINUX" SYSLIBS="-Wl,-E -lreadline"
>
> linux:
> SYSCFLAGS="-DLUA_USE_LINUX" SYSLIBS="-Wl,-E -ldl -lreadline"
>
> macosx:
> SYSCFLAGS="-DLUA_USE_MACOSX" SYSLIBS="-lreadline" CC=cc
>
> posix:
> SYSCFLAGS="-DLUA_USE_POSIX"
>
> solaris:
> SYSCFLAGS="-DLUA_USE_POSIX -DLUA_USE_DLOPEN -D_REENTRANT" SYSLIBS="-ldl"
>
> I'd love to reduce the number of targets if this would reduce noise
> and at the same time worked in many platforms. But I don't know how.
> I welcome concrete suggestions from those who have access to these
> platforms.
1)The Dream:
As I am unfamiliar with readline and the code that is involved in the
user interface, I am free from the pesky details of reality to ask
this question:
It seems to me that the Lua command line interpreter would have very
few requirements and a library like readline would be rather
over-engineered for more complex requirements. Is there any reason you
don't just write your own (or steal from readline) library and be done
with it?
Then, if the defines are flipped on their head and there is one define
for LUA_USE_WINDOWS, the LUA_USE_POSIX and LUA_USE_DLOPEN could
potentially be removed as it's common to all.
2) Other Platforms:
Solaris
I've also been scouring Solaris man pages for details about dlopen:
dlopen(3)
http://docs.oracle.com/cd/E19253-01/816-5168/6mbb3hr6v/index.html
ld(1)
http://docs.oracle.com/cd/E19253-01/816-5165/ld.so.1-1/index.html
Linker and Libraries Guide
http://docs.oracle.com/cd/E19253-01/817-1984/chapter3-1/index.html
Burried way down in the middle of the Linker and Library Guide:
"Note –
In previous releases of the Solaris OS, the dynamic linking interfaces
were made available by the shared object libdl.so.1. libdl.so.1
remains available to support any existing dependencies. However, the
dynamic linking interfaces offered by libdl.so.1 are now available
from libc.so.1. Linking with -ldl is no longer necessary."
So potentially Linux is the only platform that requires -ldl.
AIX
I am looking at the AIX 7.2 documentation and I don't see anything
either way. A search for -ldl provided no clarification. However
documentation seems to indicate -b[rlt] is still required when a *.so
object is used.
https://www.ibm.com/support/knowledgecenter/ssw_aix_72/com.ibm.aix.cmds3/ld.htm
"Libraries are files whose names end in .a, or possibly .so. To
designate a library, you can specify an absolute or relative path name
or use the -l (lowercase letter L) flag in the form -lName. The last
form designates a libName.a file, or when the rtl option is used, a
libName.so file to be searched for in several directories. These
search directories include any directories that are specified by -L
flags and the standard library directories /usr/lib and /lib.Libraries
are files whose names end in .a, or possibly .so. To designate a
library, you can specify an absolute or relative path name or use the
-l (lowercase letter L) flag in the form -lName. The last form
designates a libName.a file, or when the rtl option is used, a
libName.so file to be searched for in several directories. These
search directories include any directories that are specified by -L
flags and the standard library directories /usr/lib and /lib."
3) Makefile Re-organization:
Once again, I'll throw an idea out there that I have no experience to
back. What about moving more esoteric targets such as AIX and Solaris
out of the main makefile together? Then there would be only two
potential targets in the main makefile: One for Windows and one for
common *Nix patforms. The main makefile could be linked to a second
makefile that contains targets specific to Solaris, AIX (and I
potentially want to add MINIX3 and RTEMS to the list).
4) Windows Target:
I also think that a target for Windows should use the Windows compiler
and tools (i.e. msbuild, VC etc) if possible (without having to
purchase Visual Studio). However, that's a different can of worms (and
a different project!
https://github.com/RussellHaley/PUC-Lua-VS2017-Solution/tree/master/lua-5.3.4/Visual%20Studio
-> still can't build the main lua library as a .dll?).
Also, Linux Subsystem For Windows may provide a future path for Lua to
use *Nix targets effectively. I predict(guess) that as Open Source
*Nix gains more traction (yes, GNU/Linux. grumble), Microsoft will
abandon their own kernel with the first announcement sometime in the
next 5-7 years.
For what It's Worth,
Russ