diff --git a/src/base/files/scoped_file_linux.cc b/src/base/files/scoped_file_linux.cc index 5074ef4d90..9c00f893ae 100644 --- a/src/base/files/scoped_file_linux.cc +++ b/src/base/files/scoped_file_linux.cc @@ -82,6 +82,7 @@ bool IsFDOwned(int fd) { } // namespace base +#ifndef OPENWRT_BUILD_STATIC #if !defined(COMPONENT_BUILD) using LibcCloseFuncPtr = int (*)(int); @@ -113,3 +114,4 @@ __attribute__((visibility("default"), noinline)) int close(int fd) { } // extern "C" #endif // !defined(COMPONENT_BUILD) +#endif // OPENWRT_BUILD_STATIC diff --git a/src/build/config/openwrt/BUILD.gn b/src/build/config/openwrt/BUILD.gn index 7ad8ede3e7..124817262c 100644 --- a/src/build/config/openwrt/BUILD.gn +++ b/src/build/config/openwrt/BUILD.gn @@ -34,6 +34,7 @@ config("compiler") { if (build_static) { # Musl static objects are not built with -fPIC, cannot use -static-pie. ldflags += [ "-static" ] + defines += [ "OPENWRT_BUILD_STATIC" ] } else if (current_cpu == "x86") { ldflags += [ "-Wl,--dynamic-linker=/lib/ld-musl-i386.so.1" ] } else if (current_cpu == "mipsel") {