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

"math cannot parse the expression" Error in Reprojucer when configuring a project #754

Open
JoseDiazRohena opened this issue Jan 16, 2023 · 5 comments
Labels

Comments

@JoseDiazRohena
Copy link

Hi! I'm excited to get this working but have run into some issues.

I configured and built FRUT as instructed in "getting started". I was able to
successfully create a cmakelist.txt for my project, but configuring with
cmake .. G Xcode fails with the following error:

CMake Error at ~/ToteBag/Third Party/FRUT/prefix/FRUT/cmake/Reprojucer.cmake:6749 (math):
  math cannot parse the expression: "(1 << 16) + (0 << 8) + 0r1": syntax
  error, unexpected exp_NUMBER, expecting end of file (26).
Call Stack (most recent call first):
  ~/ToteBag/Third Party/FRUT/prefix/FRUT/cmake/Reprojucer.cmake:4653 (_FRUT_version_to_dec)
  ~/ToteBag/Third Party/FRUT/prefix/FRUT/cmake/Reprojucer.cmake:2671 (_FRUT_generate_plist_file)
  CMakeLists.txt:352 (jucer_project_end)
  

I'm using Xcode 14.2 and Cmake 3.25.1

@JoseDiazRohena JoseDiazRohena changed the title Error in Reprojucer when making a project "math cannot parse the expression" Error in Reprojucer when configuring a project Jan 16, 2023
@JoseDiazRohena
Copy link
Author

I think this may be due to an out of date cmake on my part.

@JoseDiazRohena
Copy link
Author

Wait. I think there is an issue in the docs. It says that "Reprojucer.cmake requires CMake version 3.4 minimum." However, the latest version of cmake I can find is 3.25.1, See: https://cmake.org/download/

@McMartin
Copy link
Owner

McMartin commented Jan 16, 2023

Hi @JoseDiazRohena,

Thanks for using FRUT!

FRUT indeed requires CMake 3.4 (which was released in November 2015), or a later version. The last version of CMake (3.25.1 as you found out) should work fine, though I haven't tested personally.

Based on the CMake error you shared above, Reproducer.cmake is trying to convert the version of your project (1.0.0r1) into an integer, by splitting on periods and using bit shifting. Unfortunately, 0r1 is not a valid number that can be bit shifted.

Does Projucer really accept a project version like 1.0.0r1? If it does, then you found a bug in Reprojucer.cmake, since it should reproduce how Projucer works. I'll have a look on my side to see what Projucer's behavior is.

I hope this helps!

@McMartin
Copy link
Owner

McMartin commented Jan 16, 2023

It seems that Projucer is fine with non-integers values in the project version because it uses juce::String::getIntValue, which returns the first integer in the string and ignores anything afterwards. This means that 0r1 is treated like 0 and the math expression (that contains the bit shifting) works fine.

As I wrote above, you found a bug in Reprojucer.cmake. Thanks for finding it and opening that issue!

I'll take care of fixing it as soon as I can.

@McMartin McMartin added the bug label Jan 16, 2023
@JoseDiazRohena
Copy link
Author

Ah! I'm glad to have helped 🫡.

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

No branches or pull requests

2 participants