Extended Operation error reporting undefined symbol based on phpx

wrote a simple container using phpx and wanted to run it in php to do some testing. I have successfully written a dispatch_function to register in swoole before this, and it works well. After
, I wrote another CPP class, created a new PHP class, and registered the methods of the CPP class with the PHP class. The compilation passed, but PHP failed to load the extension with an error

PHP Warning:  PHP Startup: Unable to load dynamic library "/mypath/mango.so" (tried: /mypath/mango.so (/mypath/mango.so: undefined symbol: _ZN7Context4poolE)...

CPP source code is as follows

PHP_INCLUDE = `php-config --includes`
PHP_LIBS = `php-config --libs`
PHP_LDFLAGS = `php-config --ldflags`
PHP_INCLUDE_DIR = `php-config --include-dir`
PHP_EXTENSION_DIR = `php-config --extension-dir`

mango.so: mango.cpp
    cPP -DHAVE_CONFIG_H -g -o mango.so -O0 -fPIC -shared mango.cpp -std=cPP11 ${PHP_INCLUDE} -I${PHP_INCLUDE_DIR} -lphpx\
     -I${PHP_INCLUDE_DIR}/ext/swoole/include -I${PHP_INCLUDE_DIR}/ext/swoole
install: mango.so
    cp mango.so ${PHP_EXTENSION_DIR}/
clean:
    rm *.so

because I haven"t touched CPP for many years, I basically gave it back to the teacher. I don"t know what went wrong. I asked the boss for help to see where the problem was.

Oct.14,2021

Context::pool is only declared and not defined. Refer to https://en.cppreference.com/w.

.
Menu