首页 > 解决方案 > 使用 cygwin 在 Windows 上构建 Seafile-Client

问题描述

我尝试使用 cygwin 在 Windows 上构建 seafile-client。当我调用 ./configure 命令时,它会将构建系统检测为 Linux

...
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... yes
checking for special C compiler options needed for large files... no
checking for _FILE_OFFSET_BITS value needed for large files... no
checking for WIN32... no
checking for Mac... no
checking for Linux... compile in linux
checking for uuid_generate in -luuid... yes
found library uuid
...

它配置成功,但是当我调用 make 命令时,它会发生很多错误。我想这是因为它将构建系统检测为 linux,但我认为它必须是 windows。我该怎么做才能解决这个问题?

进行错误输出:

Making all in daemon
make[2]: Entering directory '/cygdrive/c/msys/1.0/home/seafile-6.2.4/daemon'
gcc -DHAVE_CONFIG_H -I. -I..    -DPKGDATADIR=\"/usr/local/share/seafile\" -DPACKAGE_DATA_DIR=\""/usr/local/share/seafile"\" -DSEAFILE_CLIENT -I../include -I../lib -I../lib -I../common -D_REENTRANT -I/usr/local/include -I/usr/local/include/searpc -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -Wall -g -O2 -MT http-tx-mgr.o -MD -MP -MF .deps/http-tx-mgr.Tpo -c -o http-tx-mgr.o http-tx-mgr.c
http-tx-mgr.c: 'http_get' işlevinde:
http-tx-mgr.c:741:91: hata: expected ')' before 'USER_AGENT_OS'
     headers = curl_slist_append (headers, "User-Agent: Seafile/"SEAFILE_CLIENT_VERSION" ("USER_AGENT_OS")");
                                                                                           ^~~~~~~~~~~~~
http-tx-mgr.c: 'http_put' işlevinde:
http-tx-mgr.c:865:91: hata: expected ')' before 'USER_AGENT_OS'
     headers = curl_slist_append (headers, "User-Agent: Seafile/"SEAFILE_CLIENT_VERSION" ("USER_AGENT_OS")");
                                                                                           ^~~~~~~~~~~~~
http-tx-mgr.c: 'http_post' işlevinde:
http-tx-mgr.c:982:91: hata: expected ')' before 'USER_AGENT_OS'
     headers = curl_slist_append (headers, "User-Agent: Seafile/"SEAFILE_CLIENT_VERSION" ("USER_AGENT_OS")");
                                                                                           ^~~~~~~~~~~~~
Üst düzeyde:
http-tx-mgr.c:507:1: UYARI: 'load_ca_bundle' defined but not used [-Wunused-function]
 load_ca_bundle (CURL *curl)
 ^~~~~~~~~~~~~~
make[2]: *** [Makefile:581: http-tx-mgr.o] Error 1
make[2]: Leaving directory '/cygdrive/c/msys/1.0/home/seafile-6.2.4/daemon'
make[1]: *** [Makefile:444: all-recursive] Error 1
make[1]: Leaving directory '/cygdrive/c/msys/1.0/home/seafile-6.2.4'
make: *** [Makefile:376: all] Error 2

此代码为交叉编译而编写,包含许多定义,如下所示:

...
#ifdef WIN32
#include <windows.h>
#include <wincrypt.h>
#endif
...
#ifndef SEAFILE_CLIENT_VERSION
#define SEAFILE_CLIENT_VERSION PACKAGE_VERSION
#endif

#ifdef WIN32
#define USER_AGENT_OS "Windows NT"
#endif

#ifdef __APPLE__
#define USER_AGENT_OS "Apple OS X"
#endif

#ifdef __linux__
#define USER_AGENT_OS "Linux"
#endif

#if defined __FreeBSD__ || defined __NetBSD__ || defined __OpenBSD__ || defined __DragonFly__
#define USER_AGENT_OS "BSD"
#endif
...

标签: makefilecygwinseafile-server

解决方案


推荐阅读