c - "error: conflicting types for ‘sem_t’“在Ubuntu上编译eglibc-2.19时

标签 c ubuntu compiler-errors building eglibc

我试图在我通过下载的 Ubuntu 14.04 LTS 上构建eglibc-2.19

apt-get source libc6

我按照安装说明进行操作,但在遇到 nptl 时出现此错误

gcc sem_init.c -c -std=gnu99 -fgnu89-inline -fno-stack-protector -O2 -Wall -Winline -Wwrite-strings -fmerge-all-constants -frounding-math -g -Wstrict-prototypes      -U_FORTIFY_SOURCE   -I../include -I/home/gpanda/wksp/glibc/tmp2/glibc-build/nptl  -I/home/gpanda/wksp/glibc/tmp2/glibc-build  -I../sysdeps/unix/sysv/linux/x86_64/64/nptl  -I../sysdeps/unix/sysv/linux/x86_64/64  -I../nptl/sysdeps/unix/sysv/linux/x86_64  -I../nptl/sysdeps/unix/sysv/linux/x86  -I../sysdeps/unix/sysv/linux/x86  -I../sysdeps/unix/sysv/linux/x86_64  -I../sysdeps/unix/sysv/linux/wordsize-64  -I../nptl/sysdeps/unix/sysv/linux  -I../nptl/sysdeps/pthread  -I../libpthread/sysdeps/pthread  -I../sysdeps/pthread  -I../ports/sysdeps/unix/sysv/linux  -I../sysdeps/unix/sysv/linux  -I../sysdeps/gnu  -I../sysdeps/unix/inet  -I../nptl/sysdeps/unix/sysv  -I../ports/sysdeps/unix/sysv  -I../sysdeps/unix/sysv  -I../sysdeps/unix/x86_64  -I../nptl/sysdeps/unix  -I../ports/sysdeps/unix  -I../sysdeps/unix  -I../sysdeps/posix  -I../libpthread/sysdeps/posix  -I../nptl/sysdeps/x86_64/64  -I../sysdeps/x86_64/64  -I../sysdeps/x86_64/fpu/multiarch  -I../sysdeps/x86_64/fpu  -I../sysdeps/x86/fpu  -I../sysdeps/x86_64/multiarch  -I../nptl/sysdeps/x86_64  -I../sysdeps/x86_64  -I../sysdeps/x86  -I../sysdeps/ieee754/ldbl-96  -I../sysdeps/ieee754/dbl-64/wordsize-64  -I../sysdeps/ieee754/dbl-64  -I../sysdeps/ieee754/flt-32  -I../sysdeps/wordsize-64  -I../sysdeps/ieee754  -I../sysdeps/generic  -I../libpthread/include -I../libpthread  -I../nptl  -I../ports  -I.. -I../libio -I.  -I../libpthread/include  -D_LIBC_REENTRANT -include ../include/libc-symbols.h   -DNOT_IN_libc=1 -DIS_IN_libpthread=1 -DIN_LIB=libpthread    -o /home/gpanda/wksp/glibc/tmp2/glibc-build/nptl/sem_init.o -MD -MP -MF /home/gpanda/wksp/glibc/tmp2/glibc-build/nptl/sem_init.o.dt -MT /home/gpanda/wksp/glibc/tmp2/glibc-build/nptl/sem_init.o
In file included from sem_init.c:20:0:
../libpthread/include/semaphore.h:28:0: warning: "SEM_FAILED" redefined [enabled by default]
 #define SEM_FAILED ((void *) 0)
 ^
In file included from ../libpthread/include/semaphore.h:26:0,
                 from sem_init.c:20:
../nptl/sysdeps/unix/sysv/linux/x86/bits/semaphore.h:33:0: note: this is the location of the previous definition
 #define SEM_FAILED      ((sem_t *) 0)
 ^
In file included from sem_init.c:20:0:
../libpthread/include/semaphore.h:30:28: error: conflicting types for ‘sem_t’
 typedef struct __semaphore sem_t;
                            ^
In file included from ../libpthread/include/semaphore.h:26:0,
                 from sem_init.c:20:
../nptl/sysdeps/unix/sysv/linux/x86/bits/semaphore.h:40:3: note: previous declaration of ‘sem_t’ was here
 } sem_t;
   ^
make[2]: *** [/home/gpanda/wksp/glibc/tmp2/glibc-build/nptl/sem_init.o] Error 1
make[2]: Leaving directory `/home/gpanda/wksp/glibc/tmp2/eglibc-2.19/nptl'
make[1]: *** [nptl/subdir_lib] Error 2
make[1]: Leaving directory `/home/gpanda/wksp/glibc/tmp2/eglibc-2.19'
make: *** [all] Error 2

这是 libpthread 和 nptl 之间的某种冲突吗?如何解决这个问题? 提前致谢。

最佳答案

考虑到LinuxThreads已经被NPTL取代了,所以我只是从eglibc目录中删除了附加的libpthread,并重新进行了configure和make,那么现在一切似乎都正常了。

参见LinuxThreads , NPTL

顺便说一句,因为我没有使用标准/usr 路径作为配置的“--prefix=”选项,所以我需要将 libstdc++.so.6 和 libgcc_s.so.1 复制到我当前的构建路径以获得“检查”通过。

参见glibc Known_testsuite_failures

关于c - "error: conflicting types for ‘sem_t’“在Ubuntu上编译eglibc-2.19时,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32930043/

相关文章:

c - 单链表结构插入/删除多个空闲

c# - C#错误CS1513

xcode "compile source as"覆盖特定文件

swift - 如何在没有UI的情况下编写简单的Xcode Swift程序

c++ - 如何在函数中使用无参变量?

c++ - 如何安全地将无符号值转换为有符号值?

c - 所有数据类型的单向链表,实现C语言的插入、删除、查找元素

node.js - 如何设置专用的专用 Node.js Ubuntu 服务器?

mysql - Xampp/Lampp 更改数据库目录(无数据目录)

linux - Ubuntu 16.10 在运行时随机化函数地址