tokers / zstd-nginx-module

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

libzstd.a(zstd_compress.o): relocation R_X86_64_PC32 against symbol `ZSTD_copySequencesToSeqStoreExplicitBlockDelim` can not be used when making a shared object; recompile with -fPIC #37

Open n0099 opened 1 month ago

n0099 commented 1 month ago
sudo apt install libzstd-dev
git clone https://github.com/tokers/zstd-nginx-module
wget https://nginx.org/download/nginx-1.27.1.tar.gz
tar xvf nginx-1.27.1.tar.gz
cd nginx-1.27.1
./configure --with-compat --add-dynamic-module=../zstd-nginx-module
make modules
make -f objs/Makefile modules
make[1]: Entering directory 'nginx-1.27.1'
cc -o objs/ngx_http_zstd_filter_module.so \
objs/addon/filter/ngx_http_zstd_filter_module.o \
objs/ngx_http_zstd_filter_module_modules.o \
-l:libzstd.a -l:libzstd.a -l:libzstd.a \
-shared
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu/libzstd.a(zstd_compress.o): warning: relocation against `ZSTD_copySequencesToSeqStoreNoBlockDelim' in read-only section `.text'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu/libzstd.a(zstd_compress.o): relocation R_X86_64_PC32 against symbol `ZSTD_copySequencesToSeqStoreExplicitBlockDelim' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: bad value
collect2: error: ld returned 1 exit status
make[1]: *** [objs/Makefile:1527: objs/ngx_http_zstd_filter_module.so] Error 1
make[1]: Leaving directory 'nginx-1.27.1'
make: *** [Makefile:16: modules] Error 2
AnYiEE commented 1 month ago

I also encountered this problem on a new installed Ubuntu 24.04, but it can be successfully compiled on Ubuntu 22.04, so I copied the compiled files over from there and it looks like no problem.

n0099 commented 1 month ago

I'm using Ubuntu 24.04 too.

Soberia commented 1 month ago

Also does not compile on Debian Bookworm 12.