Opened 4 months ago

Last modified 4 months ago

#69283 new defect

lua @5.3.6_3 does not build on PPC Tiger, Mac OS X 10.4.11, because gmtime_r' and 'localtime_r' were not declared in this scope

Reported by: ballapete (Peter "Pete" Dyballa) Owned by:
Priority: Normal Milestone:
Component: ports Version: 2.9.1
Keywords: ppc tiger Cc: mcalhoun@…
Port: lua

Description

/opt/local/bin/g++-apple-4.2 -O2 -Wall -Wextra -DLUA_COMPAT_5_2 -DLUA_USE_MACOSX -I/opt/local/include -DLUA_COMPAT_5_1 -Os -arch ppc -I/opt/local/include -DLUA_COMPAT_5_1  -c -o loslib.o loslib.c
loslib.c: In function 'int os_date(lua_State*)':
loslib.c:290: error: 'gmtime_r' was not declared in this scope
loslib.c:294: error: 'localtime_r' was not declared in this scope
make[2]: *** [loslib.o] Error 1
make[2]: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_nue.de.rsync.macports.org_macports_release_tarballs_ports_lang_lua/lua/work/lua-5.3.6/src'
make[1]: *** [macosx] Error 2
make[1]: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_nue.de.rsync.macports.org_macports_release_tarballs_ports_lang_lua/lua/work/lua-5.3.6/src'
make: *** [macosx] Error 2
make: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_nue.de.rsync.macports.org_macports_release_tarballs_ports_lang_lua/lua/work/lua-5.3.6'
Command failed:  cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_nue.de.rsync.macports.org_macports_release_tarballs_ports_lang_lua/lua/work/lua-5.3.6" && /usr/bin/make -w echo macosx MACPORTS_PREFIX=/opt/local MYLDFLAGS="$LDFLAGS" MACPORTS_VERSION=5.3.6 TO_LIB=liblua.a MACPORTS_BRANCH=5.1 CXX="/opt/local/var/macports/build/_opt_local_var_macports_sources_nue.de.rsync.macports.org_macports_release_tarballs_ports_lang_lua/lua/work/compwrap/cxx/opt/local/bin/g++-apple-4.2" OBJC="/opt/local/var/macports/build/_opt_local_var_macports_sources_nue.de.rsync.macports.org_macports_release_tarballs_ports_lang_lua/lua/work/compwrap/objc/opt/local/bin/gcc-apple-4.2" OBJCXX="/opt/local/var/macports/build/_opt_local_var_macports_sources_nue.de.rsync.macports.org_macports_release_tarballs_ports_lang_lua/lua/work/compwrap/objcxx/opt/local/bin/g++-apple-4.2" INSTALL="/usr/bin/install -c" CC=/opt/local/bin/g++-apple-4.2 MYCFLAGS="$CPPFLAGS $CXXFLAGS" MYLDFLAGS="$LDFLAGS " LUA_A=liblua-c++.a MACPORTS_SHARED_LIB=liblua-c++.dylib 
Exit code: 2
Error: Failed to build lua: command execution failed

Attachments (1)

main.log (25.6 KB) - added by ballapete (Peter "Pete" Dyballa) 4 months ago.
Main.log from PPC Tiger, Mac OS X 10.4.11

Download all attachments as: .zip

Change History (6)

Changed 4 months ago by ballapete (Peter "Pete" Dyballa)

Attachment: main.log added

Main.log from PPC Tiger, Mac OS X 10.4.11

comment:1 Changed 4 months ago by ballapete (Peter "Pete" Dyballa)

Using configure.compiler=macports-gcc-7 I get:

/opt/local/bin/g++-mp-7 -O2 -Wall -Wextra -DLUA_COMPAT_5_2 -DLUA_USE_MACOSX -I/opt/local/include -DLUA_COMPAT_5_1 -Os -arch ppc -I/opt/local/include -DLUA_COMPAT_5_1  -c -o loslib.o loslib.c
loslib.c: In function 'int os_date(lua_State*)':
loslib.c:86:24: error: 'gmtime_r' was not declared in this scope
 #define l_gmtime(t,r)  gmtime_r(t,r)
                        ^
