google / google/brotli

pkg-config --static not working

Open
#795 16 comments 6 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
14.9k
Forks
1.4k
Avg merge
4d 20h
Merged PRs (30d)
9

Description

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
$
~~~

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.