Skip to main content
  1. Posts/

Error /usr/bin/ld: cannot find -lbrotlicommon

·2 mins·
linux linux
Table of Contents

Issue
#

Saat mencoba compile module nginx brotli muncul error berikut.

cc -o objs/ngx_http_brotli_filter_module.so \
objs/addon/filter/ngx_http_brotli_filter_module.o \
objs/ngx_http_brotli_filter_module_modules.o \
-L/root/ngx_brotli/deps/brotli/c/../out -llibbrotlicommon -llibbrotlidec -lm \
-shared
/usr/bin/ld: cannot find -lbrotlicommon
/usr/bin/ld: cannot find -lbrotlidec
collect2: error: ld returned 1 exit status
make[1]: *** [objs/Makefile:1207: objs/ngx_http_brotli_filter_module.so] Error 1
make[1]: Leaving directory '/root/nginx-1.24.0/nginx-1.24.0'
make: *** [Makefile:16: modules] Error 2

Solution
#

Untuk mengecek apakah library tersebut ada gunakan perintah.

ld -lbrotlicommon --verbose
attempt to open //usr/x86_64-redhat-linux/lib64/libbrotlicommon.so failed
attempt to open //usr/x86_64-redhat-linux/lib64/libbrotlicommon.a failed
attempt to open //usr/lib64/libbrotlicommon.so failed
attempt to open //usr/lib64/libbrotlicommon.a failed
attempt to open //usr/local/lib64/libbrotlicommon.so failed
attempt to open //usr/local/lib64/libbrotlicommon.a failed
attempt to open //lib64/libbrotlicommon.so failed
attempt to open //lib64/libbrotlicommon.a failed
attempt to open //usr/x86_64-redhat-linux/lib/libbrotlicommon.so failed
attempt to open //usr/x86_64-redhat-linux/lib/libbrotlicommon.a failed
attempt to open //usr/local/lib/libbrotlicommon.so failed
attempt to open //usr/local/lib/libbrotlicommon.a failed
attempt to open //lib/libbrotlicommon.so failed
attempt to open //lib/libbrotlicommon.a failed
attempt to open //usr/lib/libbrotlicommon.so failed
attempt to open //usr/lib/libbrotlicommon.a failed
ld: cannot find -lbrotlicommon

Dari sini diketahui jika ld mencoba mencari library pada beberapa folder dengan format yang berbeda. Sedangkan library brotli terinstall dengan nama berikut

/usr/lib64/libbrotlicommon.so.1
/usr/lib64/libbrotlicommon.so.1.0.6
/usr/lib64/libbrotlidec.so.1
/usr/lib64/libbrotlidec.so.1.0.6
/usr/lib64/libbrotlienc.so.1
/usr/lib64/libbrotlienc.so.1.0.6

Sehingga agar dapat terbaca, Anda dapat membuat symlink file menyesuaikan dengan format library yang dicari ld

cd /usr/lib64
ln -s libbrotlicommon.so.1.0.6 libbrotlicommon.so

Selanjutnya cek kembali library dengan perintah ld

# ld -lbrotlicommon --verbose  | grep -E 'succeeded|found'
ld: warning: cannot find entry symbol _start; not setting start address
attempt to open //usr/lib64/libbrotlicommon.so succeeded
found libm.so.6 at //usr/lib64/libm.so.6
found libc.so.6 at //usr/lib64/libc.so.6
found ld-linux-x86-64.so.2 at //usr/lib64/ld-linux-x86-64.so.2

Related

Mengatasi Masalah Interface Ethernet Tidak Terdeteksi
·1 min
linux linux
Error Display_Server_Not_Supported di AnyDesk
·1 min
linux linux
Grub Error: you need to load kernel first
·1 min
linux linux
Linux Boot Error: Root does not exist
·1 min
linux linux
Enable Brotli Compression
·2 mins
linux apache nginx linux
Enable SWAP on Linux
·1 min
linux linux