loslib.c:290:11: note: in expansion of macro 'l_gmtime'
     stm = l_gmtime(&t, &tmr);
           ^~~~~~~~
loslib.c:86:24: note: suggested alternative: 'gmtime'
 #define l_gmtime(t,r)  gmtime_r(t,r)
                        ^
loslib.c:290:11: note: in expansion of macro 'l_gmtime'
     stm = l_gmtime(&t, &tmr);
           ^~~~~~~~
loslib.c:87:26: error: 'localtime_r' was not declared in this scope
 #define l_localtime(t,r) localtime_r(t,r)
                          ^
loslib.c:294:11: note: in expansion of macro 'l_localtime'
     stm = l_localtime(&t, &tmr);
           ^~~~~~~~~~~
loslib.c:87:26: note: suggested alternative: 'localtime'
 #define l_localtime(t,r) localtime_r(t,r)
                          ^
loslib.c:294:11: note: in expansion of macro 'l_localtime'
     stm = l_localtime(&t, &tmr);
           ^~~~~~~~~~~
make[2]: *** [loslib.o] Error 1
make[2]: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_nue.de.rsync.macports.org_macports_release_tarballs_ports_lang_lua/lua/work/lua-5.3.6/src'

So it's quite clearly faulty code…

comment:2 Changed 4 months ago by ballapete (Peter "Pete" Dyballa)

/usr/include/time.h has:

    142 #if !defined(_ANSI_SOURCE) && !defined(_POSIX_C_SOURCE)
    143 char *asctime_r(const struct tm *, char *);
    144 char *ctime_r(const time_t *, char *);
    145 struct tm *gmtime_r(const time_t *, struct tm *);
    146 struct tm *localtime_r(const time_t *, struct tm *);
    147 time_t posix2time(time_t);
    148 #if !__DARWIN_UNIX03
    149 char *timezone(int, int);
    150 #endif /* !__DARWIN_UNIX03 */
    151 void tzsetwall(void);
    152 time_t time2posix(time_t); 
    153 time_t timelocal(struct tm * const);
    154 time_t timegm(struct tm * const);
    155 #endif /* neither ANSI nor POSIX */

Quite early we get

479:#undef _POSIX_C_SOURCE
480:#define _POSIX_C_SOURCE 200112L

from pre-processed output…

comment:3 Changed 4 months ago by ballapete (Peter "Pete" Dyballa)

The C source file has:

      1 /*
      2 ** $Id: loslib.c,v 1.65.1.1 2017/04/19 17:29:57 roberto Exp $
      3 ** Standard Operating System library
      4 ** See Copyright Notice in lua.h
      5 */
      6 
      7 #define loslib_c
      8 #define LUA_LIB
      9 
     10 #include "lprefix.h"
     11 
     12 
     13 #include <errno.h>
     14 #include <locale.h>
     15 #include <stdlib.h>
     16 #include <string.h>
     17 #include <time.h>
     18 
     19 #include "lua.h"
     20 
     21 #include "lauxlib.h"
     22 #include "lualib.h"
     23 

so that it should become this?

      1 /*
      2 ** $Id: loslib.c,v 1.65.1.1 2017/04/19 17:29:57 roberto Exp $
      3 ** Standard Operating System library
      4 ** See Copyright Notice in lua.h
      5 */
      6 
      7 #define loslib_c
      8 #define LUA_LIB
      9 
     10 #include "lprefix.h"
     11 
     12 
     13 #include <errno.h>
     14 #include <locale.h>
     15 #include <stdlib.h>
     16 #include <string.h>
        #undef _POSIX_C_SOURCE
     17 #include <time.h>
        #define _POSIX_C_SOURCE 200112L
     18 
     19 #include "lua.h"
     20 
     21 #include "lauxlib.h"
     22 #include "lualib.h"
     23 

comment:4 Changed 4 months ago by kencu (Ken)

Last edited 4 months ago by kencu (Ken) (previous) (diff)

comment:5 in reply to:  4 Changed 4 months ago by ballapete (Peter "Pete" Dyballa)

Replying to kencu:

With line

PortGroup                   legacysupport 1.1

before line

PortGroup                   makefile    1.0

lua built.

Note: See TracTickets for help on using tickets.