Compiling FileZilla Server Using Visual Studio 2005

Moderator: Project members

Message
Author
Kevin Gale
500 Command not understood
Posts: 5
Joined: 2008-07-25 08:57
First name: Kevin
Last name: Gale

Compiling FileZilla Server Using Visual Studio 2005

#1 Post by Kevin Gale » 2008-07-25 09:19

Hi.

I'm trying to build the FileZilla server using Visual Studio 2005 but are running into some problems.

1. When I first try to built the server it complains that it cannot find zlib.h
This obviously tells me that I need to build zlib. I have downloaded the zlib source and compiled it. I have also moved the zlib header files into the main FileZilla source directory.


2. When I next try to build the server it complains that it cannot find various files for the boot regex module.
This obviously tells me that I need to build boost. To temporarily test things I have commented out all code that refers to the regex module.


3. When I next try to build the server it complains that it cannot find zlib.lib
This makes sense I have not placed the library into the source directory. However, the problem I have is that when I build zlib it does not create a zlib.lib library. I have tried building both the static and dll versions but none of the libraries are called zlib.lib. I have tried renaming 'zlibstat.lib', 'zlibwapi.dll' and 'zlibwapi.lib' but none of these seem to work.
So. My first questions are:
a) What should I be building (static or dynamic)?
b) What file should I rename to zlib.lib?


4. Building Boost
Although this is off-topic. Does anybody have any experience building boost under Visual Studio as when I open the boost project? When I open the project and Visual Studio tries to update it I just get an error stating that the project is corrupted.



Any help would be greatly appreciated.

Regards,
Kev.

User avatar
botg
Site Admin
Posts: 35508
Joined: 2004-02-23 20:49
First name: Tim
Last name: Kosse

Re: Compiling FileZilla Server Using Visual Studio 2005

#2 Post by botg » 2008-07-25 09:46

Don't move include files into the FileZilla Server directory, adjust the include paths VS searches. Tools -> Options -> Projects -> VC++ Directories or similar depending on VS version. Same with the library files.

About boost, you should build it from the commandline. See the provided documentation.

Kevin Gale
500 Command not understood
Posts: 5
Joined: 2008-07-25 08:57
First name: Kevin
Last name: Gale

Re: Compiling FileZilla Server Using Visual Studio 2005

#3 Post by Kevin Gale » 2008-07-25 12:24

Hi.

Thanks for your reply.

I have done this but zlib.lib still cannot be found.

As I mentioned in my original message this is because when I build zlib it does not create anything called zlib.lib
Either the FileZilla project is incorrect, zlib is incorrect or there is a step in the middle that needs to be done.



Cheers,
Kev.

User avatar
botg
Site Admin
Posts: 35508
Joined: 2004-02-23 20:49
First name: Tim
Last name: Kosse

Re: Compiling FileZilla Server Using Visual Studio 2005

#4 Post by botg » 2008-07-25 12:43

Should be enough to rename zlibstat.lib

Kevin Gale
500 Command not understood
Posts: 5
Joined: 2008-07-25 08:57
First name: Kevin
Last name: Gale

Re: Compiling FileZilla Server Using Visual Studio 2005

#5 Post by Kevin Gale » 2008-07-25 13:44

HI.

Thanks for your reply.

I renamed the static library but had to move it into the main FileZilla server source for it to find it.

However, when I attempt to build the service I now get the following:

