diff --git a/Libraries/LibCore/Environment.cpp b/Libraries/LibCore/Environment.cpp index b377bf7f5fd..6e1f895704a 100644 --- a/Libraries/LibCore/Environment.cpp +++ b/Libraries/LibCore/Environment.cpp @@ -13,6 +13,9 @@ #if defined(AK_OS_MACOS) || defined(AK_OS_IOS) # include +#elif defined(AK_OS_FREEBSD) +// FIXME: Remove this once FreeBSD exports environ from libc +extern "C" __attribute__((weak)) char** environ; #elif !defined(AK_OS_WINDOWS) extern "C" char** environ; #endif diff --git a/Meta/CMake/lagom_compile_options.cmake b/Meta/CMake/lagom_compile_options.cmake index ceab3ba37a3..86100743327 100644 --- a/Meta/CMake/lagom_compile_options.cmake +++ b/Meta/CMake/lagom_compile_options.cmake @@ -75,7 +75,10 @@ if (NOT WIN32 AND NOT APPLE AND NOT ENABLE_FUZZERS) else() add_link_options(LINKER:-z,defs) add_link_options(LINKER:--no-undefined) - add_link_options(LINKER:--no-allow-shlib-undefined) + # FIXME: Remove this once FreeBSD exports environ from libc + if (NOT CMAKE_SYSTEM_NAME MATCHES "FreeBSD") + add_link_options(LINKER:--no-allow-shlib-undefined) + endif() endif() endif()