Skip to content

Commit

Permalink
Fix build errors for arm64 and remove the gcc-multilib
Browse files Browse the repository at this point in the history
dependency specified in setup instructions

Signed-off-by: Sachin Tiptur <coolsachints@gmail.com>
  • Loading branch information
sachintiptur authored and tohojo committed Sep 23, 2023
1 parent 7741899 commit 7c515b6
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
15 changes: 13 additions & 2 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ TMPDIR=$(mktemp -d config.XXXXXX)
trap 'status=$?; rm -rf $TMPDIR; rm -f $CONFIG; exit $status' EXIT HUP INT QUIT TERM

SUBMODULE_LIBBPF=0
ARCH_INCLUDES=

check_toolchain()
{
Expand All @@ -36,13 +37,24 @@ check_toolchain()
echo "ERROR: Need clang version >= 11, found $clang_major_version ($clang_version)"
exit 1
fi

ARCH_NAME=$($CC -print-multiarch 2>/dev/null)
if [ -z "$ARCH_INCLUDES" ] && [ -n "$ARCH_NAME" ]; then
for dir in $(echo | $CC -Wp,-v -E - 2>&1 | grep '^ '); do
local idir
idir="${dir}/${ARCH_NAME}"
[ -d "$idir" ] && ARCH_INCLUDES="-I${idir} $ARCH_INCLUDES"
done
fi

echo "clang: $clang_version"

echo "PKG_CONFIG:=${PKG_CONFIG}" >>$CONFIG
echo "CC:=${CC}" >>$CONFIG
echo "CLANG:=${CLANG}" >>$CONFIG
echo "LLC:=${LLC}" >>$CONFIG
echo "BPFTOOL:=${BPFTOOL}" >>$CONFIG
echo "ARCH_INCLUDES:=${ARCH_INCLUDES}" >>$CONFIG
}

check_elf()
Expand Down Expand Up @@ -157,7 +169,7 @@ check_bpf_use_errno()
int dummy(void *ctx) { return 0; }
EOF

compile_err=$($CLANG -target bpf -c $TMPDIR/bpf_use_errno_test.c 2>&1)
compile_err=$($CLANG -target bpf ${ARCH_INCLUDES} -c $TMPDIR/bpf_use_errno_test.c 2>&1)
if [ "$?" -ne "0" ]; then
echo "*** ERROR - Clang BPF-prog cannot include <errno.h>"
echo " - Install missing userspace header file"
Expand Down Expand Up @@ -255,7 +267,6 @@ echo -n "libbpf support: "
check_libbpf
echo -n "libxdp support: "
check_libxdp

check_bpf_use_errno

if [ -n "$KERNEL_HEADERS" ]; then
Expand Down
4 changes: 2 additions & 2 deletions lib/defines.mk
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ endif

HAVE_FEATURES :=

CFLAGS += $(DEFINES)
BPF_CFLAGS += $(DEFINES)
CFLAGS += $(DEFINES) $(ARCH_INCLUDES)
BPF_CFLAGS += $(DEFINES) $(ARCH_INCLUDES)

CONFIGMK := $(LIB_DIR)/../config.mk
LIBMK := Makefile $(CONFIGMK) $(LIB_DIR)/defines.mk $(LIB_DIR)/common.mk $(LIB_DIR)/util/util.mk
Expand Down
2 changes: 1 addition & 1 deletion setup_dependencies.org
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ Note that you need to do this in the shell you are using to load programs
On Debian and Ubuntu installations, install the dependencies like this:

#+begin_example
$ sudo apt install clang llvm libelf-dev libpcap-dev gcc-multilib build-essential
$ sudo apt install clang llvm libelf-dev libpcap-dev build-essential
#+end_example

To install the 'perf' utility, run this on Debian:
Expand Down

0 comments on commit 7c515b6

Please sign in to comment.