我正在尝试使用 GCC 在 Ubuntu 机器上编译 nginx。我的 Glibc 版本是 2.31。
\nm@feynman:~/Junk/nginx-1.9.9\n$ /lib/x86_64-linux-gnu/libc.so.6 --version\nGNU C Library (Ubuntu GLIBC 2.31-0ubuntu9.2) stable release version 2.31.\nRun Code Online (Sandbox Code Playgroud)\n我从https://nginx.org/download/下载了一堆不同的版本,并尝试使用它们,但每次都失败。
\n./configure --with-threads --with-http_ssl_module --with-cc-opt="-Wno-error"\nmake\nRun Code Online (Sandbox Code Playgroud)\n./configure 在中生成以下文件objs/Makefile:
CC = cc\nCFLAGS = -pipe -O -W -Wall -Wpointer-arith -Wno-unused -Werror -g -Wno-error\nCPP = cc -E\nLINK = $(CC)\n\n...\nRun Code Online (Sandbox Code Playgroud)\n这给了我下面这个错误。
\ncc -c -pipe -O -W -Wall -Wpointer-arith -Wno-unused -Werror -g -Wno-error -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs \\\n -o objs/src/os/unix/ngx_posix_init.o \\\n src/os/unix/ngx_posix_init.c\ncc -c -pipe -O -W -Wall -Wpointer-arith -Wno-unused -Werror -g -Wno-error -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs \\\n -o objs/src/os/unix/ngx_user.o \\\n src/os/unix/ngx_user.c\nsrc/os/unix/ngx_user.c: In function \xe2\x80\x98ngx_libc_crypt\xe2\x80\x99:\nsrc/os/unix/ngx_user.c:36:7: error: \xe2\x80\x98struct crypt_data\xe2\x80\x99 has no member named \xe2\x80\x98current_salt\xe2\x80\x99\n 36 | cd.current_salt[0] = ~salt[0];\n | ^\nmake[1]: *** [objs/Makefile:749: objs/src/os/unix/ngx_user.o] Error 1\nmake[1]: Leaving directory \'/home/m/Junk/nginx-1.9.9\'\nmake: *** [Makefile:8: build] Error 2\nRun Code Online (Sandbox Code Playgroud)\n我尝试安装 SSL lib 和其他类似的库,并认为这会有所帮助,但没有任何效果。
\nsudo apt install libpcre3-dev libssl-dev\nRun Code Online (Sandbox Code Playgroud)\n
如果有人正在寻找问题本身的解决方案:
该字段current_salt不再是存储结果的字段名称,需要更新。
相反,字段名称是,如此类系统中output所定义:/usr/include/crypt.h
/* Memory area used by crypt_r. */
struct crypt_data
{
/* crypt_r writes the hashed password to this field of its 'data'
argument. crypt_rn and crypt_ra do the same, treating the
untyped data area they are supplied with as this struct. */
char output[CRYPT_OUTPUT_SIZE];
Run Code Online (Sandbox Code Playgroud)