c - 不同的内核版本如何改变 C 文件的编译过程(除了具有不同版本的 gcc)?
问题描述
我正在尝试编译 gem5 的 m5threads,但由于它仅与 Linux 内核版本 3.19(和 gcc 版本 4.8)兼容,因此出现编译错误。我使用的是 Linux 内核版本 5.4,但我使用的是旧版本的 gcc(gcc-4.8 甚至 gcc-4.4),但仍然出现构建错误(我知道人们仍然可以使用旧版本的 linux 内核版本来自 m5thread 存储库上打开的问题)。
除了正在使用的 gcc 的实际版本(可以更改)之外,不同的 linux 内核版本对使用 gcc 进行编译有什么其他影响?我在下面包含了makefile(以防提供更多见解)。
CC = gcc-4.4
CFLAGS = -O3 -static
.PHONY: all clean
all: libpthread.a(pthread.o)
clean:
$(RM) *.o libpthread.a
以下是构建错误:
gcc-4.4 -O3 -static -c -o pthread.o pthread.c
pthread.c: In function ‘pthread_rwlock_init’:
pthread.c:380: error: ‘struct __pthread_rwlock_arch_t’ has no member named ‘__lock’
pthread.c:381: error: ‘struct __pthread_rwlock_arch_t’ has no member named ‘__nr_readers’
pthread.c:382: error: ‘struct __pthread_rwlock_arch_t’ has no member named ‘__writer’
pthread.c: In function ‘pthread_rwlock_rdlock’:
pthread.c:398: error: ‘struct __pthread_rwlock_arch_t’ has no member named ‘__writer’
pthread.c:404: error: ‘struct __pthread_rwlock_arch_t’ has no member named ‘__lock’
pthread.c:405: error: ‘struct __pthread_rwlock_arch_t’ has no member named ‘__writer’
pthread.c:406: error: ‘struct __pthread_rwlock_arch_t’ has no member named ‘__nr_readers’
pthread.c:407: error: ‘struct __pthread_rwlock_arch_t’ has no member named ‘__lock’
pthread.c:411: error: ‘struct __pthread_rwlock_arch_t’ has no member named ‘__lock’
pthread.c: In function ‘pthread_rwlock_wrlock’:
pthread.c:422: error: ‘struct __pthread_rwlock_arch_t’ has no member named ‘__writer’
pthread.c:426: error: ‘struct __pthread_rwlock_arch_t’ has no member named ‘__nr_readers’
pthread.c:432: error: ‘struct __pthread_rwlock_arch_t’ has no member named ‘__lock’
pthread.c:433: error: ‘struct __pthread_rwlock_arch_t’ has no member named ‘__writer’
pthread.c:433: error: ‘struct __pthread_rwlock_arch_t’ has no member named ‘__nr_readers’
pthread.c:434: error: ‘struct __pthread_rwlock_arch_t’ has no member named ‘__writer’
pthread.c:435: error: ‘struct __pthread_rwlock_arch_t’ has no member named ‘__lock’
pthread.c:439: error: ‘struct __pthread_rwlock_arch_t’ has no member named ‘__lock’
pthread.c: In function ‘pthread_rwlock_unlock’:
pthread.c:448: error: ‘struct __pthread_rwlock_arch_t’ has no member named ‘__lock’
pthread.c:449: error: ‘struct __pthread_rwlock_arch_t’ has no member named ‘__writer’
pthread.c:451: error: ‘struct __pthread_rwlock_arch_t’ has no member named ‘__writer’
pthread.c:454: error: ‘struct __pthread_rwlock_arch_t’ has no member named ‘__nr_readers’
pthread.c:454: error: ‘struct __pthread_rwlock_arch_t’ has no member named ‘__nr_readers’
pthread.c:456: error: ‘struct __pthread_rwlock_arch_t’ has no member named ‘__lock’
pthread.c: In function ‘pthread_cond_init’:
pthread.c:536: error: ‘struct __pthread_cond_s’ has no member named ‘__lock’
pthread.c:537: error: ‘struct __pthread_cond_s’ has no member named ‘__futex’
pthread.c:538: error: ‘struct __pthread_cond_s’ has no member named ‘__nwaiters’
pthread.c: In function ‘pthread_cond_broadcast’:
pthread.c:549: error: ‘struct __pthread_cond_s’ has no member named ‘__lock’
pthread.c: In function ‘pthread_cond_wait’:
pthread.c:556: error: ‘struct __pthread_cond_s’ has no member named ‘__futex’
pthread.c:557: error: ‘struct __pthread_cond_s’ has no member named ‘__lock’
pthread.c:558: error: ‘struct __pthread_cond_s’ has no member named ‘__nwaiters’
: recipe for target 'pthread.o' failed
make: *** [pthread.o] Error 1
解决方案
推荐阅读
- postgresql - 如何在 Postgres 中找到一个月的最大选项数?
- django - Exception Value: 'AnonymousUser' object is not iterable
- r - How can I move geom_text labels further out on a ggplot pie chart?
- node.js - How to apply tf.layers.add on different models' weights?
- tfs - 每个待办事项是否有最多 10000 个工作项的限制?
- swagger - Reusability of @ApiResponse Annotation in Swagger
- node.js - How can I do anything else than console.log(json) while fetching an API without getting
? - javascript - 你如何允许使用 react-player 缓冲到某个时间戳?
- c - OpenCL 编译问题
- react-native - react-native-snap-carousel 堆栈布局在 iOS 和 Android 上活动不同