diff --git a/CHANGELOG.md b/CHANGELOG.md index df64be2..190f899 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,6 +24,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Updated process metadata to version 2 (traces generated with an older libovni are not compatible with the emulator). - Emulation models now have a semantic version (X.Y.Z) instead of just a number. +- Install ovniver with the runpath set. ## [1.4.1] - 2023-11-16 diff --git a/src/emu/CMakeLists.txt b/src/emu/CMakeLists.txt index c252c6c..b894965 100644 --- a/src/emu/CMakeLists.txt +++ b/src/emu/CMakeLists.txt @@ -76,6 +76,8 @@ target_link_libraries(ovnitop emu parson-static ovni-static) add_executable(ovniver ovniver.c) target_link_libraries(ovniver ovni) +set_property(TARGET ovniver + PROPERTY INSTALL_RPATH "${CMAKE_INSTALL_FULL_LIBDIR}") set(USE_MPI ON CACHE BOOL "Use MPI (required by ovnisync)") if(USE_MPI) diff --git a/src/emu/ovniver.c b/src/emu/ovniver.c index 6cc06e5..3c26a25 100644 --- a/src/emu/ovniver.c +++ b/src/emu/ovniver.c @@ -2,11 +2,18 @@ * SPDX-License-Identifier: GPL-3.0-or-later */ #include +#include #include "ovni.h" int main(void) { + const char *libpath = getenv("LD_LIBRARY_PATH"); + if (libpath != NULL) + printf("LD_LIBRARY_PATH set to %s\n", libpath); + else + printf("LD_LIBRARY_PATH not set\n"); + const char *version, *commit; ovni_version_get(&version, &commit); diff --git a/test/emu/ovni/CMakeLists.txt b/test/emu/ovni/CMakeLists.txt index 879df11..7f28418 100644 --- a/test/emu/ovni/CMakeLists.txt +++ b/test/emu/ovni/CMakeLists.txt @@ -24,3 +24,4 @@ test_emu(require-repeated.c) test_emu(thread-crash.c SHOULD_FAIL REGEX "incomplete stream") test_emu(flush-tmpdir.c MP DRIVER "flush-tmpdir.driver.sh") test_emu(tmpdir-metadata.c MP DRIVER "tmpdir-metadata.driver.sh") +test_emu(dummy.c NAME "ovniver" DRIVER "ovniver.driver.sh") diff --git a/test/emu/ovni/dummy.c b/test/emu/ovni/dummy.c new file mode 100644 index 0000000..861cd12 --- /dev/null +++ b/test/emu/ovni/dummy.c @@ -0,0 +1,8 @@ +/* Copyright (c) 2023 Barcelona Supercomputing Center (BSC) + * SPDX-License-Identifier: GPL-3.0-or-later */ + +int +main(void) +{ + return 0; +} diff --git a/test/emu/ovni/ovniver.driver.sh b/test/emu/ovni/ovniver.driver.sh new file mode 100644 index 0000000..e8efcc1 --- /dev/null +++ b/test/emu/ovni/ovniver.driver.sh @@ -0,0 +1,12 @@ +# Test ovniver as-is +( + ovniver +) + +# Test LD_LIBRARY_PATH check in ovniver +( + export LD_LIBRARY_PATH=/hopefully/nothing/is/here + ovniver | grep "LD_LIBRARY_PATH set to" + unset LD_LIBRARY_PATH + ovniver | grep "LD_LIBRARY_PATH not set" +)