Error 28 error LNK2019: unresolved external symbol "unsigned int (__stdcall* ATL::g_pfnGetThreadACP)(void)" (?g_pfnGetThreadACP@ATL@@3P6GIXZA) referenced in function "protected: int __thiscall CMailMsg::Initialize(void)" (?Initialize@CMailMsg@@IAEHXZ) MailMsg.obj
Error 29 error LNK2001: unresolved external symbol "unsigned int (__stdcall* ATL::g_pfnGetThreadACP)(void)" (?g_pfnGetThreadACP@ATL@@3P6GIXZA) Server.obj
Error 30 error LNK2001: unresolved external symbol "unsigned int (__stdcall* ATL::g_pfnGetThreadACP)(void)" (?g_pfnGetThreadACP@ATL@@3P6GIXZA) AsyncSocketEx.obj
Error 31 error LNK2001: unresolved external symbol "unsigned int (__stdcall* ATL::g_pfnGetThreadACP)(void)" (?g_pfnGetThreadACP@ATL@@3P6GIXZA) AsyncSocketExLayer.obj
Error 32 error LNK2001: unresolved external symbol "unsigned int (__stdcall* ATL::g_pfnGetThreadACP)(void)" (?g_pfnGetThreadACP@ATL@@3P6GIXZA) AsyncSslSocketLayer.obj
Error 33 error LNK2001: unresolved external symbol "unsigned int (__stdcall* ATL::g_pfnGetThreadACP)(void)" (?g_pfnGetThreadACP@ATL@@3P6GIXZA) ExceptionReport.obj
Error 34 error LNK2019: unresolved external symbol _deflateInit2_ referenced in function "public: bool __thiscall CTransferSocket::InitZLib(int)" (?InitZLib@CTransferSocket@@QAE_NH@Z) TransferSocket.obj
Error 35 error LNK2019: unresolved external symbol _inflateInit2_ referenced in function "public: bool __thiscall CTransferSocket::InitZLib(int)" (?InitZLib@CTransferSocket@@QAE_NH@Z) TransferSocket.obj
Error 36 error LNK2019: unresolved external symbol _deflateEnd referenced in function "public: virtual __thiscall CTransferSocket::~CTransferSocket(void)" (??1CTransferSocket@@UAE@XZ) TransferSocket.obj
Error 37 error LNK2019: unresolved external symbol _inflateEnd referenced in function "public: virtual __thiscall CTransferSocket::~CTransferSocket(void)" (??1CTransferSocket@@UAE@XZ) TransferSocket.obj
Error 38 error LNK2019: unresolved external symbol _deflate referenced in function "protected: virtual void __thiscall CTransferSocket::OnSend(int)" (?OnSend@CTransferSocket@@MAEXH@Z) TransferSocket.obj
Error 39 error LNK2019: unresolved external symbol _inflate referenced in function "protected: virtual void __thiscall CTransferSocket::OnReceive(int)" (?OnReceive@CTransferSocket@@MAEXH@Z) TransferSocket.obj
Error 40 fatal error LNK1120: 7 unresolved externals c:\Program Files\FileZilla Server\source\Release\FileZilla server.exe 1



Can you help?

Regards,
Kevin.

User avatar
botg
Site Admin
Posts: 35508
Joined: 2004-02-23 20:49
First name: Tim
Last name: Kosse

Re: Compiling FileZilla Server Using Visual Studio 2005

#6 Post by botg » 2008-07-25 13:52

Change the zlibstat project file to compile with ZLIB_WINAPI preprocessor define.

Kevin Gale
500 Command not understood
Posts: 5
Joined: 2008-07-25 08:57
First name: Kevin
Last name: Gale

Re: Compiling FileZilla Server Using Visual Studio 2005

#7 Post by Kevin Gale » 2008-07-25 14:30

Hi.

Thanks for your reply.

I've just checked the zlibstat project and it appears that it has already been defined.

This is the entire list:
WIN32
ZLIB_WINAPI
_CRT_NONSTDC_NO_DEPRECATE
_CRT_SECURE_NO_DEPRECATE
ASMV
ASMINF



Regards,
Kevin

User avatar
botg
Site Admin
Posts: 35508
Joined: 2004-02-23 20:49
First name: Tim
Last name: Kosse

Re: Compiling FileZilla Server Using Visual Studio 2005

#8 Post by botg » 2008-07-25 16:52

