openziti / ngx_http_ziti_module

Non-blocking upstream module for Nginx to securely connect to a Ziti network
Apache License 2.0
5 stars 1 forks source link

Symbol not found: _mbedtls_ctr_drbg_random #5

Closed oluetkehnf closed 3 years ago

oluetkehnf commented 3 years ago

after building and configuring nginx with this module I'm getting this error: /usr/local/nginx/sbin/nginx -T nginx: [emerg] dlopen() "/usr/local/nginx/modules/ngx_http_ziti_module.so" failed (dlopen(/usr/local/nginx/modules/ngx_http_ziti_module.so, 10): Symbol not found: _mbedtls_ctr_drbg_random Referenced from: /usr/local/nginx/modules/ngx_http_ziti_module.so Expected in: flat namespace in /usr/local/nginx/modules/ngx_http_ziti_module.so) in /usr/local/nginx/conf/nginx.conf:17 nginx: configuration file /usr/local/nginx/conf/nginx.conf test failed

can you pls advise where / what to fix.

rentallect commented 3 years ago

@oluetkehnf please post the ./configure cmd you are using. It looks like a lib you need is not being included in the --with-ld-opt section.

oluetkehnf commented 3 years ago
./configure \
--with-compat \
--with-debug \
--with-threads \
--add-dynamic-module=$OPENZITI/ngx_http_ziti_module \
--with-ld-opt="$OPENZITI/ziti-sdk-c/build/library/libziti.a $OPENZITI/ziti-sdk-c/build/_deps/libuv-build/libuv_a.a $OPENZITI/ziti-sdk-c/build/_deps/libsodium-build/lib/libsodium.a $OPENZITI/ziti-sdk-c/build/_deps/uv-mbed-build/libuv_mbed.a /usr/local/Cellar/openssl@1.1/1.1.1j/lib/libssl.a /usr/local/Cellar/openssl@1.1/1.1.1j/lib/libcrypto.a" \
--with-cc-opt="-g -O0 -fno-strict-aliasing -fno-pie -Wno-unused-function -I/usr/local/include -I$OPENZITI/ziti-sdk-c/includes -I$OPENZITI/ziti-sdk-c/build/_deps/uv-mbed-src/include -I$OPENZITI/ziti-sdk-c/deps/uv-mbed/deps/libuv/include -I$OPENZITI/ziti-sdk-c/build/_deps/http_parser-src -I$OPENZITI/ziti-sdk-c/build/_deps/uv_link-src/include -I$OPENZITI/ziti-sdk-c/build/_deps/libuv-src/include"
rentallect commented 3 years ago

Ah... Looks like you built the ziti-sdk-c to use mbedtls instead of openssl. Try the following:

Rebuild the ziti-sdk-c so it uses openssl. Here's an example of how I do it:

cmake -G Ninja -DUSE_OPENSSL=on -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DOPENSSL_ROOT_DIR=/usr/local/opt/openssl -DOPENSSL_LIBRARIES=/usr/local/opt/openssl/lib ..

After the ziti-sdk-c is re-built, then re-run your ./configure just as you had it before, and the ngx_http_ziti_module should compile and link just fine.

oluetkehnf commented 3 years ago

thank you, that fixed it!