happyfish100 / fastdfs

FastDFS is an open source high performance distributed file system (DFS). It's major functions include: file storing, file syncing and file accessing, and design for high capacity and load balance. Wechat/Weixin public account (Chinese Language): fastdfs
GNU General Public License v3.0
8.91k stars 1.97k forks source link

libserverframe编译失败 #675

Open bwcxyk opened 7 months ago

bwcxyk commented 7 months ago

最新的代码libfastcommon编译成功后,libserverframe编译失败。

ljmict commented 5 months ago
gcc -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O3 -fPIC -c -o sf_nio.lo sf_nio.c  -Iinclude -I/usr/local/include
In file included from /usr/include/fastcommon/fast_mblock.h:26:0,
                 from /usr/include/fastcommon/fast_task_queue.h:29,
                 from sf_nio.c:38:
/usr/include/fastcommon/fc_memory.h: In function ‘fc_malloc_ex’:
/usr/include/fastcommon/fc_memory.h:39:52: error: expected ‘)’ before ‘PRId64’
             logError("file: %s, line: %d, malloc %"PRId64" bytes fail, "
                                                    ^
/usr/include/fastcommon/fc_memory.h: In function ‘fc_realloc_ex’:
/usr/include/fastcommon/fc_memory.h:56:53: error: expected ‘)’ before ‘PRId64’
             logError("file: %s, line: %d, realloc %"PRId64" bytes fail, "
                                                     ^
/usr/include/fastcommon/fc_memory.h: In function ‘fc_calloc_ex’:
/usr/include/fastcommon/fc_memory.h:92:52: error: expected ‘)’ before ‘PRId64’
             logError("file: %s, line: %d, malloc %"PRId64" bytes fail, "
                                                    ^
In file included from /usr/include/fastcommon/fast_task_queue.h:29:0,
                 from sf_nio.c:38:
/usr/include/fastcommon/fast_mblock.h: At top level:
/usr/include/fastcommon/fast_mblock.h:138:5: error: unknown type name ‘pthread_lock_cond_pair_t’
     pthread_lock_cond_pair_t lcp;  //for read / write free node chain
     ^
/usr/include/fastcommon/fast_mblock.h: In function ‘fast_mblock_set_need_wait’:
/usr/include/fastcommon/fast_mblock.h:248:64: error: expected ‘)’ before ‘PRId64’
                 "need_lock: %d != 1 or alloc_elements.limit: %"PRId64" <= 0",
                                                                ^
/usr/include/fastcommon/fast_mblock.h:257:51: error: ‘LOG_NOTHING’ undeclared (first use in this function)
         mblock->alloc_elements.exceed_log_level = LOG_NOTHING;
                                                   ^
/usr/include/fastcommon/fast_mblock.h:257:51: note: each undeclared identifier is reported only once for each function it appears in
In file included from /usr/include/fastcommon/server_id_func.h:24:0,
                 from sf_types.h:28,
                 from sf_service.h:27,
                 from sf_nio.c:41:
/usr/include/fastcommon/fast_buffer.h: At top level:
/usr/include/fastcommon/fast_buffer.h:100:1: error: unknown type name ‘string_t’
 static inline int fast_buffer_append_string2(FastBuffer *buffer, const string_t *add)
 ^
/usr/include/fastcommon/fast_buffer.h: In function ‘fast_buffer_append_string2’:
/usr/include/fastcommon/fast_buffer.h:102:47: error: request for member ‘str’ in something not a structure or union
     return fast_buffer_append_buff(buffer, add->str, add->len);
                                               ^
/usr/include/fastcommon/fast_buffer.h:102:57: error: request for member ‘len’ in something not a structure or union
     return fast_buffer_append_buff(buffer, add->str, add->len);
                                                         ^
In file included from sf_types.h:28:0,
                 from sf_service.h:27,
                 from sf_nio.c:41:
/usr/include/fastcommon/server_id_func.h: At top level:
/usr/include/fastcommon/server_id_func.h:64:5: error: unknown type name ‘string_t’
     string_t group_name;
     ^
/usr/include/fastcommon/server_id_func.h:67:5: error: unknown type name ‘FCCommunicationType’
     FCCommunicationType comm_type;
     ^
/usr/include/fastcommon/server_id_func.h:71:9: error: unknown type name ‘string_t’
         string_t ip_prefix;
         ^
/usr/include/fastcommon/server_id_func.h:74:17: error: ‘FAST_INI_ITEM_NAME_SIZE’ undeclared here (not in a function)
  char name_buff[FAST_INI_ITEM_NAME_SIZE];  //group_name string holder
                 ^
