lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On 7 August 2015 at 14:11, Dirk Laurie <dirk.laurie@gmail.com> wrote:
> For linking with other interfaces to the Lua libraries, I added the following
> to the Makefile.
>
> 1. -fPIC on CFLAGS.
> 2. A new target.
> liblua.so: $(BASE_O)
>     cc -shared $(BASE_O) -o liblua.so
>
> Making that target triggers a warning I do not get with `make linux`.
>
> $ make liblua.so
> cc -shared lapi.o lcode.o lctype.o ldebug.o ldo.o ldump.o lfunc.o
> lgc.o llex.o lmem.o lobject.o lopcodes.o lparser.o lstate.o lstring.o
> ltable.o ltm.o lundump.o lvm.o lzio.o lauxlib.o lbaselib.o lbitlib.o
> lcorolib.o ldblib.o liolib.o lmathlib.o loslib.o lstrlib.o ltablib.o
> lutf8lib.o loadlib.o linit.o  -o liblua.so
> loslib.o: In function `os_tmpname':
> loslib.c:(.text+0x29d): warning: the use of `tmpnam' is dangerous,
> better use `mkstemp'
>
> `man mkstemp` reveals its availability under the following conditions:
>
> mkstemp():
>            _BSD_SOURCE || _SVID_SOURCE || _XOPEN_SOURCE >= 500 ||
>            _XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED
>            || /* Since glibc 2.12: */ _POSIX_C_SOURCE >= 200112L
>

Lua does use mkstemp if you set LUA_USE_POSIX.
See: http://www.lua.org/source/5.3/loslib.c.html#LUA_TMPNAMTEMPLATE

LUA_USE_POSIX is defined by `make linux`.
I'm guessing your new target doesn't define it?