CMake - cannot build OpenCascade from source - cmake

I am trying to Build OpenCascade from source.
I am using this guide:
https://github.com/tpaviot/oce/blob/master/BUILD.MINGWw64.md
All the steps from 1-5, which include downloading stuff have been performed.
Now i am trying to build using CMAKE
*I used "Where is the source code" option to point to the directory of the oce (as instructed).
*I used "Where to build the binaries" option, to point the a folder which i named 'BUILD' inside the directory mentioned in the above step (as instructed).
*I pressed 'Configure' and selected "MSYS Makefiles" with default native compilers.
Here started the errors.
I noticed that CMake had produced a text file, so i went inside and changed the CMAKE MAKE location: CMAKE_MAKE_PROGRAM:FILEPATH=C:/Users/User1/Desktop/OPENCA~1/msys/bin
There i moved forward but new errors spawned.
so how do i move forward?
The guide then says:
"
Check OCE_USE_BUNDLE_SOURCE
Check OCE_WITH_FREEIMAGE
Check OCE_WITH_GL2PS
Check OCE_VISUALISATION
"
Where do i set these?
There are no such variables inside the text file, and neither i can set them up on CMAKE.
EDIT:
These are the errors i get now:
The C compiler identification is GNU 8.1.0
The CXX compiler identification is GNU 8.1.0
Detecting C compiler ABI info
CMake Error: Generator: execution of make failed. Make command was: C:/Users/User1/Desktop/OPENCA~1/msys/bin cmTC_a5bfb/fast &&
Detecting C compiler ABI info - failed
Check for working C compiler: C:/Program Files/mingw-w64/x86_64-8.1.0-posix-seh-rt_v6-rev0/mingw64/bin/gcc.exe
CMake Error: Generator: execution of make failed. Make command was: C:/Users/User1/Desktop/OPENCA~1/msys/bin cmTC_d3ad7/fast &&
Check for working C compiler: C:/Program Files/mingw-w64/x86_64-8.1.0-posix-seh-rt_v6-rev0/mingw64/bin/gcc.exe - broken
CMake Error at C:/Program Files/CMake/share/cmake-3.18/Modules/CMakeTestCCompiler.cmake:66 (message):
The C compiler
"C:/Program Files/mingw-w64/x86_64-8.1.0-posix-seh-rt_v6-rev0/mingw64/bin/gcc.exe"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: C:/Users/User1/Desktop/OpenCascade project/oce/BUILD/CMakeFiles/CMakeTmp
Run Build Command(s):C:/Users/User1/Desktop/OPENCA~1/msys/bin cmTC_d3ad7/fast && Access is denied
Generator: execution of make failed. Make command was: C:/Users/User1/Desktop/OPENCA~1/msys/bin cmTC_d3ad7/fast &&
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:20 (project)
Configuring incomplete, errors occurred!
See also "C:/Users/User1/Desktop/OpenCascade project/oce/BUILD/CMakeFiles/CMakeOutput.log".
See also "C:/Users/User1/Desktop/OpenCascade project/oce/BUILD/CMakeFiles/CMakeError.log".
EDIT 2:
There are some null options in CMake:
EDIT 3:
After following the advice of Tsyvarev, i changed the line to
CMAKE_MAKE_PROGRAM:FILEPATH=C:/Users/User1/Desktop/OPENCA~1/msys/bin/make.exe
These are the errors i get:
The C compiler identification is GNU 8.1.0
The CXX compiler identification is GNU 8.1.0
Detecting C compiler ABI info
CMake Error: Generator: execution of make failed. Make command was: C:/Users/User1/Desktop/OPENCA~1/msys/bin cmTC_51dc6/fast &&
Detecting C compiler ABI info - failed
Check for working C compiler: C:/Program Files/mingw-w64/x86_64-8.1.0-posix-seh-rt_v6-rev0/mingw64/bin/gcc.exe
CMake Error: Generator: execution of make failed. Make command was: C:/Users/User1/Desktop/OPENCA~1/msys/bin cmTC_88ba8/fast &&
Check for working C compiler: C:/Program Files/mingw-w64/x86_64-8.1.0-posix-seh-rt_v6-rev0/mingw64/bin/gcc.exe - broken
CMake Error at C:/Program Files/CMake/share/cmake-3.18/Modules/CMakeTestCCompiler.cmake:66 (message):
The C compiler
"C:/Program Files/mingw-w64/x86_64-8.1.0-posix-seh-rt_v6-rev0/mingw64/bin/gcc.exe"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: C:/Users/User1/Desktop/OpenCascade project/oce/BUILD/CMakeFiles/CMakeTmp
Run Build Command(s):C:/Users/User1/Desktop/OPENCA~1/msys/bin cmTC_88ba8/fast && Access is denied
Generator: execution of make failed. Make command was: C:/Users/User1/Desktop/OPENCA~1/msys/bin cmTC_88ba8/fast &&
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:20 (project)
Configuring incomplete, errors occurred!
See also "C:/Users/User1/Desktop/OpenCascade project/oce/BUILD/CMakeFiles/CMakeOutput.log".
See also "C:/Users/User1/Desktop/OpenCascade project/oce/BUILD/CMakeFiles/CMakeError.log".