/usr/include/fastcommon/server_id_func.h:98:5: error: unknown type name ‘string_t’
     string_t ip_addr;
     ^
/usr/include/fastcommon/server_id_func.h:135:5: error: unknown type name ‘FCCommunicationType’
     FCCommunicationType comm_type;
     ^
/usr/include/fastcommon/server_id_func.h:149:9: error: unknown type name ‘string_t’
         const string_t *ip_addr, const int port);
         ^
/usr/include/fastcommon/server_id_func.h: In function ‘fc_server_get_by_ip_port’:
/usr/include/fastcommon/server_id_func.h:154:5: error: unknown type name ‘string_t’
     string_t saddr;
     ^
/usr/include/fastcommon/server_id_func.h: At top level:
/usr/include/fastcommon/server_id_func.h:160:9: error: unknown type name ‘string_t’
         const string_t *group_name);
         ^
/usr/include/fastcommon/server_id_func.h:173:9: error: unknown type name ‘string_t’
         const string_t *group_name)
         ^
/usr/include/fastcommon/server_id_func.h: In function ‘fc_server_get_group_index’:
/usr/include/fastcommon/server_id_func.h:187:5: error: unknown type name ‘string_t’
     string_t gname;
     ^
/usr/include/fastcommon/server_id_func.h: In function ‘fc_server_close_connection’:
/usr/include/fastcommon/server_id_func.h:258:5: error: ‘G_COMMON_CONNECTION_CALLBACKS’ undeclared (first use in this function)
     G_COMMON_CONNECTION_CALLBACKS[conn->comm_type].close_connection(conn);
     ^
/usr/include/fastcommon/server_id_func.h:258:39: error: ‘ConnectionInfo’ has no member named ‘comm_type’
     G_COMMON_CONNECTION_CALLBACKS[conn->comm_type].close_connection(conn);
                                       ^
/usr/include/fastcommon/server_id_func.h: At top level:
/usr/include/fastcommon/server_id_func.h:267:33: error: unknown type name ‘fc_alloc_pd_callback’
 struct ibv_pd *fc_alloc_rdma_pd(fc_alloc_pd_callback alloc_pd,
                                 ^
In file included from sf_service.h:27:0,
                 from sf_nio.c:41:
sf_types.h:46:9: error: unknown type name ‘in_addr_64_t’
         const in_addr_64_t client_addr, const bool bInnerPort);
         ^
sf_types.h:116:5: error: unknown type name ‘FCCommunicationType’
     FCCommunicationType comm_type;
     ^
sf_types.h:126:5: error: unknown type name ‘fc_alloc_pd_callback’
     sf_alloc_pd_callback alloc_pd;
     ^
sf_types.h:315:5: error: unknown type name ‘key_value_pair_t’
     key_value_pair_t *elts;
     ^
sf_types.h:321:5: error: unknown type name ‘string_t’
     string_t name;
     ^
sf_types.h:350:5: error: unknown type name ‘pthread_lock_cond_pair_t’
     pthread_lock_cond_pair_t lcp;
     ^
In file included from sf_nio.h:28:0,
                 from sf_nio.c:42:
sf_global.h:63:5: error: unknown type name ‘string_t’
     string_t empty;
     ^
sf_global.h:68:5: error: unknown type name ‘IniFullContext’
     IniFullContext ini_ctx;
     ^
sf_global.h:72:5: error: unknown type name ‘FCCommunicationType’
     FCCommunicationType comm_type;
     ^
sf_global.h:199:9: error: unknown type name ‘IniFullContext’
         IniFullContext *ini_ctx, const bool load_network_params,
         ^
sf_global.h:204:9: error: unknown type name ‘IniFullContext’
         IniFullContext *ini_ctx)
         ^
sf_global.h:222:9: error: unknown type name ‘FCCommunicationType’
         const FCCommunicationType comm_type,
         ^
