microsoftarchive / redis

Redis is an in-memory database that persists on disk. The data model is key-value, but many different kind of values are supported: Strings, Lists, Sets, Sorted Sets, Hashes
http://redis.io
Other
20.81k stars 5.37k forks source link

Linking fails in Visual Studio 2015 (Windows 7) #454

Closed Venom1991 closed 8 years ago

Venom1991 commented 8 years ago

The selected configuration doesn't seem to matter (Release - x64 in the attached screenshot). I did the upgrade of all the .vcxprojs while opening the solution for the first time (a dialog with a question pops up). It perhaps wasn't a good idea?

redis

enricogior commented 8 years ago

Hi @Venom1991 upgrading the projects is the correct thing to do, but please put the main project folder in a path that doesn't contain spaces.

Venom1991 commented 8 years ago

That issue seems to be resolved but another one popped up.

redis

enricogior commented 8 years ago

@Venom1991 the latest sources with all the fixes for Visual Studio 2015 are available in the github repository, if you downloaded the zip folder of the 3.0.501 release the fixes are not present.

Venom1991 commented 8 years ago

Ah, so I have to clone the repository? No problem, thank you.

Also, is there any way to use the built executable to run as a service? I need the x86 binary and you offer solely the x64 .msi installers which do that out of the box.

enricogior commented 8 years ago

@Venom1991 yes, the executable can be run as a service, check the documentation, but be aware that building x86 binaries using Visual Studio 2015 may not work, I strongly recommend to use Visual Studio 2013.

Venom1991 commented 8 years ago

Luckily, I have VS 2013 Update 5 installed also and the x86 configuration builds just fine.

However, using VS 2015 and the x64 configuration (using the cloned repository) is still failing. It might be worth looking into. It is the same set of errors as shown in the second screenshot I uploaded.

enricogior commented 8 years ago

@Venom1991 the errors using VS 2015 are still present after a clean build?

Venom1991 commented 8 years ago

Release (x64) -> Clean Solution -> Rebuild Solution:

redis

enricogior commented 8 years ago

@Venom1991 please don't use the rebuild command, just clean and then build. Thank you.

Venom1991 commented 8 years ago

Still the same result. Well, I got my x86 builds at least.

You asked another person with same problem if he could provide you with the output of building the Win32_Interop project? Here you go:

1>------ Build started: Project: Win32_Interop, Configuration: Release x64 ------ 1> Performing Custom Build Tools 1> A subdirectory or file resources already exists. 1> MC: Compiling EventLog.mc 1> Microsoft (R) Windows (R) Resource Compiler Version 6.3.9600.17336 1> 1> Copyright (C) Microsoft Corporation. All rights reserved. 1> 1> 1> Microsoft (R) Incremental Linker Version 14.00.23918.0 1> Copyright (C) Microsoft Corporation. All rights reserved. 1> 1>LINK : warning LNK4068: /MACHINE not specified; defaulting to X86 1> win32fixes.c 1> Win32_ANSI.c 1> Win32_APIs.c 1> Win32_dlmalloc.c 1> Win32_Error.c 1> Win32_PThread.c 1> Win32_QFork_impl.c 1> Win32_RedisLog.c 1> Win32_Signal_Process.c 1> Win32_ThreadControl.c 1> Win32_Time.c 1> win32_wsiocp.c 1> Win32_CommandLine.cpp 1> Win32_Common.cpp 1> Win32_EventLog.cpp 1> Win32_FDAPI.cpp 1> Win32_fdapi_crt.cpp 1> Win32_QFork.cpp 1>Win32_QFork.cpp(513): warning C4312: 'type cast': conversion from 'unsigned long' to 'HANDLE' of greater size 1> win32_rfdmap.cpp 1> Win32_service.cpp 1> Win32_StackTrace.cpp 1>C:\Program Files (x86)\Windows Kits\8.1\Include\um\DbgHelp.h(1544): warning C4091: 'typedef ': ignored on left of '' when no variable is declared 1>C:\Program Files (x86)\Windows Kits\8.1\Include\um\DbgHelp.h(3190): warning C4091: 'typedef ': ignored on left of '' when no variable is declared 1> Win32_variadicFunctor.cpp 1> Win32_Interop.vcxproj -> F:\redis15\msvs\x64\Release\Win32_Interop.lib ========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========

The defaulting to MACHINE x86 is weird because it is clearly set to x64:

redis

enricogior commented 8 years ago

@Venom1991 the defaulting to MACHINE x86 is not the cause of the compilation error. I'll try to repro the compilation error and let you know. Thank you.

fangguanya commented 8 years ago

Hi there, I have the same situation, but my develop os version is windows 10, and also use visual-studio 2015 as my IDE, Finally I let these project compile success with add 'extern c' definition on the header win32fixes.h

just like this: image

I only tried release with x64 build, hope luky for you!

enricogior commented 8 years ago

Hi @fangguanya thank you for your contribution!

@Venom1991 can you please try @fangguanya's fix and let us know if it worked for you as well? Thanks.

Venom1991 commented 8 years ago

Yes, it builds just fine in VS 2015 now, as well. Issue resolved, I'd say! Nicely done @fangguanya !

louisyonge commented 8 years ago

I have the same linking problem solved by @fangguanya 's solution. Great Job.

fangguanya commented 8 years ago

@Venom1991 , @louisyonge HAHA, It's happy for me to hear that~ enjoy guys!

enricogior commented 8 years ago

@fangguanya the fix has been committed, thanks again for the contribution!

enricogior commented 8 years ago

This issue is now fixed in the 3.0.502 release.

enricogior commented 8 years ago

Update: the latest release is 3.0.503. Sorry about the double release in one day. Thank you.