tokers / zstd-nginx-module

Nginx modules for the Zstandard compression
BSD 2-Clause "Simplified" License
196 stars 23 forks source link

Environment variables ZSTD_INC and ZSTD_LIB in compiling. #33

Closed L1H0n9Jun closed 6 months ago

L1H0n9Jun commented 6 months ago

Hi,

I met some issues in nginx compilation with zstd-module when dealing with the ZSTD_* environment variables.

  1. zstd lib 1.5.6 was built with make lib-mt or make lib in path_to/build/zstd/ without error. Thus, zstd.h, libzstd.a and libzstd.so in path_to/build/zstd/lib.
  2. According to read me, ZSTD_INC set to path_to/build/zstd/lib/zstd.h and ZSTD_LIB set to path_to/build/zstd/lib.
  3. nginx was compiled with --add-module=path_to/zstd-nginx-module.

Then, nginx checking reported:

checking for ZStandard static library in path_to/build/zstd/lib/zstd.h and path_to/build/zstd/lib ... not found
checking for ZStandard dynamic library in path_to/build/zstd/lib/zstd.h and path_to/build/zstd/lib ... not found
            ./auto/configure: error: ngx_http_zstd_filter_module requires the ZStandard library, please be sure that "$ZSTD_INC" and "$ZSTD_LIB" are set correctly.

All paths are correct and exist.

After searching for the source code, I found the variables were used in:

ngx_feature_path=$ZSTD_INC
ngx_zstd_opt_I="-I$ZSTD_INC -DZSTD_STATIC_LINKING_ONLY"

ngx_zstd_opt_L="$ZSTD_LIB/libzstd.a"

They both should be folder path, right?

Then, I set:

export ZSTD_INC=path_to/build/zstd/lib
export ZSTD_LIB=path_to/build/zstd/lib

Nginx reported 'not found' again.

Then, I tried to set (which is obviously not correct):

export ZSTD_INC=path_to/build/zstd/lib/zstd.h
export ZSTD_LIB=path_to/build/zstd/lib/libzstd.a

Nginx reported:

checking for ZStandard static library in path_to/build/zstd/lib/zstd.h and path_to/build/zstd/lib/libzstd.a ... not found
checking for ZStandard dynamic library in path_to/build/zstd/lib/zstd.h and path_to/build/zstd/lib/libzstd.a ... found
checking for ZStandard static library in path_to/build/zstd/lib/zstd.h and path_to/build/zstd/lib/libzstd.a ... not found
checking for ZStandard dynamic library in path_to/build/zstd/lib/zstd.h and path_to/build/zstd/lib/libzstd.a ... found

So, static library was not found but dynamic library was found. How strange!

How could i properly set the environment variables? And how does nginx produce ngx_found?

Thx.