GTSAM Windows Build Error

Issue #203 resolved
Punarjay Chakravarty created an issue

I'm using Windows 8, Visual Studio Community 2013, CMake 3.10, Boost 1.57 and GTSAM version 4.0.

On opening the gtsam Visual Studio project generated by CMake (gtsam.sln), and compiling it, I get 298 errors.

Attached is the build log (gtsam.log).

Comments (35)

  1. Frank Dellaert

    Hmmm, lots of warnings, some of which I am fixing now. Usually, I'd depend on @nsrinivasan7 or @cbeall3 to find and eradicate those on windows, hint hint...

  2. Chris Beall

    Please verify that your VS installation has update 4. Out-of-date VS compilers have lots of problems compiling recent GTSAM.

    I just tried, and the first error I run into is the one reported in issue #201.

  3. Punarjay Chakravarty reporter

    I re-installed VS, with Update 4 - just to be sure, I downloaded VS2013.4.exe. But I still get the same errors.

    Natesh, I cannot see your build log. I get a 404 -link not found error.

  4. Punarjay Chakravarty reporter

    Frank, I've just git-pulled, CMake-ed, and re-compiled and am attaching the new log.

  5. Frank Dellaert

    So, I don't clearly see from the log which cpp file is being compiled. Is it AHRSFactor.cpp ? Or was that just successfully compiled? It's also strange that you have all those alignment warnings on Windows that @nsrinivasan7 and @cbeall3 do not have. Ideas, guys?

  6. Chris Beall

    Regarding alignment: Are you on a 32-bit machine?

    Edit: Seems like you are. I see Platform=Win32 in your log file.

  7. Punarjay Chakravarty reporter

    Just to be sure that it is not my particular combination of machine/OS/compiler, I also downloaded GTSAM 3.2 (the stable version), and I tried compiling it, but I get errors in that too.

    I have also turned off multi-threaded build.

    This is the particular sequence of steps I followed: -Downloaded and unzipped gtsam 3.2 -Made a build directory in the top level unzipped gtsam_3_2 folder

    -Opened Cmake-GUI, -set the source code directory to gtsam_3_2 -set the build directory to gtsam_3_2/build -Added the following options to CMake (add to instructions on GTSAM website?): - BOOST_ROOT is C:/local/boost_1_57_0 - BOOST_LIBRARYDIR is C:/local/boost_1_57_0/lib64-msvc-12.0 All other options in CMake left unchanged.

    -Pressed Configure, followed by Generate, which both completed successfully.

    -Opened up the gtsam.sln (in the build directory) in Visual Studio. -Set up single-threaded build

    Note: When you first open up the project in Visual Studio, it takes a long time (about 5 mins) to parse included files.

    -Then, pressed Build Solution Again I get 100-something errors.

    If other people can compile GTSAM 3.2 successfully on Windows, then there must be something in my system/OS/compiler, or some steps that I am missing or doing wrong.

    Attaching the build log.

  8. Chris Beall

    Based on your log file and the screenshot in the other issue I believe you are creating a 32-bit configuration, which nobody here has properly tested. If you are in fact using a 32-bit Windows machine, then you obviously have no other choice. However, if you are actually using 64-bit Windows (which surely is more common these days), then I would like for you to try a 64-bit build. In CMake, it should say "Current Generator: Visual Studio 12 2013 Win64", instead of "Current Generator: VisualStudio 12 2013". Please try if that works?

  9. Frank Dellaert

    Thanks Jay. Seems to be all same error. We definitely had this compiling on Windows, but this might be a case of boost preventing somethign in later versions. I have seen cmake spit out wranings about this on mac, so I think there must be a flag... This is the warning I get:

    Ignoring Boost restriction on optional lvalue assignment from rvalues

    I'm looking at @cbeall3 and @nsrinivasan7 for guidance here, only windows machine I own is 'Windows XP', and is in Atlanta :-)

  10. Natesh Srinivasan

    @cbeall3 There is also a boost::optional error (C2338) in discrete factor correct ?

    Maybe he should turn that off ?

    @punarjay, If you are going to try the 64 bit build , you need to build boost in 64 bit mode, IF you are using bjam, you can configure it using the switch --address-model=64

  11. Natesh Srinivasan

    @punarjay , also a very simple way to make sure that cmake finds boost is to set the variable "CMAKE_PREFIX_PATH" to your boost installation. That alwasy works like a charm for me in windows and linux.

  12. Chris Beall

    Actually, based on this C:/local/boost_1_57_0/lib64-msvc-12.0 in his steps above, his boost installation is already 64-bit pre-compiled. So trying a 32-bit against that will not work. That could be one of the problems.

  13. Chris Beall

    Let's start by verifying whether you have 64-bit Windows. Open Control Panel -> System and Security -> System. On a 64-bit system it will look like this: windows-version.png

  14. Punarjay Chakravarty reporter

    I do have a 64-bit system (see below). 64_bitPC.png

    I've now selected Visual Studio 12 2013 Win64 - Use default native compilers as the compiler and repeated the Configure - Generate (CMake) - Compile (Visual Studio) process.

    Now, in the Visual Studio Output Window, it still says ========== Build: 7 succeeded, 58 failed, 0 up-to-date, 17 skipped ========== with 63 errors in the error window. Attaching log (gtsam_64bit.log).

    However, I now have a build/x64 folder with an AllBuild log that says Build Succeeded (also attached - ALL_BUILD.log).

    It's been ages since I've used Visual Studio, and I'm confused. Did it build correctly or not? There are now some .exe files (check_wrap_program.exe and wrap.exe) in the build/bin/Debug folder.

    Also, I think that CMake itself maybe a 32-bit version, and that may also be part of the problem. See images below.

    cmake.png

    cmake_options.png

  15. Chris Beall

    Almost there! To fix the errors in gtsam_64bit.log, open gtsam/CMakeLists.txt and replace if(${Boost_VERSION} EQUAL 105600) with if(NOT (${Boost_VERSION} LESS 105600)) around line 132.

  16. Chris Beall

    And btw, it doesn't matter that CMake is a 32-bit program. Visual Studio is, too. Microsoft doesn't even ship a 64-bit version of Visual Studio. Of course that doesn't prevent it from generating 64-bit programs.

  17. Punarjay Chakravarty reporter

    Replaced if(${Boost_VERSION} EQUAL 105600) with if(NOT (${Boost_VERSION} LESS 105600)) in gtsam/CMakeLists.txt.

    Ok, only have 2 errors now. But the log file says Build Succeeded. See attached log gtsam_64bit_1.log

  18. Chris Beall

    I actually don't see any errors in the log file, and on lines 1202-1205 you can see that gtsamDebug.dll was built successfully! You should be able to run examples now, if you built them. Remember that you have to add the directories containing Boost dll and GTSAM dll files to your system path, or you'll get run-time errors.

  19. Frank Dellaert

    Thanks @cbeall3 ! why was that patch in CMakeLists.txt needed?

    @punarjay Please confirm you can run examples.

  20. Chris Beall

    Boost introduced the restriction on optional lvalue assignment from rvalues in 1.56, along with a way to turn it off. Unfortunately we added this to CMakeLists.txt by checking for Boost 1.56, instead of 1.56+. (This was already fixed in develop)

  21. Punarjay Chakravarty reporter

    In the build/bin/Debug folder, there are a bunch of GTSAM dlls. I can run them successfully from the command line. I assume this is what you mean when you say run examples. planar_slam_example.png

  22. Frank Dellaert

    Yes ! Congrats ! @cbeall3 should we output a patch for GTSAM 3.2 with that BOOST change? Could be a simple diff for people with boost 1.57

  23. Chris Beall

    I just uploaded this to the website as a very minor maintenance release 3.2.1. It also brings Boost 1.57 compatibility to Mac/Linux thanks to fixes you made a few weeks back, which I cherry-picked for this release.

  24. Log in to comment