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

mingw32-make failed #12444

Closed
MiChongGET opened this issue Sep 6, 2018 · 17 comments
Closed

mingw32-make failed #12444

MiChongGET opened this issue Sep 6, 2018 · 17 comments

Comments

@MiChongGET
Copy link

MiChongGET commented Sep 6, 2018

I had used the version of 3.4.2 or 3.4.3,when I used the windows powershell and mingw32-make would error,please see the picture,the libjpeg-turbo is error.

@alalek
Copy link
Member

alalek commented Sep 6, 2018

There is no official MinGW support.
Feel free to prepare patch yourself and provide PR. It would be accepted if it doesn't break other configurations.

You can switch back from libjpeg-turbo to legacy libjpeg via CMake BUILD_JPEG_TURBO_DISABLE=1 option.

BTW,
Don't make screenshots with text information.
It blocks searching for similar reports.

Reference error:

jmemmgr.c:662:11: error 'SIZE_MAX' undeclared

@MiChongGET
Copy link
Author

Thank you!

@pi-null-mezon
Copy link

pi-null-mezon commented Sep 19, 2018

@MiChongGET, actually it is possible to compile opencv 3.4.3 by mingw32 (i have used 5.3.0 for the instance). Follow this guide. It is little bit old but works even for opencv 3.4.3

@MiChongGET
Copy link
Author

@pi-null-mezon Your means is that the version of mingw32 is not right or I need use other tools?

@pi-null-mezon
Copy link

@MiChongGET I meant that Opencv 3.4.3 can be build on Windows7 by mingw32-make v4.1 (with g++ v5.3.0)

@MiChongGET
Copy link
Author

@pi-null-mezon May be I use the windows10.

@pi-null-mezon
Copy link

In Windows 10 Opencv 3.4.3 successfully builds by mingw too

@MiChongGET
Copy link
Author

@pi-null-mezon Ok, I try again

@pi-null-mezon
Copy link

pi-null-mezon commented Sep 20, 2018

Steps to build:

  1. Download last Opencv version from the official github repo (let suppose you have downloaded opencv into "opencv" directory somewhere on your disk)
  2. Go to opencv/modules/videoio/src, open cap_dshow.hpp, paste #define NO_DSHOW_STRSAFE (right on top of all other), save file to commit changes
  3. Install CMake (I have used 3.5.1)
  4. Open CMake, point Opencv3.4.3 sources location also point where you want to build them (let suppose for the instance it would be "build" directory sonwhere on your disk), press "Configure button"
  5. Select from the dialog "Mingw Makefiles" and wait utill sources will be preprocessed
  6. All options are red is normal, check "Grouped" in right top region of the CMake window, now we should check some flags:
    • in group CMAKE: for option CMAKE_BUILD_TYPE write Release (to build release version of opencv), also here you can specify where you want Opencv binaries will be installed after build
    • in group ENABLE: check ENABLE_CXX11 and uncheck ENABLE_PRECOMPILED_HEADERS
    • in group WITH: uncheck WITH_MSMF
  7. Press "Configure" button, whait untill processing will be complited, now all options should become white
  8. Press "Generate" button and wait (in your build directory Makefile should be created, you can close CMake after this step)
  9. Make shure your mingw toolchain location is known for your system (look if system environment variable PATH contains path to mingw toolchain)
  10. Open cmd.exe, change directory to your opencv's build idrectory
  11. Let's build opencv (-j[uint] - option specifies number of threads to use)
.../build> mingw32-make -j4
  1. Let's install opencv
.../build> mingw32-make install
  1. Done

@MiChongGET
Copy link
Author

@pi-null-mezon
So detailed! Amazing,Thank you very much! More recently I begin to student Opencv ,so much things I don't know, nowday I use Vscode to code by C++ that because of the VS is so big. But the enviroment of opencv makes me cry ,it bothers me several days. I hope to figure out as quickly as possible. (All in all, still Python is so esay ,not as hardly as it)

@MiChongGET
Copy link
Author

@pi-null-mezon Wrong again!
error :
D:\Ai\OPENCV\opencv3.4.3\sources\3rdparty\libjpeg-turbo\src\jmemmgr.c: In function 'realize_virt_arrays':
D:\Ai\OPENCV\opencv3.4.3\sources\3rdparty\libjpeg-turbo\src\jmemmgr.c:662:11: error: 'SIZE_MAX' undeclared (first use in this function)
if (SIZE_MAX - maximum_space < new_space)
^~~~~~~~
D:\Ai\OPENCV\opencv3.4.3\sources\3rdparty\libjpeg-turbo\src\jmemmgr.c:662:11: note: each undeclared identifier is reported only once for each function it appears in
3rdparty\libjpeg-turbo\CMakeFiles\libjpeg-turbo.dir\build.make:1162: recipe for target '3rdparty/libjpeg-turbo/CMakeFiles/libjpeg-turbo.dir/src/jmemmgr.c.obj' failed
mingw32-make[2]: *** [3rdparty/libjpeg-turbo/CMakeFiles/libjpeg-turbo.dir/src/jmemmgr.c.obj] Error 1
CMakeFiles\Makefile2:380: recipe for target '3rdparty/libjpeg-turbo/CMakeFiles/libjpeg-turbo.dir/all' failed
mingw32-make[1]: *** [3rdparty/libjpeg-turbo/CMakeFiles/libjpeg-turbo.dir/all] Error 2
mingw32-make[1]: *** Waiting for unfinished jobs....

@alalek
Copy link
Member

alalek commented Sep 20, 2018

SIZE_MAX is defined in compiler headers.
Perhaps you need to enable __STDC_CONSTANT_MACROS macro via CMAKE_C_FLAGS or via "add_defines(-D__STDC_CONSTANT_MACROS)" in CMake script of libjpeg-turbo.

P.S. There are many MinGW packages, so no way support / check them all. Moreover, it is impossible without complete versions info.

@pi-null-mezon
Copy link

@MiChongGET what version of mingw do you use???

@MiChongGET
Copy link
Author

@pi-null-mezon Everything is OK! The ,main question is the version of mingw ,fomerly I use the latest version, now I change the 5.3.0,since than the making is success!Thank you very much!

@vivkv
Copy link

vivkv commented Sep 23, 2018

@MiChongGET I am getting the same error while building OpenCV, I am on Windows 10 (64 bit) with gcc (tdm-1) 5.1.0 and running mingw32-make. What did you do to make this error go away, can you please tell me ?

@MiChongGET
Copy link
Author

@vivkv I use the version of mingw is 5.3.0,try use it!

@Ranarox
Copy link

Ranarox commented Apr 9, 2019

If someone else stumbled over this thread and still cant fix it, try to uncomment these three lines in the source code of the jmemmrg.c file and just includestdint.h. Worked for me with
opencv v.3.4.3
mingw32 v.6.3
cmake v.3.14.1

// #ifndef _WIN32
#include <stdint.h>
//#endif
//#include <limits.h>

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

No branches or pull requests

5 participants