当前位置:网站首页>编译GCC遇到的“pthread.h” not found问题
编译GCC遇到的“pthread.h” not found问题
2022-07-03 04:55:00 【passenger12234】
在LFS的第五章从源码编译freestanding的GCC时遇到如下报错
./gthr-default.h:35:10: fatal error: pthread.h: No such file or directory
35 | #include <pthread.h>
书上给的参考配置指令为
../configure \
--target=$LFS_TGT \
--prefix=$LFS/tools \
--with-glibc-version=2.35 \
--with-sysroot=$LFS \
--with-newlib \
--without-headers \
--enable-initfini-array \
--disable-nls \
--disable-shared \
--disable-multilib \
--disable-decimal-float \
--disable-threads \
--disable-libatomic \
--disable-libgomp \
--disable-libquadmath \
--disable-libssp \
--disable-libvtv \
--disable-libstdcxx \
--enable-languages=c,c++
我首先尝试了一下删除上述的一堆disable,使用了如下的配置指令(主要是好奇configure会不会自动推断出来一些库和feature没办法支持,比如threads)
../configure \
--target=$LFS_TGT \
--prefix=$LFS/tools \
--with-glibc-version=2.35 \
--with-sysroot=$LFS \
--with-newlib \
--without-headers \
--enable-initfini-array \
--disable-nls \
--disable-shared \
--disable-multilib \
然后果不其然,我得到了如下报错
./gthr-default.h:35:10: fatal error: pthread.h: No such file or directory
35 | #include <pthread.h>
于是我尝试了make clean,然后使用书上的配置指令重新configure。不解的是,仍然得到了上面的pthread.h not found的报错(预期由于移除了线程支持,应该不再依赖pthread.h头文件)。
发现使用rm -rf *把build目录全部删除后再重新configure就成功了。这说明是前面的make clean没有讲配置文件删除干净。
一番搜索后,发现了GNU automake的说明以及GNU coding styles的说明。
在上面coding styles的文档中有如下说明
‘clean’
Delete all files in the current directory that are normally created by building the program. Also delete files in other directories if they are created by this makefile. However, don’t delete the files that record the configuration. Also preserve files that could be made by building, but normally aren’t because the distribution comes with them. There is no need to delete parent directories that were created with ‘mkdir -p’, since they could have existed anyway.
‘distclean’
Delete all files in the current directory (or created by this makefile) that are created by configuring or building the program. If you have unpacked the source and built the program without creating any other files, ‘make distclean’ should leave only the files that were in the distribution. However, there is no need to delete parent directories that were created with ‘mkdir -p’, since they could have existed anyway.
Delete .dvi files here if they are not part of the distribution.
在上面automake的文档中,定义了如下的clean语义
- If
makebuilt it, and it is commonly something that one would want to rebuild (for instance, a.ofile), thenmostlycleanshould delete it. - Otherwise, if
makebuilt it, thencleanshould delete it. - If
configurebuilt it, thendistcleanshould delete it. - If the maintainer built it (for instance, a
.infofile), thenmaintainer-cleanshould delete it. Howevermaintainer-cleanshould not delete anything that needs to exist in order to run‘./configure && make’.
所以我之前的操作问题在于不应该使用make clean,而应该使用make distclean。
边栏推荐
- 逆袭大学生的职业规划
- JDBC database operation
- C primre plus Chapter 10 question 6 inverted array
- MPM model and ab pressure test
- 【XSS绕过-防护策略】理解防护策略,更好的绕过
- [PHP vulnerability weak type] basic knowledge, PHP weak equality, error reporting and bypassing
- stm32逆向入门
- 2022-02-12 daily clock in: problem fine brush
- Summary of training competition (Lao Li's collection of questions)
- 论文阅读_中文医疗模型_ eHealth
猜你喜欢
![[research materials] 2021 China's game industry brand report - Download attached](/img/b7/a377b0b7c742078e2feb28ebfbca62.jpg)
[research materials] 2021 China's game industry brand report - Download attached

Concurrent operation memory interaction

论文阅读_ICD编码_MSMN

Leetcode simple problem delete an element to strictly increment the array

Pyqt control part (II)

On typescript and grammar

Shuttle + Alluxio 加速内存Shuffle起飞
![[PCL self study: filtering] introduction and use of various filters in PCL (continuously updated)](/img/36/53886b9d3b98f744be2b6aa6b5d3eb.jpg)
[PCL self study: filtering] introduction and use of various filters in PCL (continuously updated)

MediaTek 2023 IC written examination approved in advance (topic)

Leetcode simple question: the key with the longest key duration
随机推荐
【SQL注入点】注入点出现位置、判断
Learning practice: comprehensive application of cycle and branch structure (I)
Apache MPM model and ab stress test
[set theory] relational representation (relational matrix | examples of relational matrix | properties of relational matrix | operations of relational matrix | relational graph | examples of relationa
Esp32-c3 learning and testing WiFi (II. Wi Fi distribution - smart_config mode and BlueIf mode)
Sprintf formatter abnormal exit problem
Actual combat 8051 drives 8-bit nixie tube
Preparation for school and professional cognition
论文阅读_中文NLP_ELECTRA
Shell script Basics - basic grammar knowledge
Market status and development prospects of the global IOT active infrared sensor industry in 2022
STM32 reverse entry
[set theory] relationship properties (symmetry | symmetry examples | symmetry related theorems | antisymmetry | antisymmetry examples | antisymmetry theorems)
ZABBIX monitoring of lamp architecture (2): ZABBIX basic operation
Realize file download through the tag of < a > and customize the file name
UiPath实战(08) - 选取器(Selector)
ZABBIX monitoring of lamp architecture (3): zabbix+mysql (to be continued)
Retirement plan fails, 64 year old programmer starts work again
The current market situation and development prospect of the global gluten tolerance test kit industry in 2022
Notes | numpy-11 Array operation