Rexdf

The devil is in the Details.

编译filezilla之2

| Comments

自己编译FileZilla Client中编译过3.9,但是对于最近的3.10却一直编译不出来。

换了多个编译器,其中发现个新环境msys2中提到过的基本都试了一遍(实际上主要在实验有4.9的,因为Filezilla3.10.x似乎用到了4.9的一些特性或者头文件)。

1.shobj.h present but cannot be compiled

这个问题也比较复杂,除了msys2,几乎不可避免都存在这个错误,因为是configure时的错误,所以下面的一些错误就不会出现。

bugsMyBlog
checking for whether we need -stdlib=libc++... no
checking for whether we can include <unordered_map>... yes
checking shlobj.h usability... no
checking shlobj.h presence... yes
configure: WARNING: shlobj.h: present but cannot be compiled
configure: WARNING: shlobj.h: check for missing prerequisite headers?
configure: WARNING: shlobj.h: see the Autoconf documentation
configure: WARNING: shlobj.h: section "Present But Cannot Be Compiled"
configure: WARNING: shlobj.h: proceeding with the compiler's result
configure: WARNING: ## ---------------------------------------------- ##
configure: WARNING: ## Report this to tim.kosse@filezilla-project.org ##
configure: WARNING: ## ---------------------------------------------- ##
checking for shlobj.h... no
configure: error: shlobj.h not found which is part of the Windows API

解决办法: > D:\msys\mingw64\x86_64-w64-mingw32\include\shlobj.h > D:\msys\mingw\i686-w64-mingw32\include\shlobj.h > 开头几行参考MinGW-w64的git源码 > 把9-11行改成如下内容

fixMyBlog
#include <wtypesbase.h>
#include <wincrypt.h>
#include <winapifamily.h>

2.cc1plus.exe has stopped working

bugsMyBlog
make[4]: Entering directory `/home/rexdf/filezilla/src/interface'
g++ -DHAVE_CONFIG_H -I. -I../../src/include -I./../include -I/usr/local/lib/wx/
include/msw-unicode-static-3.0 -I/usr/local/include/wx-3.0 -D_FILE_OFFSET_BITS=6
4 -D__WXMSW__ -ID:/msys/local/include -fpch-preprocess -g -O2 -Wall -g -std
=gnu++11 -MT filezilla-aboutdialog.o -MD -MP -MF .deps/filezilla-aboutdialog.Tpo
-c -o filezilla-aboutdialog.o `test -f 'aboutdialog.cpp' || echo './'`aboutdial
og.cpp
Makefile:932: recipe for target `filezilla-aboutdialog.o' failed
make[4]: *** [filezilla-aboutdialog.o] Error 1
make[4]: Leaving directory `/home/rexdf/filezilla/src/interface'
Makefile:2470: recipe for target `all-recursive' failed
make[3]: *** [all-recursive] Error 1
make[3]: Leaving directory `/home/rexdf/filezilla/src/interface'
Makefile:654: recipe for target `all' failed
make[2]: *** [all] Error 2
make[2]: Leaving directory `/home/rexdf/filezilla/src/interface'
Makefile:346: recipe for target `all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/rexdf/filezilla/src'
Makefile:529: recipe for target `all-recursive' failed
make: *** [all-recursive] Error 1

解决办法,我在论坛提问,作者botg给出了答案. configure的时候添加 --disable-precomp

这个已经添加到了wiki页面,所以应该不存在什么问题。

3.localtime_r gmtime_r相关的错误

-gnutls-3.3.13/gl/time.h read_file.c

time.h 461 1 error expected identifier or before token

bugsMyBlog
In file included from ./time.h:369:0,
from timespec.h:22,
from gettime.c:22:
./time.h:461:1: error: expected identifier or '(' before '{' token
_GL_FUNCDECL_SYS (localtime_r, struct tm *, (time_t const *restrict __timer,
^
./time.h:483:1: error: expected identifier or '(' before '{' token
_GL_FUNCDECL_SYS (gmtime_r, struct tm *, (time_t const *restrict __timer,
^
make[6]: Makefile:1559: recipe for target `gettime.lo' failed*** [gettime.lo] Er
ror 1

