Page MenuHomePhabricator

Can't build on Mac OS 10.13.2 as "timer_t" is not available on Mac OS
Open, Needs TriagePublicBUG REPORT

Description

Steps to Reproduce:

trying to install luasandbox via pecl or dowloaded from git and using make getting error unknown type name timer_t

Actual Results:

/private/tmp/pear/temp/LuaSandbox/luasandbox_types.h:13:2: error: unknown type name 'timer_t'; did you mean 'time_t'?
        timer_t timer;
        ^~~~~~~
        time_t
/usr/include/sys/_types/_time_t.h:31:26: note: 'time_t' declared here
typedef __darwin_time_t         time_t;
                                ^
1 error generated.
make: *** [alloc.lo] Error 1
ERROR: `make' failed

Expected Results:

Event Timeline

Aklapper renamed this task from Can't build on mac os 10.13.2 to Can't build on Mac OS 10.13.2 as "timer_t" is not available on Mac OS.Dec 13 2019, 10:16 AM

Hi @Edvardasmiksta, thanks for taking the time to report this and welcome to Wikimedia Phabricator!

timer_t is part of the POSIX standard but it is missing from Mac OS.
https://unix.stackexchange.com/questions/194480/why-is-timer-t-defined-in-time-h-on-linux-but-not-os-x basically...

Hi,

yes thank you i'm aware of that. But how can i install luasandbox on mac? in documentation mac is supported only real time will be used for time.
https://www.php.net/manual/en/luasandbox.requirements.php

Someone needs to provide a patch that fixes the issue. :)
If you like to provide a patch, you are very welcome to use developer access to submit the proposed code changes as a Git branch directly into Gerrit which makes it easier to review and provide feedback. If you don't want to set up Git/Gerrit, you can also use the Gerrit Patch Uploader.

LuaSandbox currently tests for the define CLOCK_REALTIME to determine whether the clock and timer types and functions are available. 2f028dc3 indicates that this check was specifically added for the benefit of Mac OS X. Are you saying there's a version of OS X that defines CLOCK_REALTIME but does not define the associated timer_t type?

Tried to upgrade mac os to 10.14.6. Problem still persists. tried to make manually with commented out if statements, successfully installed, however receive run time exception LuaSandboxFunction::call(): Unable to start limit timer.
Maybe where is some additional requirements for luasandbox?

Also having the problem here with 4.0.2 on macOS 11.6 (20G165) attempting to install via PECL. Is this project unmaintained now?

$ php --version
PHP 8.0.11 (cli) (built: Sep 26 2021 20:58:36) ( NTS )
Copyright (c) The PHP Group
Zend Engine v4.0.11, Copyright (c) Zend Technologies
    with Zend OPcache v8.0.11, Copyright (c), by Zend Technologies
    with Xdebug v3.0.4, Copyright (c) 2002-2021, by Derick Rethans
$ pecl install luasandbox
downloading LuaSandbox-4.0.2.tgz ...
Starting to download LuaSandbox-4.0.2.tgz (70,283 bytes)
.................done: 70,283 bytes
18 source files, building
running: phpize
Configuring for:
PHP Api Version:         20200930
Zend Module Api No:      20200930
Zend Extension Api No:   420200930

[...]

running: make
/bin/sh /private/tmp/pear/temp/pear-build-zacharyduboisxatOAE/LuaSandbox-4.0.2/libtool --mode=compile cc -I. -I/private/tmp/pear/temp/LuaSandbox -I/private/tmp/pear/temp/pear-build-zacharyduboisxatOAE/LuaSandbox-4.0.2/include -I/private/tmp/pear/temp/pear-build-zacharyduboisxatOAE/LuaSandbox-4.0.2/main -I/private/tmp/pear/temp/LuaSandbox -I/usr/local/Cellar/php/8.0.11/include/php -I/usr/local/Cellar/php/8.0.11/include/php/main -I/usr/local/Cellar/php/8.0.11/include/php/TSRM -I/usr/local/Cellar/php/8.0.11/include/php/Zend -I/usr/local/Cellar/php/8.0.11/include/php/ext -I/usr/local/Cellar/php/8.0.11/include/php/ext/date/lib -I/usr/local/include/lua-5.1  -DHAVE_CONFIG_H  -g -O2    -c /private/tmp/pear/temp/LuaSandbox/alloc.c -o alloc.lo
mkdir .libs
 cc -I. -I/private/tmp/pear/temp/LuaSandbox -I/private/tmp/pear/temp/pear-build-zacharyduboisxatOAE/LuaSandbox-4.0.2/include -I/private/tmp/pear/temp/pear-build-zacharyduboisxatOAE/LuaSandbox-4.0.2/main -I/private/tmp/pear/temp/LuaSandbox -I/usr/local/Cellar/php/8.0.11/include/php -I/usr/local/Cellar/php/8.0.11/include/php/main -I/usr/local/Cellar/php/8.0.11/include/php/TSRM -I/usr/local/Cellar/php/8.0.11/include/php/Zend -I/usr/local/Cellar/php/8.0.11/include/php/ext -I/usr/local/Cellar/php/8.0.11/include/php/ext/date/lib -I/usr/local/include/lua-5.1 -DHAVE_CONFIG_H -g -O2 -c /private/tmp/pear/temp/LuaSandbox/alloc.c  -fno-common -DPIC -o .libs/alloc.o
In file included from /private/tmp/pear/temp/LuaSandbox/alloc.c:13:
In file included from /private/tmp/pear/temp/LuaSandbox/php_luasandbox.h:19:
/private/tmp/pear/temp/LuaSandbox/luasandbox_types.h:30:2: error: unknown type name 'timer_t'; did you mean 'time_t'?
        timer_t timer;
        ^~~~~~~
        time_t
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/_types/_time_t.h:31:33: note: 'time_t' declared here
typedef __darwin_time_t         time_t;
                                ^
1 error generated.
make: *** [alloc.lo] Error 1
ERROR: `make' failed

It's certainly maintained and in active use, but I don't think any macOS developers are working on it, patches are always welcome though.