Skip to content

Commit

Permalink
Binary (FreeBSD): use system libelf
Browse files Browse the repository at this point in the history
There are pkg elfutils. However it is not ABI compatible with system
libelf
  • Loading branch information
CarterLi committed Sep 7, 2024
1 parent de59ffb commit d8fb8d4
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ cmake_dependent_option(ENABLE_FREETYPE "Enable freetype" ON "ANDROID" OFF)
cmake_dependent_option(ENABLE_PULSE "Enable pulse" ON "LINUX OR SunOS" OFF)
cmake_dependent_option(ENABLE_DDCUTIL "Enable ddcutil" ON "LINUX" OFF)
cmake_dependent_option(ENABLE_DIRECTX_HEADERS "Enable DirectX headers for WSL" ON "LINUX" OFF)
cmake_dependent_option(ENABLE_ELF "Enable libelf" ON "LINUX OR FreeBSD OR ANDROID" OFF)
cmake_dependent_option(ENABLE_ELF "Enable libelf" ON "LINUX OR ANDROID" OFF)
cmake_dependent_option(ENABLE_THREADS "Enable multithreading" ON "Threads_FOUND" OFF)
cmake_dependent_option(ENABLE_LIBZFS "Enable libzfs" ON "LINUX OR FreeBSD OR SunOS" OFF)

Expand Down
2 changes: 1 addition & 1 deletion src/common/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ void ffListFeatures(void)
#if FF_HAVE_DDCUTIL
"libddcutil\n"
#endif
#if FF_HAVE_ELF
#if FF_HAVE_ELF || __sun || __FreeBSD__
"libelf\n"
#endif
#if FF_HAVE_LIBZFS
Expand Down
3 changes: 2 additions & 1 deletion src/util/binary_linux.c
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
#include "binary.h"

#if defined(FF_HAVE_ELF) || defined(__sun)
#if defined(FF_HAVE_ELF) || defined(__sun) || defined(__FreeBSD__)

#include "common/io/io.h"
#include "common/library.h"
#include "util/stringUtils.h"

// WARNING: On FreeBSD, there are system `/usr/include/libelf.h` and pkg elfutils `/usr/local/include/libelf.h`; they are not compatible.
#include <libelf.h>
#include <fcntl.h>

Expand Down

0 comments on commit d8fb8d4

Please sign in to comment.