You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Ubuntu 18.04编译glibc 2.28报错:syslog函数无法内联

在Ubuntu 18.04下编译glibc 2.28遭遇内联失败错误

环境与路径配置

GLIBC_VERSION="2.28"
GLIBC_DIR="$HOME/.local/src/opt/glibc-$GLIBC_VERSION"
GLIBC_TAR="$HOME/.local/src/opt/glibc-$GLIBC_VERSION.tar.gz"
GLIBC_INSTALL_DIR="$HOME/.local/opt/glibc-$GLIBC_VERSION"

下载与编译步骤

  • 下载源码包:
wget --no-check-certificate https://ftp.gnu.org/gnu/glibc/glibc-$GLIBC_VERSION.tar.gz
# 解压至GLIBC_DIR目录
  • 编译配置及执行:
mkdir build
cd build
../configure --prefix="$GLIBC_INSTALL_DIR" --enable-add-ons --disable-werror --with-headers=$HOME/.local/src/linux-header/include
make -j3

编译报错信息

.local/src/opt/glibc-2.28/build/misc/flistxattr.os
In file included from <command-line>:0:0:
../misc/syslog.c: In function '__vsyslog_chk':
../misc/syslog.c:121:30: error: inlining failed in call to always_inline 'syslog': function not inlinable
 ldbl_strong_alias (__syslog, syslog)
                              ^
./../include/libc-symbols.h:135:26: note: in definition of macro '_strong_alias'
   extern __typeof (name) aliasname __attribute__ ((alias (#name)));
                          ^~~~~~~~~
../sysdeps/generic/math_ldbl_opt.h:12:44: note: in expansion of macro 'strong_alias'
 #define ldbl_strong_alias(name, aliasname) strong_alias (name, aliasname)
                                            ^~~~~~~~~~~~
../misc/syslog.c:121:1: note: in expansion of macro 'ldbl_strong_alias'
 ldbl_strong_alias (__syslog, syslog)
 ^~~~~~~~~~~~~~~~~
In file included from ../sysdeps/unix/sysv/linux/syslog.c:4:0:
../misc/syslog.c:153:3: note: called from here
   syslog(INTERNALLOG,
   ^~~~~~~~~~~~~~~~~~~
       "syslog: unknown facility/priority: %x", pri);
       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

错误中文说明:在__vsyslog_chk函数中,调用标记为always_inline的syslog函数时内联失败,提示该函数无法被内联,报错位置关联到ldbl_strong_alias宏对__syslog和syslog的别名定义,以及syslog函数在代码中的调用处。

已尝试的无效解决方法

  • 方法一:
make clean
make -j2 CFLAGS="-U_FORTIFY_SOURCE -O2 -fno-stack-protector"
  • 方法二:
configure CFLAGS="-O2 -U_FORTIFY_SOURCE -fno-stack-protector"
make -j2
  • 方法三:
configure CFLAGS="-U_FORTIFY_SOURCE -O2 -fno-stack-protector" ${CFLAGS/-Wp,-D_FORTIFY_SOURCE=2/}
make -j2 CFLAGS="-U_FORTIFY_SOURCE -O2 -fno-stack-protector ${CFLAGS/-Wp,-D_FORTIFY_SOURCE=2/}"

内容的提问来源于stack exchange,提问作者zhang

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.12 16:45:54