Mingw32-Make & cmake 3.0 - c++

Well i am trying to compile opencv on my own for eclipsecdt4. I am following a tutorial for codeblocks over here
http://kevinhughes.ca/tutorials/opencv-install-on-windows-with-codeblocks-and-mingw/
I did the cmake thing with eclipse cdt4-mingw32makefile config(tried with just mingw32 makefile too) but the makefile isnt generating. When i do mingw32-make in the build directory it says
F:\ocv\build>mingw32-make
mingw32-make: *** No targets specified and no makefile found. Stop.
Here is a screenshot of the build directory

I had excatly the same problem....I solved it today...I forgot to press Generate in Cmake.....

Related

a problem with the raylib installation on linux

im using Peppermint 10 an ubuntu based distro
so i did the following commands here and everything went well until this
(the input)
cmake -DBUILD_SHARED_LIBS=ON ..
(the output)
-- Testing if -Werror=pointer-arith can be used -- compiles
-- Testing if -Werror=implicit-function-declaration can be used -- compiles
-- Testing if -fno-strict-aliasing can be used -- compiles
-- Using raylib's GLFW
-- Using X11 for window creation
-- Audio Backend: miniaudio
-- Building raylib shared library
-- Generated build type: Debug
-- Compiling with the flags:
-- PLATFORM=PLATFORM_DESKTOP
-- GRAPHICS=GRAPHICS_API_OPENGL_33
-- Building examples is enabled
-- Testing if -std=c11 can be used -- compiles
-- Configuring done
CMake Error at src/CMakeLists.txt:57 (add_library):
Error evaluating generator expression:
$<TARGET_OBJECTS:glfw>
Objects of target "glfw" referenced but is not an OBJECT library.
CMake Error: CMake can not determine linker language for target: raylib
CMake Error: Cannot determine link language for target "raylib".
-- Generating done
-- Build files have been written to: /home/anas/raylib/build
how do i even fix these cmake errors?
but then i ignored these thought it was normal but when i tried to do the following command
(the command aka the input)
make
(the output)
[ 7%] Built target glfw
make[2]: *** No rule to make target 'raylib/CMakeFiles/raylib.dir/build'. Stop.
CMakeFiles/Makefile2:87: recipe for target 'raylib/CMakeFiles/raylib.dir/all' failed
make[1]: *** [raylib/CMakeFiles/raylib.dir/all] Error 2
Makefile:162: recipe for target 'all' failed
make: *** [all] Error 2
it shows the same thing when i try sudo make install
help
i still dont know what is the problem here
btw im following the wiki here
Do this:
sudo apt install g++
sudo apt install cmake (should be in version 3.11 or higher)
download to your project folder ex. 'new-game' folder those three files from https://github.com/RobLoach/raylib-cpp/tree/master/projects/CMake (main.cpp, README.md, CMakeLists.txt)
then cd new-game && mkdir build && cd build && cmake .. && make
run ./raylib-cpp-example

"'MinGW/bin/gcc.exe' is not able to compile a simple test program."

