Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7916177
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T14:42:44+00:00 2026-06-03T14:42:44+00:00

I am using cmake-gui trying to build opencv but get this error: CMake Error

  • 0

I am using cmake-gui trying to build opencv but get this error:

CMake Error at cmake/OpenCVGenConfig.cmake:134 (math):
  math cannot parse the expression: "8 * ": syntax error, unexpected $end,
  expecting exp_OPENPARENT or exp_NUMBER (4)
Call Stack (most recent call first):
  CMakeLists.txt:649 (include)

This is my first experience with cmake so I am not sure where to turn. I have looked at the OpenCVGenConfig.cmake file but I am clueless about its syntax. I blew away everything, downloaded the opencv tarball again, but still get the same error. So it does not appear that it is a typo/error in the OpenCVGenConfig.cmake file but in the processing of the “math” command. I can not seem to find anything relating to a “math” command in the Cmake documentation.

Any ideas?

-Andres

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T14:42:46+00:00Added an answer on June 3, 2026 at 2:42 pm

    It looks like the line in question is

      math(EXPR SIZEOF_VOID_P_BITS "8 * ${CMAKE_SIZEOF_VOID_P}")
    

    The problem appears to be that ${CMAKE_SIZEOF_VOID_P} is unset when it should
    indicate the size of a pointer in bytes. It should get set during the invocation of the project command near the start of the top-level CMakeLists.txt.

    I’m not sure why it’s not being set, it may even be a bug in CMake. You could try using the latest version of CMake (currently 2.8.8) if you’re not already. Also, running CMake from the command line may make a difference (it shouldn’t, but you never know).

    If this doesn’t help, your best bet is to ask for advice on the CMake mailing list.

    As an absolute last resort, you could set the appropriate value for CMAKE_SIZEOF_VOID_P on your machine by adding

      if(NOT CMAKE_SIZEOF_VOID_P)
        set(CMAKE_SIZEOF_VOID_P 4)  # replace 4 with 8 for 64-bit machine
      endif()
    

    to cmake/OpenCVGenConfig.cmake just before line 134 where the math call is made. This is a horrible hack and I certainly don’t recommend it, but it could let you build OpenCV while
    seeking a proper answer on the mailing list.

    You can get info on the math command by running

    cmake --help-command math
    

    and on CMAKE_SIZEOF_VOID_P by running

    cmake --help-variable CMAKE_SIZEOF_VOID_P
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is my first time using CMake and I'm trying to build QJSon, a
Ok. I followed the "Using CMake to build" set of instructions on this site:
Every time I try to build, I get the error: CMake Error: The source
I am using CMake to build my project and I have the following line:
I have tried setting the debug flags using the set command in cmake but
I'm using cmake to generate an nmake build system using the NMake Makefiles generator.
I am trying to write a C++ application using the OpenCV libraries. As per
I want to set up automated build using CMake on Windows. I am using
I'am using CMake to create a Visual Studio 2008 project. In this project I
I have been using cmake to build my projects out of source, which is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.