Wake Me Up When September Ends.

A wanderer capable of grasping the beauty of the grass, with a heart full of ancient charm, and a fondness for playful wit. Those who understand my words are knowledgeable individuals; those who decipher my code truly comprehend the essence. I am a wandering code swordsman, carrying my skills and riding freely through the digital world.

问题

使用php8.1.11-apline镜像构建安装event扩展,构建一点流程没有发生任何错误,但是启动容器之后报如下错误:

1
2
3
4
Warning: PHP Startup: Unable to load dynamic library 'event' (tried: /usr/local/lib/php/extensions/no-debug-non-zts-20210902/event (/usr/local/lib/php/extensions/no-debug
-non-zts-20210902/event: cannot open shared object file: No such file or directory), /usr/local/lib/php/extensions/no-debug-non-zts-20210902/event.so (/usr/local/lib/php/
extensions/no-debug-non-zts-20210902/event.so: undefined symbol: socket_ce)) in Unknown on line 0

后来搜索一下得知是因为event与另外的sockets扩展启动顺序问题,sockets需在event之前启动!

解决办法

/usr/local/etc/php/conf.d/目录下的文件docker-php-ext-event.ini重命名为docker-php-ext-z-event.ini,让它排在 docker-php-ext-sockets.ini后面即可。

参考链接

php8 安装 event 扩展后报错

使用Clion作为C++开发,需要安装C++ g++ make 等编译工具链,ubuntu提供了一个build-essential工具直接帮我们把c/c++对应的编译工具链依赖安装好

1
sudo apt-get install build-essential

搜索一下可能与node的版本有关,目前可以确认node17以下没啥问题,node18以上需要执行如下命令:

1
export NODE_OPTIONS=--openssl-legacy-provider

内存溢出的错误如下所示:

<— JS stacktrace —>

FATAL ERROR: Ineffective mark-compacts near heap limit Allocationfailed - JavaScript heap out of memory

—– Native stack trace —-

解决办法如下:

1
2
3
4
#linux
export NODE_OPTIONS="--max-old-space-size=(X * 1024)" # Increase to X GB
#windows
set NODE_OPTIONS="--max-old-space-size=(X * 1024)" # Increase to X GB

参考连接:https://stackoverflow.com/questions/50230339/npm-error-0308010c-digital-envelope-routines-unsupported