I am currently learning CMake. Right now I am trying to configure CMake to build an example program to learn the basics, but I can't get past what seems like something that should be really easy. It seems that CMake does not agree with my gcc and g++ compilers. I have installed them through CodeBlocks, and they work fine there. However, when I go to configure a project in the CMake GUI I get the following:
The C compiler identification is unknown
The CXX compiler identification is unknown
Check for working C compiler: C:/CodeBlocks/MinGW/bin/gcc.exe
Check for working C compiler: C:/CodeBlocks/MinGW/bin/gcc.exe -- broken
CMake Error at C:/Program Files/CMake/share/cmake-3.15/Modules/CMakeTestCCompiler.cmake:60 (message):
The C compiler
"C:/CodeBlocks/MinGW/bin/gcc.exe"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: C:/Users/Bank/Desktop/Introductions-to-Libraries-with-CMake/Build/CMakeFiles/CMakeTmp
Run Build Command(s):C:/MinGW/bin/mingw32-make.exe cmTC_52744/fast && C:/MinGW/bin/mingw32-make.exe -f CMakeFiles\cmTC_52744.dir\build.make CMakeFiles/cmTC_52744.dir/build
mingw32-make.exe[1]: Entering directory 'C:/Users/Bank/Desktop/Introductions-to-Libraries-with-CMake/Build/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_52744.dir/testCCompiler.c.obj
C:\CodeBlocks\MinGW\bin\gcc.exe -o CMakeFiles\cmTC_52744.dir\testCCompiler.c.obj -c C:\Users\Bank\Desktop\Introductions-to-Libraries-with-CMake\Build\CMakeFiles\CMakeTmp\testCCompiler.c
CMakeFiles\cmTC_52744.dir\build.make:64: recipe for target 'CMakeFiles/cmTC_52744.dir/testCCompiler.c.obj' failed
mingw32-make.exe[1]: *** [CMakeFiles/cmTC_52744.dir/testCCompiler.c.obj] Error 1
mingw32-make.exe[1]: Leaving directory 'C:/Users/Bank/Desktop/Introductions-to-Libraries-with-CMake/Build/CMakeFiles/CMakeTmp'
Makefile:120: recipe for target 'cmTC_52744/fast' failed
mingw32-make.exe: *** [cmTC_52744/fast] Error 2
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:6 (project)
Configuring incomplete, errors occurred!
See also "C:/Users/Bank/Desktop/Introductions-to-Libraries-with-CMake/Build/CMakeFiles/CMakeOutput.log".
See also "C:/Users/Bank/Desktop/Introductions-to-Libraries-with-CMake/Build/CMakeFiles/CMakeError.log".
Here is my CMakeLists file:
cmake_minimum_required(VERSION 3.0.0)
set(CMAKE_C_COMPILER "C:/CodeBlocks/MinGW/bin/gcc.exe")
set(CMAKE_CXX_COMPILER "C:/CodeBlocks/MinGW/bin/g++.exe")
project("Foo")
add_subdirectory("foo")
And if it helps, here is what the Path variable in my Environment Variables looks like:
C:\Program Files (x86)\Common Files\Oracle\Java\javapath;c:\windows\system32;c:\windows;c:\windows\system32\wbem;c:\windows\system32\windowspowershell\v1.0\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\Git;C:\Program Files\Git\cmd;C:\Users\Bank\AppData\Local\Android\Sdk\tools;C:\Users\Bank\AppData\Local\Android\Sdk\platform-tools;C:\Users\Bank\Desktop\sfAnd\android-ndk-r20;C:\Program Files\CMake\bin;C:\Program Files\Java\jdk1.8.0_231;C:\MinGW\msys\1.0\bin;C:\Program Files\Java\jdk1.8.0_231\jre;C:\Gradle\gradle-6.0-all\gradle-6.0\bin;C:\Gradle\gradle-6.0-all\gradle-6.0;C:\Program Files (x86)\GnuWin32\bin;I:\Storage\Programs\apache-ant-1.9.14-bin\apache-ant-1.9.14\bin;C:\Python27;C:\ninja-win;C:\Program Files\dotnet\;C:\CodeBlocks\MinGW
What could the problem be?
C:\CodeBlocks\MinGW probably doesn't contain the DLL's to gcc or g++. You should add C:\CodeBlocks\MinGW\bin and/or C:\CodeBlocks\MinGW\lib to your path instead, depending on how MinGW was installed. I use MSys2 and use the provided environment for 32bit and 64bit tools. I try to get rid of the pre-packaged versions of MinGW to avoid confusion on my own computers (I noticed msys 1.0 in your path).
I figured it out, finally, thanks to this post:
Cmake build error for c++
I read some posts that said "[your_path]\MinGW" needed to be in your PATH variable, but it's actually "[your_path]\MinGW\bin." I am still not sure why adding the following in CMakeLists did not work:
set(CMAKE_C_COMPILER "C:/CodeBlocks/MinGW/bin/gcc.exe")
set(CMAKE_CXX_COMPILER "C:/CodeBlocks/MinGW/bin/g++.exe")
but that's for another time. Thank you for your help.

Building ASSIMP with MinGW causes file too big error