检测办法echo -e "#include<pthread.h>\n localtime_r(1,2);" | gcc -E -

看输出结果的最后一行是不是localtime_r(1,2),有几个版本的MinGW(TDM-GCC 4.9.2,Win-builds1.5 gcc 4.8.3)展开成了一些乱七八糟的宏。

问题在于这个pthread.h里面定义的错误。

解决办法:把gl/time.h和src/gl/time.h这两个文件手动打一个patch。368行include的if改成0.(编译时才生产)

4.cygwin posix环境影响process.h

bugsMyBlog
make all-am
make[3]: Entering directory '/home/rexdf/filezilla/src/engine'
i686-w64-mingw32-g++ -DHAVE_CONFIG_H -I. -I../../src/include -I./../include -I/path/to/msys2/home/rexdf/build/include -I/path/to/msys2/mingw32/include -I/home/rexdf/build/lib/wx/include/i686-w64-mingw32-msw-unicode-static-3.0 -I/home/rexdf/build/include/wx-3.0 -D_FILE_OFFSET_BITS=64 -D__WXMSW__ -I/home/rexdf/build/include -g -O2 -Wall -g -std=gnu++11 -MT libengine_a-backend.o -MD -MP -MF .deps/libengine_a-backend.Tpo -c -o libengine_a-backend.o `test -f 'backend.cpp' || echo './'`backend.cpp
In file included from /path/to/msys2/mingw32/include/c++/4.9.2/memory:74:0,
from ./process.h:11,
from /path/to/msys2/mingw32/i686-w64-mingw32/include/pthread.h:66,
from /path/to/msys2/mingw32/include/c++/4.9.2/i686-w64-mingw32/bits/gthr-default.h:35,
from /path/to/msys2/mingw32/include/c++/4.9.2/i686-w64-mingw32/bits/gthr.h:148,
from /path/to/msys2/mingw32/include/c++/4.9.2/ext/atomicity.h:35,
from /path/to/msys2/mingw32/include/c++/4.9.2/bits/basic_string.h:39,
from /path/to/msys2/mingw32/include/c++/4.9.2/string:52,
from /path/to/msys2/home/rexdf/build/include/wx-3.0/wx/stringimpl.h:66,
from /path/to/msys2/home/rexdf/build/include/wx-3.0/wx/unichar.h:15,
from /path/to/msys2/home/rexdf/build/include/wx-3.0/wx/strvararg.h:22,
from /path/to/msys2/home/rexdf/build/include/wx-3.0/wx/string.h:46,
from /path/to/msys2/home/rexdf/build/include/wx-3.0/wx/longlong.h:19,
from /path/to/msys2/home/rexdf/build/include/wx-3.0/wx/datetime.h:27,
from ../../src/include/libfilezilla.h:29,
from ./filezilla.h:1,
from backend.cpp:1:
/path/to/msys2/mingw32/include/c++/4.9.2/ext/concurrence.h:124:5: error: '__gthread_mutex_t' does not name a type
__gthread_mutex_t _M_mutex;
^
/path/to/msys2/mingw32/include/c++/4.9.2/ext/concurrence.h:169:5: error: '__gthread_mutex_t' does not name a type
__gthread_mutex_t* gthread_mutex(void)
^
/path/to/msys2/mingw32/include/c++/4.9.2/ext/concurrence.h: In constructor '__gnu_cxx::__mutex::__mutex()':
/path/to/msys2/mingw32/include/c++/4.9.2/ext/concurrence.h:134:30: error: '__gthread_active_p' was not declared in this scope
if (__gthread_active_p ( ) )
^
  • 在cygwin/msys2环境下面,posix环境影响process.h,在src/include/libfilezilla.h里面添加一行(第28行)#include <process.h>

Comments