swoole/swoole-cli

ext/swoole/ext-src/swoole_http_response.cc:1018:13: error: use of undeclared identifier 'strlcat'; did you mean 'strncat'?

Closed this issue · 2 comments

build environment :

debian 12
clang

image

swoole_http_response.lo  -MMD -MF ext/swoole/ext-src/swoole_http_response.dep -MT ext/swoole/ext-src/swoole_http_response.lo
/work/ext/swoole/ext-src/swoole_http_response.cc:1002:9: error: use of undeclared identifier 'strlcat'; did you mean 'strncat'?
        strlcat(cookie, "; Max-Age=0", cookie_size);
        ^~~~~~~
        strncat
/usr/include/string.h:152:14: note: 'strncat' declared here
extern char *strncat (char *__restrict __dest, const char *__restrict __src,
             ^
/work/ext/swoole/ext-src/swoole_http_response.cc:1018:13: error: use of undeclared identifier 'strlcat'; did you mean 'strncat'?
            strlcat(cookie, "; expires=", cookie_size);
            ^~~~~~~
            strncat
/usr/include/string.h:152:14: note: 'strncat' declared here
extern char *strncat (char *__restrict __dest, const char *__restrict __src,
             ^
/work/ext/swoole/ext-src/swoole_http_response.cc:1027:13: error: use of undeclared identifier 'strlcat'; did you mean 'strncat'?
            strlcat(cookie, date, cookie_size);
            ^~~~~~~
            strncat
/usr/include/string.h:152:14: note: 'strncat' declared here
extern char *strncat (char *__restrict __dest, const char *__restrict __src,
             ^
/work/ext/swoole/ext-src/swoole_http_response.cc:1030:13: error: use of undeclared identifier 'strlcat'; did you mean 'strncat'?
            strlcat(cookie, "; Max-Age=", cookie_size);
            ^~~~~~~
            strncat
/usr/include/string.h:152:14: note: 'strncat' declared here
extern char *strncat (char *__restrict __dest, const char *__restrict __src,
             ^
/work/ext/swoole/ext-src/swoole_http_response.cc:1040:13: error: use of undeclared identifier 'strlcat'; did you mean 'strncat'?
            strlcat(cookie, Z_STRVAL_P(&max_age), cookie_size);
            ^~~~~~~
            strncat
/usr/include/string.h:152:14: note: 'strncat' declared here
extern char *strncat (char *__restrict __dest, const char *__restrict __src,
             ^


environment: debian 12 clang

build command:

git clone -b build_native_php   https://github.com/swoole/swoole-cli.git

cd swoole-cli 

sh sapi/quickstart/linux/run-debian-container.sh

sh sapi/quickstart/linux/connection-swoole-cli-debian.sh

sh sapi/quickstart/setup-php-runtime.sh --mirror china 

export PATH="/work/bin/runtime:$PATH"
alias php="php -c /work/bin/runtime/php.ini"

php prepare.php +swoole_latest  --with-override-default-enabled-ext=1  --with-install-library-cached=1

# and 
php prepare.php +swoole_latest  -pdo_sqlite   --with-install-library-cached=1


bash make-install-deps.sh

bash make.sh all-library

bash make.sh config

bash make.sh build

修复 验证: jingjingxyk/swoole-src#2

sapi/src/builder/extension/swoole_latest.php

        ->withDownloadScript(
            'swoole-src',
            <<<EOF
            # git clone -b master --depth=1 https://github.com/swoole/swoole-src.git
            git clone -b fix_strlcat --depth=1 https://github.com/jingjingxyk/swoole-src.git
EOF
        )
CFLAGS=" -D_BSD_SOURCE  -D_GNU_SOURCE "  
# no working 

# -lbsd  
# no working 

不知道应该用那个?先试试看

https://en.cppreference.com/w/c/string/byte

https://en.cppreference.com/w/cpp/string/byte