由于 struct 'crypt_data' 没有名为 'current_salt' 的成员,nginx 编译失败

5 c linux glibc nginx

我正在尝试使用 GCC 在 Ubuntu 机器上编译 nginx。我的 Glibc 版本是 2.31。

\n
m@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.\n
Run Code Online (Sandbox Code Playgroud)\n

我从https://nginx.org/download/下载了一堆不同的版本,并尝试使用它们,但每次都失败。

\n
./configure --with-threads --with-http_ssl_module --with-cc-opt="-Wno-error"\nmake\n
Run Code Online (Sandbox Code Playgroud)\n

./configure 在中生成以下文件objs/Makefile

\n
CC =    cc\nCFLAGS =  -pipe  -O -W -Wall -Wpointer-arith -Wno-unused -Werror -g -Wno-error\nCPP =   cc -E\nLINK =  $(CC)\n\n...\n
Run Code Online (Sandbox Code Playgroud)\n

这给了我下面这个错误。

\n
cc -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\n
Run Code Online (Sandbox Code Playgroud)\n

我尝试安装 SSL lib 和其他类似的库,并认为这会有所帮助,但没有任何效果。

\n
sudo apt install libpcre3-dev libssl-dev\n
Run Code Online (Sandbox Code Playgroud)\n

Int*_*ked 1

如果有人正在寻找问题本身的解决方案:

该字段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)