Here's how I built OpenCascade 7.4.0 (static+shared) from http://www.opencascade.com/content/latest-release under MSYS2 using Ninja:
INSTALLPREFIX=/usr/local
mkdir -p build_static build_shared &&
cmake.exe -Wno-dev -GNinja -DCMAKE_INSTALL_PREFIX:PATH=$INSTALLPREFIX/share/opencascade -DCMAKE_BUILD_TYPE:STRING=Release -DBUILD_SHARED_LIBS:BOOL=OFF -DBUILD_LIBRARY_TYPE:STRING=Static -DUSE_VTK:BOOL=OFF -DUSE_RAPIDJSON:BOOL=ON -DUSE_FREEIMAGE:BOOL=OFF -DUSE_FFMPEG:BOOL=OFF -DUSE_D3D:BOOL=OFF -DBUILD_RELEASE_DISABLE_EXCEPTIONS:BOOL=ON -DBUILD_USE_PCH:BOOL=OFF -DBUILD_SAMPLES_QT:BOOL=OFF -S. -Bbuild_static &&
cmake.exe -Wno-dev -GNinja -DCMAKE_INSTALL_PREFIX:PATH=$INSTALLPREFIX/share/opencascade -DCMAKE_BUILD_TYPE:STRING=Release -DBUILD_SHARED_LIBS:BOOL=ON -DBUILD_LIBRARY_TYPE:STRING=Shared -DUSE_VTK:BOOL=OFF -DUSE_RAPIDJSON:BOOL=ON -DUSE_FREEIMAGE:BOOL=OFF -DUSE_FFMPEG:BOOL=OFF -DUSE_D3D:BOOL=OFF -DBUILD_RELEASE_DISABLE_EXCEPTIONS:BOOL=ON -DBUILD_USE_PCH:BOOL=OFF -DBUILD_SAMPLES_QT:BOOL=OFF -S. -Bbuild_shared &&
sed -i.bak -e "s/LINK_LIBRARIES *= *[^ ]*libTKTopAlgo\.dll\.a.*-lfreetype.*libTKernel\.dll\.a.*$/& -Wl,--as-needed -lz -lbz2 -lharfbuzz -lpng -lbrotlidec/" build_shared/build.ninja &&
ninja -Cbuild_static install/strip &&
ninja -Cbuild_shared install/strip &&
echo Success

Related

CLion and MinGW

