Skip to content

Commit df11e23

Browse files
Make connext use Connext's openssl on all platforms
Ubuntu Focal, Homebrew and chocolatey now provide OpenSSL 1.1.1 RTI Connext 5.3.1 supports only 1.0.2 so we need to modify the library path and the path for connext's version of openssl be used when running tests with connext. Use system OpenSSL for other rmw implementations Signed-off-by: Mikael Arguedas <mikael.arguedas@gmail.com>
1 parent cd1b2d1 commit df11e23

1 file changed

Lines changed: 25 additions & 38 deletions

File tree

test_security/CMakeLists.txt

Lines changed: 25 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,6 @@ if(BUILD_TESTING)
7272
RCL_ASSERT_RMW_ID_MATCHES=${rmw_implementation}
7373
RMW_IMPLEMENTATION=${rmw_implementation}
7474
ROS_SECURITY_ROOT_DIRECTORY=${KEYSTORE_DIRECTORY_NATIVE_PATH}
75-
# on bionic, Connext needs RTI's OpenSSL binaries to be on the PATH
76-
# at runtime as the system version of OpenSSL is not supported
7775
PATH="${TEST_PATH}"
7876
)
7977
if(TARGET ${target}${target_suffix})
@@ -159,8 +157,6 @@ if(BUILD_TESTING)
159157
"${CMAKE_CURRENT_BINARY_DIR}/test_secure_publisher_subscriber${test_suffix}_$<CONFIG>.py"
160158
TARGET test_secure_publisher_subscriber${test_suffix}
161159
APPEND_LIBRARY_DIRS "${append_library_dirs}"
162-
# on bionic, Connext needs RTI's OpenSSL binaries to be on the PATH
163-
# at runtime as the system version of OpenSSL is not supported
164160
ENV
165161
PATH="${TEST_PATH}"
166162
TIMEOUT 20
@@ -201,8 +197,6 @@ if(BUILD_TESTING)
201197
"${CMAKE_CURRENT_BINARY_DIR}/test_secure_publisher_subscriber${test_suffix}_$<CONFIG>.py"
202198
TARGET test_secure_publisher_subscriber${test_suffix}
203199
APPEND_LIBRARY_DIRS "${append_library_dirs}"
204-
# on bionic, Connext needs RTI's OpenSSL binaries to be on the PATH
205-
# at runtime as the system version of OpenSSL is not supported
206200
ENV
207201
PATH="${TEST_PATH}"
208202
TIMEOUT 20
@@ -243,8 +237,6 @@ if(BUILD_TESTING)
243237
"${CMAKE_CURRENT_BINARY_DIR}/test_secure_publisher_subscriber${test_suffix}_$<CONFIG>.py"
244238
TARGET test_secure_publisher_subscriber${test_suffix}
245239
APPEND_LIBRARY_DIRS "${append_library_dirs}"
246-
# on bionic, Connext needs RTI's OpenSSL binaries to be on the PATH
247-
# at runtime as the system version of OpenSSL is not supported
248240
ENV
249241
PATH="${TEST_PATH}"
250242
TIMEOUT 20
@@ -265,15 +257,11 @@ if(BUILD_TESTING)
265257
file(TO_CMAKE_PATH "${ENV_PATH}" ENV_PATH)
266258
set(TEST_PATH "${ENV_PATH}")
267259
if(rmw_implementation STREQUAL "rmw_connext_cpp")
268-
if(UNIX AND NOT APPLE)
269-
# TODO(mikaelarguedas) remove this condition the day we want to use RTI's OpenSSL libraries
270-
# on all platforms
271-
# on bionic, Connext needs RTI's OpenSSL binaries to be on the PATH
272-
# at runtime as the system version of OpenSSL is not supported
273-
set(RTI_BIN_PATH "$ENV{RTI_OPENSSL_BIN}")
274-
file(TO_CMAKE_PATH "${RTI_BIN_PATH}" RTI_BIN_PATH)
275-
set(TEST_PATH "${RTI_BIN_PATH};${ENV_PATH}")
276-
endif()
260+
# Connext 5.3.1 needs RTI's OpenSSL binaries (based on EOL 1.0.2) to be
261+
# on the PATH at runtime as the system version of OpenSSL is not supported
262+
set(RTI_BIN_PATH "$ENV{RTI_OPENSSL_BIN}")
263+
file(TO_CMAKE_PATH "${RTI_BIN_PATH}" RTI_BIN_PATH)
264+
set(TEST_PATH "${RTI_BIN_PATH};${ENV_PATH}")
277265
endif()
278266

279267
if(NOT WIN32)
@@ -304,29 +292,28 @@ if(BUILD_TESTING)
304292
"test/test_secure_subscriber.cpp")
305293

306294
set(append_library_dirs "${CMAKE_CURRENT_BINARY_DIR}")
295+
set(append_library_dirs "${append_library_dirs}:$ENV{RTI_OPENSSL_LIBS}")
307296
if(WIN32)
308297
set(append_library_dirs "${append_library_dirs}/$<CONFIG>")
309-
elseif(APPLE)
310-
# connext need the openssl libraries to be on the DYLD_LIBRARY_PATH at runtime
311-
# as SIP strips these variables on recent MacOS we populate them here
312-
# see https://github.com/ros2/ros2/issues/409
313-
execute_process(
314-
COMMAND "brew" "--prefix" "openssl"
315-
RESULT_VARIABLE _retcode
316-
OUTPUT_VARIABLE _out_var
317-
ERROR_VARIABLE _error_var
318-
)
319-
if(NOT _retcode EQUAL 0)
320-
message(FATAL_ERROR "command 'brew --prefix openssl' failed with error code '${_retcode}' and error message '${_error_var}'")
321-
endif()
322-
string(STRIP "${_out_var}" _out_var)
323-
set(openssl_lib_path "${_out_var}/lib")
324-
file(TO_NATIVE_PATH "${openssl_lib_path}" openssl_lib_path)
325-
set(append_library_dirs "${append_library_dirs};${openssl_lib_path}")
326-
elseif(UNIX)
327-
# on bionic, Connext needs RTI's OpenSSL libraries to be on the LD_LIBRARY_PATH
328-
# at runtime as the system version of OpenSSL is not supported
329-
set(append_library_dirs "${append_library_dirs}:$ENV{RTI_OPENSSL_LIBS}")
298+
# TODO(mikaelarguedas) uncomment this once Connext supports OpenSSL 1.1.1
299+
# in the meantime use RTI_OPENSSL_LIBS
300+
# elseif(APPLE)
301+
# # connext need the openssl libraries to be on the DYLD_LIBRARY_PATH at runtime
302+
# # as SIP strips these variables on recent MacOS we populate them here
303+
# # see https://github.com/ros2/ros2/issues/409
304+
# execute_process(
305+
# COMMAND "brew" "--prefix" "openssl"
306+
# RESULT_VARIABLE _retcode
307+
# OUTPUT_VARIABLE _out_var
308+
# ERROR_VARIABLE _error_var
309+
# )
310+
# if(NOT _retcode EQUAL 0)
311+
# message(FATAL_ERROR "command 'brew --prefix openssl' failed with error code '${_retcode}' and error message '${_error_var}'")
312+
# endif()
313+
# string(STRIP "${_out_var}" _out_var)
314+
# set(openssl_lib_path "${_out_var}/lib")
315+
# file(TO_NATIVE_PATH "${openssl_lib_path}" openssl_lib_path)
316+
# set(append_library_dirs "${append_library_dirs};${openssl_lib_path}")
330317
endif()
331318

332319
# finding gtest once in the highest scope

0 commit comments

Comments
 (0)