I am building ASSIMP using cmake and mingw-w64 on windows 10 and it gives me "file too big" errors while creating the object code. I tried using MinGW and MinGW-w64 and both give me the same error. I am using the default settings, I configure the project with cmake, generate the makefile and then run mingw32-make. Is there some kind of flag I can set to fix this?
Compiler:
g++ (x86_64-posix-seh-rev0, Built by MinGW-W64 project) 8.1.0
Here is the output:
[ 59%] Building CXX object code/CMakeFiles/assimp.dir/Importer/StepFile/StepFileImporter.cpp.obj
[ 60%] Building CXX object code/CMakeFiles/assimp.dir/Importer/StepFile/StepFileGen1.cpp.obj
C:/mingw-w64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/bin/as.exe:
CMakeFiles\assimp.dir\Importer\StepFile\StepFileGen1.cpp.obj: section .xdata$_ZNSt10_Head_baseILy0EPN6Assimp8StepFile29directed_dimensional_locationELb0EE7_M_headERKS4_:
string table overflow at offset 10000029
C:\Users\ANDREW~1.NOT\AppData\Local\Temp\ccwwseVM.s: Assembler messages:
C:\Users\ANDREW~1.NOT\AppData\Local\Temp\ccwwseVM.s: Fatal error: can't close CMakeFiles\assimp.dir\Importer\StepFile\StepFileGen1.cpp.obj: File too big
mingw32-make[2]: *** [code\CMakeFiles\assimp.dir\build.make:2485: code/CMakeFiles/assimp.dir/Importer/StepFile/StepFileGen1.cpp.obj] Error 1
mingw32-make[1]: *** [CMakeFiles\Makefile2:274: code/CMakeFiles/assimp.dir/all] Error 2
mingw32-make: *** [Makefile:129: all] Error 2
EDIT: I was using the master branch of Assimp from github, which has newer experimental features. I downloaded an older release version and I did not get the same errors.
This error is fixed by assimp itself https://github.com/assimp/assimp/issues/2406 Which version do you use?
What worked for me :
Go into the CMakeLists.txt and add:
set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} "-O3")
Then compile with some options off:
cmake .. -G "Unix Makefiles" -DASSIMP_BUILD_ASSIMP_TOOLS=OFF -DASSIMP_BUILD_TESTS=OFF
make -j4 && make install
It worked for 5.0.0-rc1 and 5.0.1 too.

CMake is not found when running through make

I'm trying to build https://github.com/AlbertWerner/cryptonotecoinwallet and facing an issue.
According to the README of the repo, I can run cmake command and it completes without any errors. But then, when I run make, it gives me the below error.
$ make
make: /usr/bin/cmake: Command not found
make: *** [Makefile:5138: cmake_check_build_system] Error 127
I'm using MSYS on Windows and here are the corresponding details.
$ echo $PATH
/usr/local/bin:/usr/bin:/bin:/opt/bin:/c/Windows/System32:/c/Windows:/c/Windows/System32/Wbem:/c/Windows/System32/WindowsPowerShell/v1.0/:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:/mingw32/bin
$ which cmake
/mingw32/bin/cmake
Seems like it's looking for cmake in the wrong path.
Makefile
cmake_check_build_system:
$(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 0
.PHONY : cmake_check_build_system # <== Line 5139
I'm not sure what's wrong. Please help me out.
Thanks.
Make sure that you launch MSYS2 using the mingw32.exe executable at the top level of your MSYS2 installation, and that you use that environment when you first run cmake. If you ran CMake in a different environment, remove all the files it created. The commands for running cmake and building the project should be something like this, assuming the developers have set it up in a reasonable way:
mkdir build
cd build
cmake .. -G"MSYS Makefiles"
make
I didn't try this myself because I am wary of running random code from the internet, but I found this note in the CMakefile indicating that the developers do not support MSYS2:
if (WIN32)
if (NOT MSVC)
message(FATAL_ERROR "Only MSVC is supported on this platform")
endif ()
...
So you will have to spend some effort on porting the Windows-specific code in this program to GCC if you really want to do this.

Building OpenBlas with msys2

I have a windows 7-64bit computer and I am trying to build OpenBlas library through Msys2.
There seems to be some problem with the gcc as after installing minGW and unziped OpenBlas folder, I open msys2 and I navigate to the folder where OpenBlas is located. I type the command make and I get this error:
make: gcc: Command not found
make: *** [getarch] Error 127
See our PKGBUILD for openblas:
https://github.com/Alexpux/MINGW-packages/blob/master/mingw-w64-openblas/PKGBUILD#L33