Then try without that flag ;)

Kevin Gale
500 Command not understood
Posts: 5
Joined: 2008-07-25 08:57
First name: Kevin
Last name: Gale

Re: Compiling FileZilla Server Using Visual Studio 2005

#9 Post by Kevin Gale » 2008-07-26 11:28

Hi All.

Thanks for your help.

With a bit more work I have managed to get it to build. If anybody else is having problems trying to do it here is a summary of what I did.

Regards,
Kev.


Boost
-----

1. Download and install the pre-built boost 1.3.5 package from
http://www.boostpro.com/boost_1_35_0_setup.exe


2. Install Boost Libraries
Select the Visual Studio 2005 multi-threaded static libraries and then select the Boost Header Files and Boost RegEx library. All other options can be de-selected.



ZLib
----

1. Download zlib 1.2.3 from
http://www.zlib.net/


2. Open zlib 1.2.3 vc8 project


3. Set to compile Win32 Release


4. Remove the 'ZLIB_WINAPI' preprocessor define from the zlibstat project


5. Build the zlibstat project


6. Rename 'zlibstat.lib' to 'zlib.lib'



FileZilla Server
-------------

1. Open the FileZilla server.vcproj


2. Confirm to convert the project


3. Remove the GFtp project


4. Set to compile Win32 Release


5. Add the zlib directory to the project include path:
Tools -> Options -> Projects -> VC++ Directories


6. Add the zlib.lib directory to the project library path:
Tools -> Options -> Projects -> VC++ Directories


7. Add the boost directory to the project include path:
Tools -> Options -> Projects -> VC++ Directories


8. Add the boost lib directory to the project library path:
Tools -> Options -> Projects -> VC++ Directories


9. Edit Hyperlink.h in the FZS Interface project
Change line:
afx_msg UINT OnNcHitTest(CPoint point);
To:
#if _MSC_VER >= 1400
afx_msg LRESULT OnNcHitTest(CPoint point);
#else
afx_msg UINT OnNcHitTest(CPoint point);
#endif


10. Edit Hyperlink.cpp in the FZS Interface project
Change line:
UINT CHyperLink::OnNcHitTest(CPoint /*point*/)
To:
#if _MSC_VER >= 1400
LRESULT CHyperLink::OnNcHitTest(CPoint /*point*/)
#else
UINT CHyperLink::OnNcHitTest(CPoint /*point*/)
#endif


11. Edit StdAfx.h in the Service project
Add the line:
#include <atlbase.h>


12. Build the solution
If you get any errors try cleaning it and then re-building

MikeySea
500 Command not understood
Posts: 5
Joined: 2008-09-12 19:17
First name: Mike
Last name: Sea

Compiling FileZilla Server Using Visual Studio 2005 for x64

#10 Post by MikeySea » 2008-09-12 19:35

First off, I want to thank Kevin Gale for his efforts in getting VS 2005 working with FZ, ZLib, and Boost, and then documenting what steps he did to get them to work. Excellent job sharing that information.

I have followed his outlined steps and have had perfect luck.

Now comes my difference: I want to build everything for a x64 target platform.

First question: Should I be using FileZilla_Server-0_9_27 source code as a basis for an x64 target?
Me thinks I have the wrong version here, as I am getting far too many compiler warnings and errors with this base code.


So, what I have done so far:

1) Got Boost and have built it into x64 libraries.

2) Got ZLib 1.2.3 and have built it into x64 libraries (actually, the zlib 1.2.3 vc8 project defaults to x64 already).

3) For FileZilla Server, this is where I fall short.
I have downloaded FileZilla_Server-0_9_27.exe with it's source and am using that as my basis.
I changing the target in COnfiguraiton Manager to x64, thus the defines to compile with are:
Win64;_DEBUG;_WINDOWS;SERVICE
I updated the Include and Library paths for Boost and ZLib accordingly.

Upon compilation, I get hundreds of warnings relating to potential loss of data between various data types, and I get a few dozen errors about different basic stuff, mostly in the various Exception handling source modules/files.

I can provide detailed logs if we need to go to that place, but I suspect I went the wrong way with the version Im using.

If anyone has insight, I'd appreciate hearing it.

Thanks!

User avatar
botg
Site Admin
Posts: 35508
Joined: 2004-02-23 20:49
First name: Tim
Last name: Kosse

Re: Compiling FileZilla Server Using Visual Studio 2005

#11 Post by botg » 2008-09-12 19:38

Upon compilation, I get hundreds of warnings relating to potential loss of data between various data types, and I get a few dozen errors about different basic stuff, mostly in the various Exception handling source modules/files.
The server code is old, very much so. I doubt it can be easily ported to 64bit, would need a full code review to spot the nasty details.

MikeySea
500 Command not understood
Posts: 5
Joined: 2008-09-12 19:17
First name: Mike
Last name: Sea

Re: Compiling FileZilla Server Using Visual Studio 2005

#12 Post by MikeySea » 2008-09-12 20:07

botg wrote:
Upon compilation, I get hundreds of warnings relating to potential loss of data between various data types, and I get a few dozen errors about different basic stuff, mostly in the various Exception handling source modules/files.
The server code is old, very much so. I doubt it can be easily ported to 64bit, would need a full code review to spot the nasty details.
Yeah, as suspected.

I even took the 64 bit server found in the Installer EXE mentioned in this thread:

http://forum.filezilla-project.org/view ... f=3&t=1276

but it has nearly (or is it more?) issues with 64 bit compilation.

Is there a decent baseline version that would be best to use to attempt this with?

User avatar
botg
Site Admin
Posts: 35508
Joined: 2004-02-23 20:49
First name: Tim
Last name: Kosse

Re: Compiling FileZilla Server Using Visual Studio 2005

#13 Post by botg » 2008-09-12 21:21

Short version: Don't bother with 64bit FZS

Long version: FZS is ancient, it still contains lots of old code I wrote when I still had almost no experience. Everything's undocumented and full with magic numbers. It has been extended far beyond the original vision, and it shows. (e.g. the separation between engine and interface is an afterthought)
I plan to rewrite the server in the future and will do as soon as I feel that the client cannot be improved anymore.

MikeySea
500 Command not understood
Posts: 5
Joined: 2008-09-12 19:17
First name: Mike
Last name: Sea

Re: Compiling FileZilla Server Using Visual Studio 2005

#14 Post by MikeySea » 2008-09-15 12:48

botg wrote:Short version: Don't bother with 64bit FZS

Long version: FZS is ancient, it still contains lots of old code I wrote when I still had almost no experience. Everything's undocumented and full with magic numbers. It has been extended far beyond the original vision, and it shows. (e.g. the separation between engine and interface is an afterthought)
I plan to rewrite the server in the future and will do as soon as I feel that the client cannot be improved anymore.
Okay, thank you for putting it so simply! 8)

I (we) do appreciate your efforts, so keep up the great work! :)

I'm open to ideas on locating an open source, high performance 64 bit server that has speed limiting based on user account settings.
If you or anyone have ideas, please let me know. A GUI interface for such a server is not required.

Many Thanks!

dzstoever
500 Command not understood
Posts: 3
Joined: 2009-03-17 17:49
First name: Daniel
Last name: Stoever

Re: Compiling FileZilla Server Using Visual Studio 2005

#15 Post by dzstoever » 2009-03-18 02:02

I just used your 'short list' to get the source code compiled and running under VS 2005. Thanks

The only difference I encountered was that I did not have a copy of Hyperlink.h in my solution.(???) So I did not change it, or Hyperlink.cpp. I did have to comment out one line(71) in Hyperlink.cpp, so I hope it wasn't too important...

Thanks.

Post Reply