Skip to content

Commit

Permalink
Added linux build steps (#366)
Browse files Browse the repository at this point in the history
* refactored and added steps for linux

* libbpf build script for linux

* refactored headings
  • Loading branch information
the-m3chanic authored Nov 15, 2023
1 parent b0a1d98 commit 7acf505
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 8 deletions.
22 changes: 14 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,7 @@ sure to properly check out the source code which requires properly initializing
git submodule update --init --recursive
```

## Building with CMake
A build system for compiling and testing ubpf is generated for Windows, Linux and macOS platforms using [`cmake`](https://cmake.org/):

```
cmake -S . -B build -DUBPF_ENABLE_TESTS=true
cmake --build build --config Debug
```
## Preparing system for build

In order to prepare your system to successfully generate the build system using CMake, follow the platform-specific instructions below.

Expand Down Expand Up @@ -83,7 +77,19 @@ cmake -S . -B build -DUBPF_ENABLE_TESTS=true -DUBPF_ALTERNATE_LLVM_PATH=/opt/hom
```

### Linux
TBD

```bash
./scripts/build-libbpf.sh
```

## Building with CMake

A build system for compiling and testing ubpf is generated for Windows, Linux and macOS platforms using [`cmake`](https://cmake.org/):

```
cmake -S . -B build -DUBPF_ENABLE_TESTS=true
cmake --build build --config Debug
```

## Running the tests

Expand Down
24 changes: 24 additions & 0 deletions scripts/build-libbpf.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/usr/bin/bash
# Copyright (c) Microsoft Corporation
# SPDX-License-Identifier: MIT

git clone /~https://github.com/libbpf/libbpf.git
if [ $? -ne 0 ]; then
echo "Could not clone the libbpf repository."
exit 1
fi

# Jump in to the src directory to do the actual build.
cd libbpf/src

make
if [ $? -ne 0 ]; then
echo "Could not build libbpf source."
exit 1
fi

# Now that the build was successful, install the library (shared
# object and header files) in a spot where FindLibBpf.cmake can
# find it when it is being built.
sudo PREFIX=/usr LIBDIR=/usr/lib/x86_64-linux-gnu/ make install
exit 0

0 comments on commit 7acf505

Please sign in to comment.