happyfish100 / fastdfs-nginx-module

FastDFS nginx module
GNU Lesser General Public License v3.0
434 stars 260 forks source link

alpine3.13编译报错 #91

Closed qifengzhang007 closed 2 years ago

qifengzhang007 commented 2 years ago

使用alpine:3.13编译ngixn带了这个模块

第一个报错点:

/usr/include/sys/poll.h:1:2: warning: #warning redirecting incorrect #include <sys/poll.h> to <poll.h> [-Wcpp]
    1 | #warning redirecting incorrect #include <sys/poll.h> to <poll.h>

第二个报错点:

pthread_func.c: In function 'init_pthread_rwlock':
pthread_func.c:93:14: warning: implicit declaration of function 'pthread_rwlockattr_setkind_np'; did you mean 'pthread_rwlockattr_setpshared'? [-Wimplicit-function-declaration]
   93 |  if ((result=pthread_rwlockattr_setkind_np(attr.ptr,
  //... 省略一些....
error: 'PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP' undeclared (first use in this function)

以下是更具体的报错过程

+ cd /tmp/libfastcommon-1.0.55
+ ./make.sh
gcc -Wall -Wformat-truncation=0 -Wformat-overflow=0 -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O3 -c -o hash.o hash.c  
gcc -Wall -Wformat-truncation=0 -Wformat-overflow=0 -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O3 -c -o chain.o chain.c  
gcc -Wall -Wformat-truncation=0 -Wformat-overflow=0 -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O3 -c -o shared_func.o shared_func.c  
gcc -Wall -Wformat-truncation=0 -Wformat-overflow=0 -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O3 -c -o ini_file_reader.o ini_file_reader.c  
gcc -Wall -Wformat-truncation=0 -Wformat-overflow=0 -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O3 -c -o logger.o logger.c  
gcc -Wall -Wformat-truncation=0 -Wformat-overflow=0 -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O3 -c -o sockopt.o sockopt.c  
In file included from sockopt.c:40:
/usr/include/sys/poll.h:1:2: warning: #warning redirecting incorrect #include <sys/poll.h> to <poll.h> [-Wcpp]
    1 | #warning redirecting incorrect #include <sys/poll.h> to <poll.h>
      |  ^~~~~~~
gcc -Wall -Wformat-truncation=0 -Wformat-overflow=0 -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O3 -c -o base64.o base64.c  
gcc -Wall -Wformat-truncation=0 -Wformat-overflow=0 -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O3 -c -o sched_thread.o sched_thread.c  
gcc -Wall -Wformat-truncation=0 -Wformat-overflow=0 -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O3 -c -o http_func.o http_func.c  
gcc -Wall -Wformat-truncation=0 -Wformat-overflow=0 -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O3 -c -o md5.o md5.c  
gcc -Wall -Wformat-truncation=0 -Wformat-overflow=0 -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O3 -c -o pthread_func.o pthread_func.c  
pthread_func.c: In function 'init_pthread_rwlock':
pthread_func.c:93:14: warning: implicit declaration of function 'pthread_rwlockattr_setkind_np'; did you mean 'pthread_rwlockattr_setpshared'? [-Wimplicit-function-declaration]
   93 |  if ((result=pthread_rwlockattr_setkind_np(attr.ptr,
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |              pthread_rwlockattr_setpshared
pthread_func.c:94:4: error: 'PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP' undeclared (first use in this function)
   94 |    PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP)) != 0)
      |    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
pthread_func.c:94:4: note: each undeclared identifier is reported only once for each function it appears in
make: *** [Makefile:69: pthread_func.o] Error 1
+ ./make.sh install
qifengzhang007 commented 2 years ago

发错位置了,是 libcommon仓库编译报的错,转移到 libcommon 仓库l: https://github.com/happyfish100/libfastcommon/issues/43 希望作者提供一下解决办法。 感谢。