diff --git a/src/apex/memory_wrapper.cpp b/src/apex/memory_wrapper.cpp index efec7e28..e9b03199 100644 --- a/src/apex/memory_wrapper.cpp +++ b/src/apex/memory_wrapper.cpp @@ -45,7 +45,11 @@ void enable_memory_wrapper() { static apex_memory_initialized_t apex_memory_initialized = NULL; void * memory_so; +#if defined(__APPLE__) + memory_so = dlopen("libapex_memory_wrapper.dylib", RTLD_NOW); +#else memory_so = dlopen("libapex_memory_wrapper.so", RTLD_NOW); +#endif if (memory_so) { char const * err; @@ -74,7 +78,11 @@ void disable_memory_wrapper() { static apex_memory_finalized_t apex_memory_finalized = NULL; void * memory_so; +#if defined(__APPLE__) + memory_so = dlopen("libapex_memory_wrapper.dylib", RTLD_NOW); +#else memory_so = dlopen("libapex_memory_wrapper.so", RTLD_NOW); +#endif if (memory_so) { char const * err; diff --git a/src/examples/CMakeLists.txt b/src/examples/CMakeLists.txt index 9737485b..9c59c065 100644 --- a/src/examples/CMakeLists.txt +++ b/src/examples/CMakeLists.txt @@ -233,6 +233,9 @@ if(OPENMP_FOUND) set_property(TEST ExampleOpenMP_Policy APPEND PROPERTY ENVIRONMENT "APEX_PLUGINS=libapex_openmp_policy") set_property(TEST ExampleOpenMP_Policy APPEND PROPERTY ENVIRONMENT "APEX_OPENMP_SPACE=${PROJECT_SOURCE_DIR}/src/examples/OpenMP_Policy/space.json") set_property(TEST ExampleOpenMP_Policy APPEND PROPERTY ENVIRONMENT "LD_PRELOAD=${PROJECT_BINARY_DIR}/src/apex/libapex.so:${OMPT_LIBRARY}") + set_property(TEST ExampleOpenMP_Policy APPEND PROPERTY ENVIRONMENT "DYLD_INSERT_LIBRARIES=${PROJECT_BINARY_DIR}/src/apex/libapex.dylib:${OMPT_LIBRARY}") + set_property(TEST ExampleOpenMP_Policy APPEND PROPERTY ENVIRONMENT "DYLD_LIBRARY_PATH=${PROJECT_BINARY_DIR}/src/apex") + set_property(TEST ExampleOpenMP_Policy APPEND PROPERTY ENVIRONMENT "DYLD_FORCE_FLAT_NAMESPACE=1") endif() endif(PROCESSOR_COUNT) endif() diff --git a/src/examples/PeriodicPlugin/README.md b/src/examples/PeriodicPlugin/README.md index ce86b47d..988fe736 100644 --- a/src/examples/PeriodicPlugin/README.md +++ b/src/examples/PeriodicPlugin/README.md @@ -13,7 +13,7 @@ export BUILDROOT=/path/to/build/directory export APEX_PLUGINS_PATH=${BUILDROOT}/src/examples/PeriodicPlugin export APEX_PLUGINS=libapex_periodic_policy export DYLD_LIBRARY_PATH=${BUILDROOT}/src/apex -export DYLD_INSERT_LIBRARIES=${BUILDROOT}/src/apex/libapex.so:${BUILDROOT}/src/wrappers/libapex_pthread_wrapper.so +export DYLD_INSERT_LIBRARIES=${BUILDROOT}/src/apex/libapex.dylib:${BUILDROOT}/src/wrappers/libapex_pthread_wrapper.dylib export DYLD_FORCE_FLAT_NAMESPACE=1 ``` diff --git a/src/scripts/apex_exec b/src/scripts/apex_exec index 37c9d316..0a50e07f 100755 --- a/src/scripts/apex_exec +++ b/src/scripts/apex_exec @@ -339,7 +339,7 @@ while (( "$#" )); do export HSA_VEN_AMD_AQLPROFILE_LOG=1 export AQLPROFILE_READ_API=1 export ROCP_METRICS=@ROCPROFILER_XML_DIRS@/metrics.xml - export HSA_TOOLS_LIB=@ROCPROFILER_HSA_DIRS@/librocprofiler64.so + export HSA_TOOLS_LIB=@ROCPROFILER_HSA_DIRS@/librocprofiler64${SHLIBX} export LD_LIBRARY_PATH=@ROCPROFILER_HSA_DIRS@:$LD_LIBRARY_PATH shift ;; diff --git a/src/unit_tests/C++/CMakeLists.txt b/src/unit_tests/C++/CMakeLists.txt index 74243cb9..08ba719a 100644 --- a/src/unit_tests/C++/CMakeLists.txt +++ b/src/unit_tests/C++/CMakeLists.txt @@ -115,7 +115,7 @@ endif (OPENMP_FOUND) set_property (TEST test_apex_malloc_cpp APPEND PROPERTY ENVIRONMENT - "LD_PRELOAD=${APEX_BINARY_DIR}/src/wrappers/libapex_memory_wrapper.so") + "LD_PRELOAD=${APEX_BINARY_DIR}/src/wrappers/libapex_memory_wrapper${CMAKE_SHARED_LIBRARY_SUFFIX}") set_property (TEST test_apex_malloc_cpp APPEND PROPERTY ENVIRONMENT "APEX_PROC_STAT=0") set_property (TEST test_apex_malloc_cpp APPEND PROPERTY ENVIRONMENT diff --git a/src/wrappers/dl_auditor.c b/src/wrappers/dl_auditor.c index 1517dc59..86e2730c 100644 --- a/src/wrappers/dl_auditor.c +++ b/src/wrappers/dl_auditor.c @@ -35,7 +35,11 @@ void la_preinit(uintptr_t *cookie) static apex_memory_dl_initialized_t apex_memory_dl_initialized = NULL; void * memory_so; +#if defined(__APPLE__) + memory_so = dlmopen(LM_ID_BASE, "libapex_memory_wrapper.dylib", RTLD_NOW); +#else memory_so = dlmopen(LM_ID_BASE, "libapex_memory_wrapper.so", RTLD_NOW); +#endif if (memory_so) { char const * err;