usr/include/gnu/stubs.h:7:27: 致命错误

宇文智敏
2023-12-01

[ 50%] Building CXX object CMakeFiles/cpp.dir/test/main.cpp.o
In file included from /usr/include/features.h:392:0,
from /usr/local/gcc-4.9.2-1/usr/include/c++/4.9.2/x86_64-redhat-linux/32/bits/os_defines.h:39,
from /usr/local/gcc-4.9.2-1/usr/include/c++/4.9.2/x86_64-redhat-linux/32/bits/c++config.h:430,
from /usr/local/gcc-4.9.2-1/usr/include/c++/4.9.2/limits:42,
from /media/B/gitlab/lv-iii/cpp/3th/include/gtest/gtest.h:54,
from /media/B/gitlab/lv-iii/cpp/test/main.cpp:1:
/usr/include/gnu/stubs.h:7:27: 致命错误:gnu/stubs-32.h:No such file or directory

include <gnu/stubs-32.h>

查看cmakefiles.txt发现命令多了 -m32,去掉这个选项就可以了;当然,如果你链接了32位的库文件,则把库重新变成64位的库。否则,如果不方便去掉-m32,就需要安装32位的glibc和glibc++库文件。

IF(UNIX)
  SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++1y -m32")
  SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m32")
ENDIF(UNIX)


可以试试下面的命令(命令来源,没有试过)
安装32位glibc库文件命令和:
sudo yum install glibc-devel.i686
安装32位glibc++库文件命令
sudo yum install libstdc++-devel.i686

 类似资料: