Shadowsocks-libev: How to build libev statically

Created on 29 Jun 2019  ·  1Comment  ·  Source: shadowsocks/shadowsocks-libev

What version of shadowsocks-libev are you using?

3.3.0

What operating system are you using?

macOS 10.14.5

What did you do?

I tried to build statically with all library needed so that I could share the binary with friends. However, after I specified the libev lib location, the binary can't be excuted and prompted that it needs the libev dynamic lib.

Below is my configuration parameters

sudo ./configure --prefix=/Users/tonyzou/Downloads/shadowsocks-libev-3.3.0/ --with-pcre=/usr/local/opt/pcre --disable-documentation --with-sodium=/usr/local/opt/libsodium --with-ev=/usr/local/opt/libev --with-cares=/usr/local/opt/c-ares --with-mbedtls=/usr/local/opt/mbedtls --enable-static --enable-shared

What did you expect to see?

A binary for macOS without the need of dynamic libs

What did you see instead?

A binary for macOS with the need of dynamic libs

What is your config in detail (with all sensitive info masked)?

See above

duplicate question

Most helpful comment

You can build with cmake:

brew install cmake c-ares libev libsodium mbedtls pcre

cd shadowsocks-libev

mkdir -p build && cd build

cmake -DCMAKE_BUILD_TYPE=Release -DWITH_DOC_HTML=OFF -DWITH_DOC_MAN=OFF -DWITH_STATIC=ON ..

make -j4

The executables are placed in build/bin/.

Note that it's hardly build a totally static linked binary on macOS, but after the above steps the binaries only links to /usr/lib/libSystem.B.dylib which is provided on all macOS.

>All comments

You can build with cmake:

brew install cmake c-ares libev libsodium mbedtls pcre

cd shadowsocks-libev

mkdir -p build && cd build

cmake -DCMAKE_BUILD_TYPE=Release -DWITH_DOC_HTML=OFF -DWITH_DOC_MAN=OFF -DWITH_STATIC=ON ..

make -j4

The executables are placed in build/bin/.

Note that it's hardly build a totally static linked binary on macOS, but after the above steps the binaries only links to /usr/lib/libSystem.B.dylib which is provided on all macOS.

Was this page helpful?
0 / 5 - 0 ratings