Uploaded image for project: 'Couchbase C client library libcouchbase'
  1. Couchbase C client library libcouchbase
  2. CCBC-848

Can't build Windows 64-bit libcouchbase

    XMLWordPrintable

Details

    • Task
    • Resolution: User Error
    • Critical
    • 2.8.2
    • 2.7.7
    • None
    • None

    Description

      It doesn't appear to be possible to build a 64-bit libcouchbase on Windows.

      If you follow the normal build instructions, ie:

      cmake .. -G "Visual Studio 14"
      cmake --build . --config Release

      you will see that all the link lines have /machine:X86 on them, eg:

      Lib:
      C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\Lib.exe /OUT:"lcb_jsoncpp.dir\Release\lcb_jsoncpp.lib" /NOLOGO /machine:X86 "lcb_jsoncpp.dir\Release\lcb-jsoncpp.obj"

      I've discovered there are some bugs in CMake's detection of 64-bit Windows (I'm using CMake 3.8.2). In particular CMAKE_CL_64 doesn't get set correctly, and that flag is used by GetPlatformCCInfo.cmake to set the flag LCB_ARCH_STRING. However, you can override that by passing -DCMAKE_FORCE_WIN64=1 on the initial cmake command line.

      But even with that, you still see /machine:X86 on all links. I then tried forcing all the CMAKE_foo_LINKER_FLAGS to /machine:X64 instead:

      cmake .. -DCMAKE_FORCE_WIN64=1 -DCMAKE_SHARED_LINKER_FLAGS=/machine:X64 -DCMAKE_STATIC_LINKER_FLAGS=/machine:X64 -DCMAKE_EXE_LINKER_FLAGS=/machine:X64 -DCMAKE_MODULE_LINKER_FLAGS=/machine:X64

      In that case the build doesn't succeed, with a number of errors like this:

      "C:\cb\deps\packages\winbuild\libcouchbase\libcouchbase-prefix\src\libcouchbase
      \build\ALL_BUILD.vcxproj" (default target) (1) ->
      "C:\cb\deps\packages\winbuild\libcouchbase\libcouchbase-prefix\src\libcouchbase
      \build\netbuf-malloc.vcxproj" (default target) (27) ->
      netbuf-malloc.dir\Release\netbuf.obj : fatal error LNK1112: module machine type 'X86' conflicts with target machine type 'x64' [C:\cb\deps\packages\winbuild\libcouchbase\libcouchbase-prefix\src\libcouchbase\build\netbuf-malloc.vcxproj]

      which implies that the individual object files are still being built as 32-bit objects.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            avsej Sergey Avseyev
            ceej Chris Hillery
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes

                PagerDuty