Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Building fails in VS22 due to ambiguous call #1642

Closed
knutur94 opened this issue Sep 20, 2023 · 4 comments · Fixed by #1715
Closed

Building fails in VS22 due to ambiguous call #1642

knutur94 opened this issue Sep 20, 2023 · 4 comments · Fixed by #1715
Labels
windows Related to Windows

Comments

@knutur94
Copy link

Description

When building i get the following error message:


Error C2668:	'gtsam::CameraSet<CAMERA>::SchurComplement': ambiguous call to overloaded function	ISAM2Example_SmartFactor	C:\cpp\libs\gtsam\gtsam\geometry	C:\cpp\libs\gtsam\gtsam\geometry\CameraSet.h	379	

Steps to reproduce

  1. clone repository
  2. Choose Generator: Visual Studio 17 2022 with x64
  3. Press configure and generate
  4. Press Open Project
  5. build ALL_BUILD

Then I get 6 error messages all related to 'gtsam::CameraSet<CAMERA>::SchurComplement': ambiguous call to overloaded function

These error messages comes from:

  1. ISAM2Example_SmartFactor
  2. SFMExample_SmartFactor
  3. SFMExample_SmartFactorPCG

Expected behavior

I expected gtsam to build.
I got it to build when unchecking GTSAM_BUILD_EXAMPLES_ALWAYS and GTSAM_BUILD_UNSTABLE, but it doesn't fix the underlying issue.

Environment

Windows 10 x64
Visual Studio 17 2022
Boost 1.82
Cmake 3.26

@Tobias-Fischer
Copy link
Contributor

We observed the same issue in conda-forge, and went back to vs2019 in the meantime.

@talregev
Copy link
Contributor

talregev commented Jan 15, 2024

I have the same issue.
The problem is new CL in msvc.
I have a workaround for that.
You can lower the cl version with environment variable:
I think it how you do it. (I manage to config it on the ci, and I think this is what control the cl version).
set VSCMD_ARG_VCVARS_VER=29
You should set your tool set to correct cl that found it here:
This is my path that I install the community version.
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.29.30133\bin\HostX64\x64
Here is the env that config correctly on the ci.

Platform: x64
    UCRTVersion: 10.0.22621.0
    UniversalCRTSdkDir: C:\Program Files (x86)\Windows Kits\10\
    VCIDEInstallDir: C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\IDE\VC\
    VCINSTALLDIR: C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\
    VCToolsInstallDir: C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.[29](https://github.com/talregev/gtsam/actions/runs/7383002820/job/20083531030#step:5:29).[30](https://github.com/talregev/gtsam/actions/runs/7383002820/job/20083531030#step:5:30)133\
    VCToolsRedistDir: C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Redist\MSVC\14.38.3[31](https://github.com/talregev/gtsam/actions/runs/7383002820/job/20083531030#step:5:31)30\
    VCToolsVersion: 14.29.301[33](https://github.com/talregev/gtsam/actions/runs/7383002820/job/20083531030#step:5:33)
    VisualStudioVersion: 17.0
    VS170COMNTOOLS: C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\Tools\
    VSCMD_ARG_app_plat: Desktop
    VSCMD_ARG_HOST_ARCH: x64
    VSCMD_ARG_TGT_ARCH: x64
    VSCMD_ARG_VCVARS_VER: 29
    VSCMD_VER: 17.8.3
    VSINSTALLDIR: C:\Program Files\Microsoft Visual Studio\2022\Enterprise\
    VSSDK1[50](https://github.com/talregev/gtsam/actions/runs/7383002820/job/20083531030#step:5:50)INSTALL: C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VSSDK
    VSSDKINSTALL: C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VSSDK
    WindowsLibPath: C:\Program Files (x86)\Windows Kits\10\UnionMetadata\10.0.22621.0;C:\Program Files (x86)\Windows Kits\10\References\10.0.22621.0
    WindowsSdkBinPath: C:\Program Files (x86)\Windows Kits\10\bin\
    WindowsSdkDir: C:\Program Files (x86)\Windows Kits\10\
    WindowsSDKLibVersion: 10.0.22621.0\
    WindowsSdkVerBinPath: C:\Program Files (x86)\Windows Kits\10\bin\10.0.22621.0\
    WindowsSDKVersion: 10.0.22621.0\
    WindowsSDK_ExecutablePath_x64: C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools\x64\
    WindowsSDK_ExecutablePath_x86: C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools\

I think also 19.35.32216.1 should work.

Also please write down your cl version.
You can type by on the cmd:
cl

It should be:

Microsoft (R) C/C++ Optimizing Compiler Version 19.29.30153 for x64
Copyright (C) Microsoft Corporation.  All rights reserved.

@talregev
Copy link
Contributor

I found a guide how to change cl version.
You should change to -vcvars_ver=14.29
https://learn.microsoft.com/en-us/cpp/build/building-on-the-command-line?view=msvc-160

@talregev
Copy link
Contributor

@knutur94
I create a fix that should compile with msvc 2022 without change the cl version.
Please compile my branch on this PR: #1715

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
windows Related to Windows
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants