Skip to content

Commit

Permalink
Fix ASAN build
Browse files Browse the repository at this point in the history
Signed-off-by: Joaquin Anton <[email protected]>
  • Loading branch information
jantonguirao committed May 30, 2024
1 parent 1ea44da commit bcf2b5f
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions plugins/video/pkg_src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# Copyright (c) 2023-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -70,12 +70,20 @@ find_library(cuda_LIBRARY cuda
PATHS ${CMAKE_CUDA_IMPLICIT_LINK_DIRECTORIES}
PATH_SUFFIXES lib/stubs lib64/stubs)

# Check if B is non-empty and set the result variable accordingly
if(NOT $ENV{LD_PRELOAD} STREQUAL "")
set(NEW_LD_PRELOAD "$ENV{LD_PRELOAD} ${cuda_LIBRARY}")
else()
set(NEW_LD_PRELOAD "${cuda_LIBRARY}")
endif()
string(REPLACE " " ":" NEW_LD_PRELOAD "${NEW_LD_PRELOAD}")

# Generates .pyi stubs
# Note: Needs to preload libcuda.so stub so that the shared-object library can be loaded
add_custom_target(dali_${PLUGIN_NAME}_generate_stubs ALL
DEPENDS dali_${PLUGIN_NAME}
BYPRODUCTS ${CMAKE_CURRENT_BINARY_DIR}/fn/plugin/video/
COMMAND LD_PRELOAD=${cuda_LIBRARY} ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/generate_plugin_stubs.py
COMMAND LD_PRELOAD=${NEW_LD_PRELOAD} ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/generate_plugin_stubs.py
${CMAKE_CURRENT_BINARY_DIR}
${PROJECT_BINARY_DIR}/libdali_${PLUGIN_NAME}.so
)
Expand Down

0 comments on commit bcf2b5f

Please sign in to comment.