Skip to content

Ceres 2.0.0 upgrade to C++14 breaks sfm module #2578

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

Closed
4 tasks done
ghfue opened this issue Jun 24, 2020 · 8 comments · Fixed by #2732
Closed
4 tasks done

Ceres 2.0.0 upgrade to C++14 breaks sfm module #2578

ghfue opened this issue Jun 24, 2020 · 8 comments · Fixed by #2732

Comments

@ghfue
Copy link

ghfue commented Jun 24, 2020

System information (version)
  • OpenCV => master
  • Operating System / Platform => Ubuntu 18.04
  • Compiler => g++ 7.5.0
Detailed description

The sfm module does not build with Ceres master (2.0.0) due to Ceres switching to C++14.

When building OpenCV, it throws an error about integer_sequence not being a member of std. This is due to integer_sequence being added in C++14.

I was able to build OpenCV with Ceres 2.0.0 by building it with C++14, but I am not confident this is the proper solution for everyone.

The alternative solution would be to stay on Ceres 1.X.X, which could just be documented somewhere.

Steps to reproduce
  • Build ceres from master (2.0.0 has yet to be tagged)
  • Build OpenCV with modules
Issue submission checklist
  • I report the issue, it's not a question
  • I checked the problem with documentation, FAQ, open issues,
    answers.opencv.org, Stack Overflow, etc and have not found solution
  • I updated to latest OpenCV version and the issue is still there
  • There is reproducer code and related data files: videos, images, onnx, etc
@NavneetSajwan
Copy link

Yes, finally someone addressed it. It was driving me mad for months. Is there a workaround until it gets fixed?

@alalek
Copy link
Member

alalek commented Jun 25, 2020

There is no other way than forcing C++14 compilation mode to compile with new Ceres:

  • modern CMake (3.1+) + cmake -DCMAKE_CXX_STANDARD=14 ...
  • or update CXXFLAGS / CMAKE_CXX_FLAGS / OPENCV_EXTRA_CXX_FLAGS to use C++14

Otherwise we should disable Ceres in OpenCV:

  • cmake -DCMAKE_DISABLE_FIND_PACKAGE_Ceres=ON ...
  • automatic detection of broken compilation can be added later (or just Ceres version check)

@NavneetSajwan
Copy link

If I use an older version of ceres, will SFM work? I am hoping the 1.14.0 version doesn't have this issue. @alalek

@ghfue
Copy link
Author

ghfue commented Jun 25, 2020

@NavneetSajwan I tested yesterday, and everything builds fine with Ceres 1.14.0. The C++14 change was not introduced until 2.0.0.

@NavneetSajwan
Copy link

NavneetSajwan commented Jun 25, 2020

Thanks, I confirmed it. No installation errors with ceres 1.4.x . But SFM examples are not built even when -D BUILD_EXAMPLES=ON. Did you face the same issue? @alalek

@diablodale
Copy link

FYI, if SFM cmake is updated to c++14, keep in mind that it currently fails its intention on Microsoft compilers. This is due to this following hardcoded option.

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")

If continuing with the hardcoded approach....Microsoft's cl.exe compiler does not support that option in that specific format. You can use a - or /. You can not use an equal sign = to separate the option and its value. Microsoft's compiler wants a colon :. Also keep in mind that starting with Microsoft VS2017, the default is C++14.

@NikolausDemmel
Copy link

On macOS, this prevents the ceres-solver formula in Homebrew to be updated to Ceres 2.0.0, since it breaks the opencv formula.

Same issue will be with the rgbd module, which recently acquired a dependency on ceres: #2619

@wzh4464
Copy link

wzh4464 commented Jun 28, 2021

If I use an older version of ceres, will SFM work? I am hoping the 1.14.0 version doesn't have this issue. @alalek

How to use old version?

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

Successfully merging a pull request may close this issue.

6 participants