From dd7b7dbd0e9ee95d792bd553f130288d70336b94 Mon Sep 17 00:00:00 2001 From: Masamichi Takagi Date: Sat, 27 Feb 2021 18:01:21 -0500 Subject: [PATCH] uti: fix rpmbuild Change-Id: I0cc60d2b38b184168a99a4778fbb5a437278da29 --- CMakeLists.txt | 2 +- docs/install.rst | 2 +- executer/user/lib/CMakeLists.txt | 24 +++++++++++++++--------- executer/user/lib/syscall_intercept | 2 +- scripts/mckernel.spec.in | 12 +++++++----- 5 files changed, 25 insertions(+), 17 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6fbd76ab..5185a2bb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -228,6 +228,7 @@ math(EXPR LINUX_VERSION_CODE "${LINUX_VERSION_MAJOR} * 65536 + ${LINUX_VERSION_M # compat with various install paths set(BINDIR ${CMAKE_INSTALL_FULL_BINDIR}) set(SBINDIR ${CMAKE_INSTALL_FULL_SBINDIR}) +set(LIBDIR ${CMAKE_INSTALL_FULL_LIBDIR}) set(ETCDIR ${CMAKE_INSTALL_PREFIX}/etc) set(ROOTFSDIR "/rootfs") if (CMAKE_INSTALL_PREFIX STREQUAL "/usr") @@ -237,7 +238,6 @@ else() set(KMODDIR "${CMAKE_INSTALL_PREFIX}/kmod") set(MCKERNELDIR "${CMAKE_INSTALL_PREFIX}/${BUILD_TARGET}/kernel") endif() -set(prefix ${CMAKE_INSTALL_PREFIX}) # set rpath for everyone set(CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_FULL_LIBDIR}) diff --git a/docs/install.rst b/docs/install.rst index 363215b2..adcb6c72 100644 --- a/docs/install.rst +++ b/docs/install.rst @@ -142,7 +142,7 @@ cmake options. For example: %{?toolchain_file:-DCMAKE_TOOLCHAIN_FILE=%{toolchain_file}} \ -DENABLE_TOFU=ON -DENABLE_FUGAKU_HACKS=ON \ -DENABLE_KRM_WORKAROUND=OFF -DWITH_KRM=ON \ - -DENABLE_FUGAKU_DEBUG=OFF \ + -DENABLE_FUGAKU_DEBUG=OFF -DENABLE_UTI=ON \ . Create the rpm package: diff --git a/executer/user/lib/CMakeLists.txt b/executer/user/lib/CMakeLists.txt index de0ef430..ac1e1ca3 100644 --- a/executer/user/lib/CMakeLists.txt +++ b/executer/user/lib/CMakeLists.txt @@ -33,17 +33,23 @@ if (ENABLE_UTI) endif() include(ExternalProject) - # Install libuti.so.* into /mck/ so that mcexec can - # redirect ld*.so's access to it. In this way, a.out created - # by Fujitsu MPI and linked to libuti.so in the standard path - # can use the McKernel version when invoked through mcexec. - ExternalProject_Add(libuti + ExternalProject_Add(libuti SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/uti BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/uti - INSTALL_DIR ${prefix} - CONFIGURE_COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/uti/configure --prefix= --libdir=/lib64 --disable-static --with-rm=mckernel + CONFIGURE_COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/uti/configure --disable-static --with-rm=mckernel BUILD_COMMAND ${MAKE} BUILD_IN_SOURCE FALSE - INSTALL_COMMAND ${MAKE} install && bash -c "rm ${prefix}/include/uti.h ${prefix}/lib64/libuti.la && [[ -d ${prefix}/lib64/mck ]] || mkdir ${prefix}/lib64/mck && mv ${prefix}/lib64/libuti.* ${prefix}/lib64/mck" - ) + INSTALL_COMMAND "" + ) + + # Install libuti.so.* into /usr/lib64/mck/ so that mcexec can + # redirect /usr/lib64/ to /usr/lib64/mck/. In this way, a.out created + # by Fujitsu MPICC and thus linked to /usr/lib64/libuti.so + # can be linked to /usr/lib64/mck/libuti.so when invoked via mcexec. + ExternalProject_Get_Property(libuti BINARY_DIR) + foreach(target IN ITEMS libuti.so.1.0.0 libuti.so.1 libuti.so) + add_custom_target(${target} ALL COMMAND bash -c "cp -P ${BINARY_DIR}/lib/.libs/${target} ${CMAKE_CURRENT_BINARY_DIR}") + add_dependencies(${target} libuti) + install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/${target} DESTINATION "${LIBDIR}/mck") + endforeach() endif() diff --git a/executer/user/lib/syscall_intercept b/executer/user/lib/syscall_intercept index 13e8ed10..66a47ceb 160000 --- a/executer/user/lib/syscall_intercept +++ b/executer/user/lib/syscall_intercept @@ -1 +1 @@ -Subproject commit 13e8ed10a0c28160c81a2fb3f79b3c83da6b135f +Subproject commit 66a47ceb1c5c05e1d613ab3f1f7164f42d5aca6f diff --git a/scripts/mckernel.spec.in b/scripts/mckernel.spec.in index 714ae836..240fe9a4 100644 --- a/scripts/mckernel.spec.in +++ b/scripts/mckernel.spec.in @@ -69,6 +69,8 @@ This package contains headers and libraries required for build apps using IHK/Mc %define __global_ldflags "" %define optflags -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions --param=ssp-buffer-size=4 -grecord-gcc-switches -mtune=generic +mkdir build +pushd build %cmake -DCMAKE_BUILD_TYPE=Release \ -DUNAME_R=%{kernel_version} \ -DKERNEL_DIR=%{kernel_dir} \ @@ -77,12 +79,15 @@ This package contains headers and libraries required for build apps using IHK/Mc %{?toolchain_file:-DCMAKE_TOOLCHAIN_FILE=%{toolchain_file}} \ -DENABLE_TOFU=ON -DENABLE_FUGAKU_HACKS=ON \ -DENABLE_KRM_WORKAROUND=OFF -DWITH_KRM=ON \ - -DENABLE_FUGAKU_DEBUG=OFF \ - . + -DENABLE_FUGAKU_DEBUG=OFF -DENABLE_UTI=ON \ + .. %make_build +popd %install +pushd build %make_install +popd %files %ifarch x86_64 @@ -138,9 +143,6 @@ This package contains headers and libraries required for build apps using IHK/Mc %{_includedir}/ihk/ihk_monitor.h %{_includedir}/ihk/ihk_debug.h %{_includedir}/ihk/ihk_host_driver.h -%{_includedir}/libsyscall_intercept_hook_point.h -%{_libdir}/pkgconfig/libsyscall_intercept.pc -%{_mandir}/man3/libsyscall_intercept.3 /lib/modules/%{kernel_version}/extra/mckernel/ihk/linux/core/Module.symvers # taken from /usr/lib/rpm/redhat/kmodtool (kernel_module_package)