Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
jingjingxyk opened this issue Aug 28, 2023 · 2 comments

Comments

@jingjingxyk
Copy link
Contributor

jingjingxyk commented Aug 28, 2023

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,
             ^


@jingjingxyk
Copy link
Contributor Author

jingjingxyk commented Aug 28, 2023

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
Copy link
Contributor Author

jingjingxyk commented Aug 28, 2023

修复 验证: 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant