Skip to content

Instantly share code, notes, and snippets.

@avoidik
Last active May 9, 2024 10:43
Show Gist options
  • Save avoidik/5c012a1447e90925900ce099b7624e83 to your computer and use it in GitHub Desktop.
Save avoidik/5c012a1447e90925900ce099b7624e83 to your computer and use it in GitHub Desktop.
Building nfstrace on Amazon Linux 2023

How to compile nfstrace

Prerequisites

Make sure we're using Amazon Linux

$ cat /etc/amazon-linux-release
Amazon Linux release 2023.4.20240429 (Amazon Linux)

Install packages

$ sudo dnf group install "Development Tools"
$ sudo dnf install -y git-core cmake libpcap-devel ncurses-devel json-c-devel libtirpc-devel gtest-devel texlive-latex

Compilation

Clone repository

$ git clone https://github.com/epam/nfstrace.git
$ cd nfstrace/
$ mkdir release
$ cd release

Make sure it fails

$ cmake -DCMAKE_BUILD_TYPE=release ../

Apply patch below

$ git apply amazon_linux_patch.diff

Now compile and build

$ mkdir buildout
$ cmake -DCMAKE_INSTALL_PREFIX="$(pwd)/buildout" -DCMAKE_BUILD_TYPE=release ../
$ make
$ make install
diff --git a/CMakeLists.txt b/CMakeLists.txt
index d13804e..c84deab 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -35,7 +35,8 @@ endif ()
# See: https://fedoraproject.org/wiki/Changes/SunRPCRemoval
find_file (FEDORA_FOUND fedora-release PATHS /etc)
find_file (REDHAT_FOUND redhat-release PATHS /etc)
-if (FEDORA_FOUND OR REDHAT_FOUND)
+find_file (AMAZON_FOUND amazon-linux-release PATHS /etc)
+if (FEDORA_FOUND OR REDHAT_FOUND OR AMAZON_FOUND)
find_library (TIRPC_LIBRARY NAMES tirpc)
find_path (TIRPC_INCLUDE NAMES rpc/rpc.h PATHS /usr/include/tirpc)
if (TIRPC_LIBRARY AND TIRPC_INCLUDE)
@avoidik
Copy link
Author

avoidik commented May 9, 2024

$ git clone https://github.com/epam/nfstrace.git
$ cd nfstrace/
$ curl -fsSLO https://gist.github.com/avoidik/5c012a1447e90925900ce099b7624e83/raw/476cc833c2a907832928c978fdf712f0b01ca9b3/amazon_linux_patch.diff
$ git apply amazon_linux_patch.diff

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment