Closed filak closed 2 years ago
In fact the Windows version used memcacheclient through the wrapper class in windows/MemcachedWindows.h because libmemcached wasn't Windows compatible. It looks like memcacheclient has long been abandoned, so it will be better to switch to something like libmemcached-awesome, which may even allow us to drop the wrapper.
Try simply dropping the MemcachedWindows.h file and include the libmemcached-awesome header directly instead and see if that works.
I get some errors ie:
Severity Code Description Project File Line Suppression State
Error (active) E0020 identifier "Memcache" is undefined iipsrv D:\Decko\iip\src\Main.cc 440
Error C2065 'Memcache': undeclared identifier iipsrv d:\decko\iip\src\main.cc 440
Error C2146 syntax error: missing ';' before identifier 'memcached' iipsrv d:\decko\iip\src\main.cc 440
https://github.com/ruven/iipsrv/blob/master/src/Main.cc#L440
Try commenting out lines 47, 48, 49 and 51 from Main.cc (the ifdef WIN32 block). Also make sure Memcached.h in the iipsrv/src/ directory is added to the project.
I see... iipsrv/src/Memcached.h gets imported now but there seem to be some issues with the memcached library.
Many errors when compiling IIP - C2011, C2375
Severity Code Description Project File Line Suppression State
Error C2011 'sockaddr': 'struct' type redefinition (compiling source file ..\..\src\Main.cc) iipsrv c:\program files (x86)\windows kits\10\include\10.0.17763.0\shared\ws2def.h 235
...
Error C2011 'fd_set': 'struct' type redefinition (compiling source file ..\..\src\Main.cc) iipsrv c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\winsock2.h 136
...
Error C2375 'accept': redefinition; different linkage (compiling source file ..\..\src\Main.cc) iipsrv c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\winsock2.h 1625
I am not sure how to resolve this.
It looks like these are probably due to the Windows headers being included more than once (Error C2011 is: https://docs.microsoft.com/en-us/cpp/error-messages/compiler-errors-1/compiler-error-c2011?view=msvc-170). I presume the first include is happening in libfcgi.
Try modifying the libmemcached header file (https://github.com/awesomized/libmemcached/blob/bcc1a6ecf1eadcf69dd9efa02fee69ee63949ca0/include/libmemcached-1.0/platform.h#L58) and add #pragma once just before the winsock include. You won't need to recompile libmemcached hopefully.
By the way, I presume you are building iipsrv using the steps you wrote here: https://github.com/filak/IIPImage-on-Windows with VS 2017 Community? So, libmemcached doesn't in fact work when you follow these steps?
It looks like there are circular includes/dependencies. I have tried to add pragma once as suggested (though it is already on line 16) but it made no difference.
I am not 100% sure how to integrate the libmemcached library (I have followed your fcgi folder pattern) - the IIPImage-on-Windows repo is up to date on what I have tried/done so far.
Without the HAVE_MEMCACHED directive IIP in VS2017 compiles just fine.
OK, I've finally managed to get a Windows development environment up and running! I followed your steps and I built libmemcached myself using cmake rather than use the binaries. To get the whole thing to compile you just need to add the following line to the top of src/Memcached.h:
#undef _WIN32
This stops platform.h including the 2 headers. I presume they have already been included by the FCGI library, which is what is causing the compilation issue.
The binary seems to work and the log file says memcached is active, but I haven't installed Memcached yet to test whether it's really doing something.
Thank you for your effort. It builds fine now. I will test it with Memcached running and let you know if it works.
I can confirm now that IIP works with Memcached on Windows.
So I am closing this issue.
I will do some more testing for sure...
I have tried to build IIP with memcached using https://github.com/awesomized/libmemcached
But a source file "MemCacheClient.h" is missing in the repo:
https://github.com/ruven/iipsrv/blob/master/windows/MemcachedWindows.h#L30