Skip to content

Commit

Permalink
build: Fix openssl build when not using the bundled library.
Browse files Browse the repository at this point in the history
Otherwise, with
cmake -DCMAKE_BUILD_TYPE=Debug  -DUSE_BUNDLED_OPENSSL=OFF ..
one gets

```
[ 96%] Linking CXX executable csysdig
[ 97%] Linking CXX executable sysdig
/usr/bin/ld: ../libsinsp/libsinsp.a(k8s_handler.cpp.o): undefined reference to symbol 'SSL_CTX_use_PrivateKey_file'
/usr/lib/libssl.so.1.0.0: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make[2]: *** [userspace/sysdig/CMakeFiles/csysdig.dir/build.make:131: userspace/sysdig/csysdig] Error 1
make[1]: *** [CMakeFiles/Makefile2:275: userspace/sysdig/CMakeFiles/csysdig.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
/usr/bin/ld: ../libsinsp/libsinsp.a(k8s_handler.cpp.o): undefined reference to symbol 'SSL_CTX_use_PrivateKey_file'
/usr/lib/libssl.so.1.0.0: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make[2]: *** [userspace/sysdig/CMakeFiles/sysdig.dir/build.make:129: userspace/sysdig/sysdig] Error 1
make[1]: *** [CMakeFiles/Makefile2:323: userspace/sysdig/CMakeFiles/sysdig.dir/all] Error 2
make: *** [Makefile:139: all] Error 2
```

This is because linking to libssl and libcrypto is not done (after
find_package in CMakeLists.txt) when using
the system libraries.

sysdig-CLA-1.0-signed-off-by: Raghavendra Prabhu <me@rdprabhu.com>
  • Loading branch information
ronin13 authored and Raghavendra D Prabhu committed Oct 31, 2016
1 parent eae75f5 commit 51eae3d
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions userspace/libsinsp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,19 @@ if(NOT WIN32)
"${JQ_LIB}"
"${B64_LIB}"
"${CURL_LIBRARIES}"
"${OPENSSL_LIBRARY_SSL}"
"${OPENSSL_LIBRARY_CRYPTO}"
rt
anl)
endif()

if(USE_BUNDLED_OPENSSL)
target_link_libraries(sinsp
"${OPENSSL_LIBRARY_SSL}"
"${OPENSSL_LIBRARY_CRYPTO}")
else()
target_link_libraries(sinsp
"${OPENSSL_LIBRARIES}")
endif()

target_link_libraries(sinsp
"${LUAJIT_LIB}"
dl
Expand Down

0 comments on commit 51eae3d

Please sign in to comment.