View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0014833CMakeCMakepublic2014-03-24 20:302016-01-04 11:52
ReporterDavid Hait 
Assigned ToBrad King 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionfixed 
Platformx64OSWindowsOS Version7
Product VersionCMake 2.8.11.2 
Target VersionCMake 3.4Fixed in VersionCMake 3.4 
Summary0014833: FindProtobuf module under Windows doesn't support 64-bit builds
DescriptionDefault Windows protobuf library builds go in x64\Debug and x64\Release directories, rather than Debug and Release.
The FindProtobuf module has the library directories hard-coded; there is no way to specify the x64 directories to search for the libraries.
Steps To Reproduce1.Build ProtocolBuffer with the VS project using x64 settings
2.Run cmake with FindProtobuf as part of a CMakeLists.txt
3.Run msbuild

Error:
 libprotobuf.lib(common.obj) : fatal error LNK1112: module machine type 'X86'
conflicts with target machine type 'x64' [C:\omserv\build\src\omserv.vcxproj]
Additional InformationThere should be an additional CMake variable to specify the library folder.
TagsNo tags attached.
Attached Filesdiff file icon patch-cmake-protobuf-64.diff [^] (2,640 bytes) 2015-07-07 20:27 [Show Content]
patch file icon 0001-FindProtobuf-Search-x64-directories-in-VS-built-prot.patch [^] (2,723 bytes) 2015-07-08 10:25 [Show Content]

 Relationships

  Notes
(0035519)
Brad King (manager)
2014-03-26 08:47

The FindProtobuf module should be taught to check CMAKE_SIZEOF_VOID_P to see whether it needs to check the x64 directory.

Meanwhile you can work around this by setting the PROTOBUF_LIBRARY and PROTOBUF_LIBRARY_DEBUG cache entries in your local build tree by hand.
(0038567)
Joël Lamotte (reporter)
2015-04-20 18:54

Are there plans to fix this soon?
(0038568)
Brad King (manager)
2015-04-21 08:34

Currently FindProtobuf has no maintainer:

 http://www.cmake.org/Wiki/CMake:Module_Maintainers [^]

so no one is actively working on this.
(0038569)
Joël Lamotte (reporter)
2015-04-21 08:40

Ok I will try a pull request soon then. Will it be reviewed by someone from the CMake team?
(0038570)
Brad King (manager)
2015-04-21 09:00

Re 0014833:0038569: Great, thanks! Please read CONTRIBUTING.rst and mention this issue number in the patch.
(0039030)
Joël Lamotte (reporter)
2015-07-07 20:29

It took some time but I managed to find the time to provide a patch.

As said in the commit, it's tested with the last stable Protobuf release which is 1.6.1.
I didn't try Protobuf 3.0.0 (which is in alpha) that provide cmake files for building at least on windows. I suspect that FindProtobuf.cmake will need an update for that too.
(0039031)
Joël Lamotte (reporter)
2015-07-07 20:31

"There should be an additional CMake variable to specify the library folder."

I am not totally sure about this part but would a PROTOBUF_LIBRARIES_DIR option set to PROTOBUF_OUTPUT_BINARIES_DIR (from my patch) by default would seem to be good enough?
(0039088)
Brad King (manager)
2015-07-08 10:32

Re 0014833:0039030: Thanks. Based on that I produced "0001-FindProtobuf-Search-x64-directories-in-VS-built-prot.patch". Please try it.
(0039089)
Brad King (manager)
2015-07-08 10:38

> There should be an additional CMake variable to specify the library folder.

Almost no find modules do this. CMake find_* commands honor variables like CMAKE_LIBRARY_PATH that can be used for this. Or, one can always set the individual find_* cache entries directly.

If Protobuf upstream now builds with CMake they should distribute packaging files as documented here:

 http://www.cmake.org/cmake/help/v3.3/manual/cmake-packages.7.html [^]

and then there will be no need for a find module.
(0039090)
Joël Lamotte (reporter)
2015-07-08 10:45

By the way, I tried to generate (using cmake (3.3)) and build Protobuf (master) with vs2013 64bit and it compiled and linked without any problem, but as I expected the output paths are not at all located in usual places.
So I will make sure that the protobuf team are aware of your recommendation.

I will be able to do so and to try your patch in a few hours.
(0039113)
Joël Lamotte (reporter)
2015-07-09 14:41

See: https://github.com/google/protobuf/issues/578 [^]

I just tried your patch and it seems to work too.

BTW I'm curious: could you explain to me the reasoning behind the changes you made from the patch I provided? Is it mostly just a more conventional way to do it for the cmake team? I'm asking mostly because it looks like only stylistic changes but there might be an impact on maintenance too, but not sure which way is best.
(0039264)
Joël Lamotte (reporter)
2015-08-10 18:44

Hi, when will this fix be merged? It don't seem so "minor" to me as it prevent the usage of Protobuf in 64bit on Windows using CMake; and it seems like a simple fix. It's still marked "new" but it seems to me it could be merged in 3.3.1?
(0039265)
Brad King (manager)
2015-08-11 09:00

Re 0014833:0039264: Sorry for the delay. For some reason I never received notification of your confirmation in 0014833:0039113. Yes, the changes to your patch are just for style preference.

I've applied the patch:

 FindProtobuf: Search x64 directories in VS-built protobuf source
 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=8dc6cbcb [^]

It will be in CMake 3.4.
(0040110)
Robert Maynard (manager)
2016-01-04 11:52

Closing resolved issues that have not been updated in more than 4 months.

 Issue History
Date Modified Username Field Change
2014-03-24 20:30 David Hait New Issue
2014-03-26 08:47 Brad King Note Added: 0035519
2015-04-20 18:54 Joël Lamotte Note Added: 0038567
2015-04-21 08:34 Brad King Note Added: 0038568
2015-04-21 08:40 Joël Lamotte Note Added: 0038569
2015-04-21 09:00 Brad King Note Added: 0038570
2015-07-07 20:27 Joël Lamotte File Added: patch-cmake-protobuf-64.diff
2015-07-07 20:29 Joël Lamotte Note Added: 0039030
2015-07-07 20:31 Joël Lamotte Note Added: 0039031
2015-07-08 10:25 Brad King File Added: 0001-FindProtobuf-Search-x64-directories-in-VS-built-prot.patch
2015-07-08 10:32 Brad King Note Added: 0039088
2015-07-08 10:38 Brad King Note Added: 0039089
2015-07-08 10:45 Joël Lamotte Note Added: 0039090
2015-07-09 14:41 Joël Lamotte Note Added: 0039113
2015-08-10 18:44 Joël Lamotte Note Added: 0039264
2015-08-11 09:00 Brad King Note Added: 0039265
2015-08-11 09:00 Brad King Status new => resolved
2015-08-11 09:00 Brad King Resolution open => fixed
2015-08-11 09:00 Brad King Fixed in Version => CMake 3.4
2015-08-11 09:00 Brad King Target Version => CMake 3.4
2015-08-11 09:00 Brad King Assigned To => Brad King
2015-08-11 09:00 Brad King Status resolved => assigned
2015-08-11 09:01 Brad King Status assigned => resolved
2016-01-04 11:52 Robert Maynard Note Added: 0040110
2016-01-04 11:52 Robert Maynard Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team