Compile on MacOS Catalina

Manual project build issues.
Post Reply
prajwal87
Posts: 3
Joined: Sat Jul 03, 2021 8:19 am

Compile on MacOS Catalina

Post by prajwal87 »

Hi all, the software looks very interesting and would definitely help with some Blender nodes for rendering. I am not a programmer and can just dabble a little bit in the terminal. At the moment I am trying to install CGRU on Mac. Looking at the documentation, i see we have to use the build.sh and add the CMAKE_PREFIX_PATH=/usr/local/opt/qt5/lib/cmake . I have homebrew and the libraries as mentioned in the other post on this forum. I have hit a technical snag or maybe just aloof. Here is what my terminal shows when i use the build script

/Users/prajwalvas/Downloads/cgru.3.2.0/afanasy/src/libafanasy/name_afstr.cpp:141:60: error: expected expression
std::transform(lower.begin(), lower.end(), lower.begin(), [](unsigned char c){ return std::tolower(c); });
^
1 error generated.
make[2]: *** [libafanasy/CMakeFiles/afanasy.dir/Users/prajwalvas/Downloads/cgru.3.2.0/afanasy/src/libafanasy/name_afstr.cpp.o] Error 1
make[1]: *** [libafanasy/CMakeFiles/afanasy.dir/all] Error 2
make: *** [all] Error 2

All you fantastic folks at cgru please guide me. Let me know if this makes sense.Thanks in advance
User avatar
timurhai
Site Admin
Posts: 911
Joined: Sun Jan 15, 2017 8:40 pm
Location: Russia, Korolev
Contact:

Re: Compile on MacOS Catalina

Post by timurhai »

Hi!
You can ask some MacOS developers forum for this error.
It seems that you compilator does not understand https://en.cppreference.com/w/cpp/algorithm/transform function (can't unreconize some overload). Or https://en.cppreference.com/w/cpp/string/byte/tolower function.
Maybe some other version of comilator needed, or some flag should be added to enable some c++ standard.
Timur Hairulin
CGRU 3.3.1, Ubuntu 20.04, 22.04, MS Windows 10 (clients only).
prajwal87
Posts: 3
Joined: Sat Jul 03, 2021 8:19 am

Re: Compile on MacOS Catalina

Post by prajwal87 »

Hi Timur, Thank you for the reply. We went ahead and got a solution for this issue. We have also outlined the process we have followed and the binaries generated from our installation.
Solution:
- Download the whole XCode app from the app store or Xcode Command line tools
- Run the one-liner command that installs the homebrew package manager from https://brew.sh/ on a terminal
- run "brew install python" on the terminal
- run "brew install cmake" on the terminal
- run "brew install qt5" on the terminal
- run "brew install ffmpeg" on the terminal
- run "brew install imagemagick" on the terminal
- download the sources of the program from https://sourceforge.net/projects/cgru/f ... /download
- unzip it and open a terminal on the unziped folder
- open the file CmakeLists.txt that is inside the folder cgru/afantasy/src/project.cmake/
- now, inside that file, search for this line: "if(CMAKE_COMPILER_IS_GNUCC)" that line i think is in the line 52, now what you need to do is to add a # symbol to the start of the line so that it becomes something like this "#if(CMAKE_COMPILER_IS_GNUCC)"
- now, search for the line that has "endif()" on it, there are a lot of lines with it but you need to search the one that matches the previous line you edited, so that they seem to be a pair of each other. I think it is on line 58. To that line you should also add the # symbol to the start so that it becomes "#endif" - compare that it looks like the attached image - exit the file and save it
- now open the file "build.sh" on the same folder as "CmakeLists.txt" and add this line "export CMAKE_PREFIX_PATH=/usr/local/opt/qt5/lib/cmake", it doesnt matter a lot were you add this line but preferebly add it after the line that says "#!/bin/bash"
- now, exit the file and save it
- then, you need to check that this folder actually exists, so in the terminal run "cd /usr/local/opt/qt5/lib/cmake" and if the terminal doesn't say anything about the directory not existing, you can continue
- run "./build.sh --nosql" on the terminal - done, now the binaries will be on the "/cgru/afanasy/bin/" folder
-The problem was basically that the compiler was using another version of C++ which MacOS supports but for some reason wasn't activated on the config files of the cgru project. So what we"commented" by adding the # symbols is basically just saying to the config file to ignore the checks and default to the new and needed compiler version.

Thanks for the great software Timur !
Post Reply