I want to try and learn how to use the C language. Therefore, I downloaded CLion and MinGW as toolchain. When trying to install the compiler, it says "test CMake run finished with errors".
Did anybody ever had this problem? What should I do? (At the end of the question- what's written when I click "more" when it says "error").
Or, if you know of any other programs I should download in order to work with C, I'll be happy to hear.
Thanks in advance.
When clicking "more" it says:
-- The C compiler identification is GNU 8.1.0
-- The CXX compiler identification is GNU 8.1.0
-- Check for working C compiler: C:/Program Files (x86)/mingw-w64/i686-8.1.0-posix-dwarf-rt_v6-rev0/mingw32/bin/gcc.exe
-- Check for working C compiler: C:/Program Files (x86)/mingw-w64/i686-8.1.0-posix-dwarf-rt_v6-rev0/mingw32/bin/gcc.exe -- broken
CMake Error at C:/Program Files/JetBrains/CLion 2019.3.5/bin/cmake/win/share/cmake-3.15/Modules/CMakeTestCCompiler.cmake:60 (message):
The C compiler
"C:/Program Files (x86)/mingw-w64/i686-8.1.0-posix-dwarf-rt_v6-rev0/mingw32/bin/gcc.exe"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: C:/Users/׳ ׳•׳¢׳�/AppData/Local/Temp/cmake_check_environment/_build13533773436764788547/CMakeFiles/CMakeTmp
Run Build Command(s):C:/PROGRA~2/MINGW-~1/I686-8~1.0-P/mingw32/bin/mingw32-make.exe cmTC_e4849/fast && C:/PROGRA~2/MINGW-~1/I686-8~1.0-P/mingw32/bin/mingw32-make.exe -f CMakeFiles\cmTC_e4849.dir\build.make CMakeFiles/cmTC_e4849.dir/build
mingw32-make.exe[1]: Entering directory 'C:/Users/ג‰¡ֿƒג‰¥ֿ†/AppData/Local/Temp/cmake_check_environment/_build13533773436764788547/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_e4849.dir/testCCompiler.c.obj
C:\PROGRA~2\MINGW-~1\I686-8~1.0-P\mingw32\bin\gcc.exe -o CMakeFiles\cmTC_e4849.dir\testCCompiler.c.obj -c C:\Users\ג•«ֳ¡ג•«׳¥ג•«ֳ³ג•«ֲ¥\AppData\Local\Temp\cmake_check_environment\_build13533773436764788547\CMakeFiles\CMakeTmp\testCCompiler.c
gcc.exe: error: C:\Users\ג•«ֳ¡ג•«׳¥ג•«ֳ³ג•«ֲ¥\AppData\Local\Temp\cmake_check_environment\_build13533773436764788547\CMakeFiles\CMakeTmp\testCCompiler.c: No such file or directory
gcc.exe: fatal error: no input files
compilation terminated.
mingw32-make.exe[1]: *** [CMakeFiles\cmTC_e4849.dir\build.make:65: CMakeFiles/cmTC_e4849.dir/testCCompiler.c.obj] Error 1
mingw32-make.exe[1]: Leaving directory 'C:/Users/ג‰¡ֿƒג‰¥ֿ†/AppData/Local/Temp/cmake_check_environment/_build13533773436764788547/CMakeFiles/CMakeTmp'
mingw32-make.exe: *** [Makefile:120: cmTC_e4849/fast] Error 2
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:1 (project)
-- Configuring incomplete, errors occurred!
See also "C:/Users/׳ ׳•׳¢׳�/AppData/Local/Temp/cmake_check_environment/_build13533773436764788547/CMakeFiles/CMakeOutput.log".
See also "C:/Users/׳ ׳•׳¢׳�/AppData/Local/Temp/cmake_check_environment/_build13533773436764788547/CMakeFiles/CMakeError.log".
Error code: 1

Simple test output - CMake Error: The source directory does not exist

When I create new project in Clion, cmake cannot find CMakeTmp directory.
Run Build Command(s):/usr/bin/cmake cmTC_df723/fast && No such file or directory
OS: Linux Mint 19 (Ubuntu based)
I have tried:
reinstalling gcc (now on version 8.3.0)
reinstalling cmake (now on version 3.15.2)
unset TMP from (CMake cannot compile test program as source directory doesnt exist)
set(CMAKE_C_COMPILER gcc)
set(CMAKE_SYSTEM_NAME Linux)
checked permissions to ClionProject subdirectories
Error output:
/usr/local/bin/cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_MAKE_PROGRAM=/usr/bin/cmake -DCMAKE_C_COMPILER=/usr/bin/gcc -DCMAKE_CXX_COMPILER=/usr/bin/c++ -DCMAKE_C_COMPILER=/usr/bin/gcc -G "CodeBlocks - Unix Makefiles" /home/sacha/CLionProjects/testProject
-- The C compiler identification is GNU 7.4.0
-- Check for working C compiler: /usr/bin/gcc
CMake Error: Generator: execution of make failed. Make command was: /usr/bin/cmake cmTC_df723/fast &&
-- Check for working C compiler: /usr/bin/gcc -- broken
CMake Error at /usr/local/share/cmake-3.15/Modules/CMakeTestCCompiler.cmake:60 (message):
The C compiler
"/usr/bin/gcc"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: /home/sacha/CLionProjects/testProject/cmake-build-release-system/CMakeFiles/CMakeTmp
Run Build Command(s):/usr/bin/cmake cmTC_df723/fast && No such file or directory
Generator: execution of make failed. Make command was: /usr/bin/cmake cmTC_df723/fast &&
Any help or directions appreciated, thanks!
The error message
CMake Error: Generator: execution of make failed.
signals, that something wrong with CMake settings or its generator.
In the given case you have additional message
Make command was: /usr/bin/cmake cmTC_df723/fast &&
which means that cmake is run as a Make command.
This is wrong: cmake and make commands are not interchangeable.
Would you inspect the very first command line, you will find the source of that problem:
-DCMAKE_MAKE_PROGRAM=/usr/bin/cmake
Exactly it sets cmake executable for Make command. You need to fix that line (e.g. in CLion settings).

Cmake not able to recognize cache entry for FOLLY_LIBRARIES while installing fbtorch using luarocks

I am trying to install fbtorch on linux. However, when I try to run luarocks install fbtorch I get the following error.
cmake -E make_directory build && cd build && cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="/home/user/torch/install/bin/.." -DCMAKE_INSTALL_PREFIX="/home/user/torch/install/lib/luarocks/rocks/fbtorch/scm-1"
fatal: Not a git repository (or any of the parent directories): .git
fatal: Not a git repository (or any of the parent directories): .git
-- The C compiler identification is GNU 5.4.0
-- The CXX compiler identification is GNU 5.4.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found Torch7 in /home/user/torch/install
CMake Error at /usr/share/cmake-3.5/Modules/FindPackageHandleStandardArgs.cmake:148 (message):
REQUIRED_ARGS (missing: FOLLY_INCLUDE_DIR FOLLY_LIBRARIES)
Call Stack (most recent call first):
/usr/share/cmake-3.5/Modules/FindPackageHandleStandardArgs.cmake:388 (_FPHSA_FAILURE_MESSAGE)
cmake/FindFolly.cmake:23 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
CMakeLists.txt:12 (FIND_PACKAGE)
-- Configuring incomplete, errors occurred!
See also "/tmp/luarocks_fbtorch-scm-1-4920/fbtorch/build/CMakeFiles/CMakeOutput.log".
Now, to fix the REQUIRED_ARGS (missing: FOLLY_INCLUDE_DIR FOLLY_LIBRARIES) I changed the cmake command to:
cmake -E make_directory build && cd build && cmake .. -DFOLLY_LIBRARIES="/home/user/local/lib" -DFOLLY_INCLUDE_DIR="/home/user/local/include" -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="$(LUA_BINDIR)/.." -DCMAKE_INSTALL_PREFIX="$(PREFIX)"
Kindly note that I have compiles and installed folly at /home/user/local/ in appropriate directories
This fixed the FOLLY_INCLUDE_DIR error but its still showing error for FOLLY_LIBRARIES like so:
CMake Error at /usr/share/cmake-3.5/Modules/FindPackageHandleStandardArgs.cmake:148 (message):
REQUIRED_ARGS (missing: FOLLY_LIBRARIES)
Call Stack (most recent call first):
/usr/share/cmake-3.5/Modules/FindPackageHandleStandardArgs.cmake:388 (_FPHSA_FAILURE_MESSAGE)
cmake/FindFolly.cmake:23 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
CMakeLists.txt:12 (FIND_PACKAGE)
What am I missing here? Why did the cmake recognize the cache entry for FOLLY_INCLUDE_DIR but not for FOLLY_LIBRARIES?
Variables listed in "missed" list in find_package() call are not required to be CACHE ones. So, setting cache variable with the same name may do not resolve the problem.
If searched package is actually installed into non-standard location, instead of blindly setting "missing" variables it is better to hint the "Find" script about that location.
Many "Find" scripts describe possible ways of parametrization at the beginning of their code. Aside from this, there are common ways for hinting "Find" scripts about actual location of the package; these ways works for most of scripts. E.g. you may add install location of the package into CMAKE_PREFIX_PATH variable (See that question).
If you look at FindFolly.cmake you can see the line -
SET(FOLLY_LIBRARIES ${FOLLY_LIBRARY})
This means that FOLLY_LIBRARIES is being set but it needs FOLLY_LIBRARY.
So in your command line change -DFOLLY_LIBRARIES to -DFOLLY_LIBRARY

Trying to use JetBrains CLion, but Cmake - c++ compiler broken after cygwin install

I have been trying to get JetBrains CLion IDE working, but I am running into a problem with Cmake and none of my research online has been helpful. I installed cygwin with the necessary packages (as stated here - gcc/g++, cmake, make, gdb). When I open up CLion and go into Settings (I'm running Windows 10) under Build>Toolchains>Debugger everything has a check next to it, so it seems like CLion has found everything alright, but when I look in the Debugger window I get the following error:
"C:\Users\Lucas Lofaro\.CLion2016.3\system\cygwin_cmake\bin\cmake.exe" -DCMAKE_BUILD_TYPE=Debug -G "CodeBlocks - Unix Makefiles" "/cygdrive/c/Users/Lucas Lofaro/ClionProjects/cracking_the_coding_interview"
-- The CXX compiler identification is GNU 5.3.0
-- Check for working CXX compiler: /usr/bin/c++.exe
-- Check for working CXX compiler: /usr/bin/c++.exe -- broken
CMake Error at /cygdrive/c/Users/Lucas Lofaro/.CLion2016.3/system/cygwin_cmake/share/cmake-3.6.2/Modules/CMakeTestCXXCompiler.cmake:54 (message):
The C++ compiler "/usr/bin/c++.exe" is not able to compile a simple test
program.
It fails with the following output:
Change Dir: /cygdrive/c/Users/Lucas Lofaro/ClionProjects/cracking_the_coding_interview/cmake-build-debug/CMakeFiles/CMakeTmp
Run Build Command:"/usr/bin/make.exe" "cmTC_96921/fast"
/usr/bin/make -f CMakeFiles/cmTC_96921.dir/build.make
CMakeFiles/cmTC_96921.dir/build
make[1]: Entering directory '/cygdrive/c/Users/Lucas
Lofaro/ClionProjects/cracking_the_coding_interview/cmake-build-debug/CMakeFiles/CMakeTmp'
Building CXX object CMakeFiles/cmTC_96921.dir/testCXXCompiler.cxx.o
/usr/bin/c++.exe -o CMakeFiles/cmTC_96921.dir/testCXXCompiler.cxx.o -c
"/cygdrive/c/Users/Lucas
Lofaro/ClionProjects/cracking_the_coding_interview/cmake-build-debug/CMakeFiles/CMakeTmp/testCXXCompiler.cxx"
Linking CXX executable cmTC_96921.exe
"/cygdrive/c/Users/Lucas
Lofaro/.CLion2016.3/system/cygwin_cmake/bin/cmake.exe" -E cmake_link_script
CMakeFiles/cmTC_96921.dir/link.txt --verbose=1
/usr/bin/c++.exe -Wl,--enable-auto-import
CMakeFiles/cmTC_96921.dir/testCXXCompiler.cxx.o -o cmTC_96921.exe
-Wl,--out-implib,libcmTC_96921.dll.a
-Wl,--major-image-version,0,--minor-image-version,0
c++: fatal error: -fuse-linker-plugin, but cyglto_plugin.dll not found
compilation terminated.
CMakeFiles/cmTC_96921.dir/build.make:97: recipe for target 'cmTC_96921.exe'
failed
make[1]: *** [cmTC_96921.exe] Error 1
make[1]: Leaving directory '/cygdrive/c/Users/Lucas
Lofaro/ClionProjects/cracking_the_coding_interview/cmake-build-debug/CMakeFiles/CMakeTmp'
Makefile:126: recipe for target 'cmTC_96921/fast' failed
make: *** [cmTC_96921/fast] Error 2
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:2 (project)
-- Configuring incomplete, errors occurred!
See also "/cygdrive/c/Users/Lucas Lofaro/ClionProjects/cracking_the_coding_interview/cmake-build-debug/CMakeFiles/CMakeOutput.log".
See also "/cygdrive/c/Users/Lucas Lofaro/ClionProjects/cracking_the_coding_interview/cmake-build-debug/CMakeFiles/CMakeError.log".
I've also added the cygwin bin directory to my Path environment variable, but I am really at a loss as to what to do next. Something isn't linking up and I don't want to start digging around in Cmake files without a better understanding of what's going on. Any guidance would be much appreciated. Please let me know if I can provide any additional information.
It turns out that the cmake, make, and g++ packages were installed but not updated to their most recent versions. Rerunning cygwin installer solved my problem and everything now compiles fine.

CMake cannot compile test program as source directory doesnt exist

all. I'm trying to use cmake for compile some android code with android toolchain on Windows 7x64.
when i call cmake as following
cmake -G "Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE=android.cmake 1>!cmake.log 2>!cmake.error.log
I run this command from Administrator console and get following output:
!cmake.log
-- The C compiler identification is GNU 4.6.0
-- The CXX compiler identification is GNU 4.6.0
-- Check for working C compiler: c:/cygwin/usr/local/android-toolchain-r8ea9/bin/arm-linux-androideabi-gcc.exe
-- Check for working C compiler: c:/cygwin/usr/local/android-toolchain-r8ea9/bin/arm-linux-androideabi-gcc.exe -- broken
-- Configuring incomplete, errors occurred!
!cmake.error.log
CMake Error at C:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/CMakeTestCCompiler.cmake:61 (message):
The C compiler
"c:/cygwin/usr/local/android-toolchain-r8ea9/bin/arm-linux-androideabi-gcc.exe"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: C:/PDK_BUILD/openssl/CMakeFiles/CMakeTmp
Run Build Command:C:/PROGRA~2/CMAKE2~1.8/bin/cmake.exe
"cmTryCompileExec333575975/fast"
CMake Error: The source directory
"C:/PDK_BUILD/openssl/CMakeFiles/CMakeTmp/cmTryCompileExec333575975/fast"
does not exist.
Specify --help for usage, or press the help button on the CMake GUI.
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
I granted adninistrator rights for cmake.exe itself, cleared read-only attributes from CMakeFiles folder and disabled anti-virus but still not worked.
It looks like you are running into CMake Bug 0013131. This comment suggests that using unset TMP should fix the problem. Don't forget to delete the CMakeCache.txt and CMakeFiles folders (or the entire build tree when using out-of-source builds), before retrying.