sf_global.h: In function ‘sf_load_config’:
sf_global.h:231:5: warning: implicit declaration of function ‘FAST_INI_SET_FULL_CTX_EX’ [-Wimplicit-function-declaration]
     SF_SET_CONTEXT_INI_CONFIG(config, comm_type, filename, pIniContext,
     ^
sf_global.h: At top level:
sf_global.h:242:9: error: unknown type name ‘FCCommunicationType’
         const FCCommunicationType comm_type,
         ^
sf_global.h:261:24: error: unknown type name ‘IniFullContext’
 int sf_load_log_config(IniFullContext *ini_ctx, LogContext *log_ctx,
                        ^
sf_global.h:264:32: error: unknown type name ‘IniFullContext’
 int sf_load_slow_log_config_ex(IniFullContext *ini_ctx, LogContext *log_ctx,
                                ^
sf_global.h: In function ‘sf_load_slow_log_config’:
sf_global.h:271:5: error: unknown type name ‘IniFullContext’
     IniFullContext ini_ctx;
     ^
sf_global.h:274:5: warning: implicit declaration of function ‘sf_load_slow_log_config_ex’ [-Wimplicit-function-declaration]
     return sf_load_slow_log_config_ex(&ini_ctx, log_ctx, slow_log_cfg);
     ^
sf_global.h: At top level:
sf_global.h:305:30: error: unknown type name ‘IniFullContext’
 int sf_load_global_base_path(IniFullContext *ini_ctx);
                              ^
sf_global.h:307:33: error: unknown type name ‘IniFullContext’
 int sf_load_data_path_config_ex(IniFullContext *ini_ctx,
                                 ^
sf_global.h:308:59: error: unknown type name ‘string_t’
         const char *item_name, const char *default_value, string_t *path);
                                                           ^
sf_global.h: In function ‘sf_set_global_base_path’:
sf_global.h:315:5: error: unknown type name ‘string_t’
     string_t path_string;
     ^
sf_global.h:318:5: warning: implicit declaration of function ‘normalize_path’ [-Wimplicit-function-declaration]
     normalize_path(NULL, &path_string, SF_G_BASE_PATH_STR,
     ^
sf_nio.c: In function ‘sf_socket_async_connect_server’:
sf_nio.c:260:5: warning: implicit declaration of function ‘socketCreateEx2’ [-Wimplicit-function-declaration]
     if ((task->event.fd=socketCreateEx2(AF_UNSPEC, task->server_ip,
     ^
sf_nio.c:266:5: warning: implicit declaration of function ‘asyncconnectserverbyip’ [-Wimplicit-function-declaration]
     return asyncconnectserverbyip(task->event.fd,
     ^
sf_nio.c: In function ‘sf_nio_notify’:
sf_nio.c:411:5: warning: implicit declaration of function ‘PTHREAD_MUTEX_LOCK’ [-Wimplicit-function-declaration]
     PTHREAD_MUTEX_LOCK(&task->thread_data->waiting_queue.lock);
     ^
sf_nio.c:421:5: warning: implicit declaration of function ‘PTHREAD_MUTEX_UNLOCK’ [-Wimplicit-function-declaration]
     PTHREAD_MUTEX_UNLOCK(&task->thread_data->waiting_queue.lock);
     ^
sf_nio.c: In function ‘check_task’:
sf_nio.c:532:37: error: ‘fc_comm_type_sock’ undeclared (first use in this function)
     if (task->handler->comm_type == fc_comm_type_sock) {
                                     ^
sf_nio.c:533:9: warning: implicit declaration of function ‘tcp_socket_connected’ [-Wimplicit-function-declaration]
         if (tcp_socket_connected(task->event.fd)) {
         ^
sf_nio.c: In function ‘sf_socket_send_data’:
sf_nio.c:555:17: warning: implicit declaration of function ‘FC_MIN’ [-Wimplicit-function-declaration]
                 FC_MIN(task->iovec_array.count, IOV_MAX));
                 ^
sf_nio.c:555:49: error: ‘IOV_MAX’ undeclared (first use in this function)
                 FC_MIN(task->iovec_array.count, IOV_MAX));
                                                 ^
sf_nio.c: In function ‘sf_socket_recv_data’:
sf_nio.c:703:5: warning: implicit declaration of function ‘TCP_SET_QUICK_ACK’ [-Wimplicit-function-declaration]
     TCP_SET_QUICK_ACK(task->event.fd);
     ^
sf_nio.c: In function ‘calc_iops_and_trigger_polling’:
sf_nio.c:795:50: error: expected ‘)’ before ‘PRId64’
                         "trigger polling iops: %"PRId64, __LINE__,
                                                  ^
sf_nio.c: In function ‘calc_iops_and_remove_polling’:
sf_nio.c:837:49: error: expected ‘)’ before ‘PRId64’
                         "remove polling iops: %"PRId64, __LINE__,
                                                 ^
sf_nio.c: In function ‘sf_client_sock_read’:
sf_nio.c:930:54: error: expected ‘)’ before ‘PRId64’
                         "client ip: %s, req_count: %"PRId64", recv timeout",
                                                      ^
sf_nio.c: In function ‘check_task’:
sf_nio.c:546:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
make: *** [sf_nio.lo] Error 1

我也遇到了

bwcxyk commented 5 months ago

我也遇到了

使用旧的版本了