brotli: pkg-config --static not working

The static libraries have the name -static appended to them but pkg-config --static returns the regular name. I don’t think there is a way to treat the library name as different for static in pkg-config.

libbrotlicommon-static.a libbrotlidec-static.a libbrotlienc-static.a

git clone https://github.com/google/brotli.git
mkdir brotli-build
cd brotli-build/
cmake -DBUILD_{SHARED,STATIC}_LIBS=ON ../brotli
make
sudo make install
cat << EOF > a.c
 #ifdef __cplusplus
 extern "C"
 #endif
 char BrotliDecoderDecompress ();
 int main (void)
 {
 return BrotliDecoderDecompress ();
  ;
  return 0;
 }
EOF
$ gcc -o a a.c -static `pkg-config --static --libs libbrotlidec`
/usr/bin/ld: cannot find -lbrotlidec
/usr/bin/ld: cannot find -lbrotlicommon
collect2: error: ld returned 1 exit status
$ pkg-config --static --libs libbrotlidec
-L/usr/local/lib -lbrotlidec -lbrotlicommon
$ gcc -o a a.c -static -L/usr/local/lib -lbrotlidec-static -lbrotlicommon-static
$ 

About this issue

  • Original URL
  • State: open
  • Created 4 years ago
  • Reactions: 5
  • Comments: 15

Most upvoted comments

Hello! i was bitten by this and wondering if i could help resolve it somehow.

@eustas i’m curious when you were working on https://github.com/google/brotli/pull/599 was there reason the static library ended up having a -static suffix?