Updated compilation environment on Windows.

Great, will test with the first VanGogh example. Is there an easy way to print the time a command took to process?

Here are some first speed tests on Windows:
The command I used is “gmic -input sample.png _fx_stylize starrynight +fx_stylize 1,6,0,0,0.5,2,3,0.5,0.1,3,3,0,0.7,1,0,1,0,5,5,7,1,30,10,2,1.85,0 -output out.png”
sample.png is the standard temple png from G’MIC.

Official 2.9.2 CLI binary: 18.774s
My 2.9.2 CLI binary, compiled with MinGW: 18.421s
My 2.9.2 CLI binary, compiled with VS2012: 42.507s
My 2.9.2 CLI binary, compiled with VS2019: 12.356s

1 Like

use command tic and toc before and after the command you want to time.

1 Like

It looks like you have two different versions of gmic.h included in your project.
Could it be there is an older gmic.h mixed with the recent one when you compile the sources ?

Strange, it works with the develop branch from Github without warnings

If it helps, here is my compiler and linker command line for compiling with Visual Studio 2019:

cl.exe /ifcOutput “x64\Release” /GS /GL /W3 /wd"4800" /wd"4244" /wd"4267" /wd"4519" /Gy /Zc:wchar_t /I"C:\Program Files (x86)\Visual Leak Detector\include" /Gm- /O2 /Fd"…\pdb\gmic_Release_x64.pdb" /Zc:inline /fp:precise /D “gmic_main” /D “gmic_build” /D “cimg_use_fftw3” /D “cimg_use_zlib” /D “cimg_display=2” /D “cimg_use_png” /D “cimg_use_jpeg” /D “_CRT_SECURE_NO_WARNINGS” /D “WIN32” /D “NDEBUG” /D “_WINDOWS” /D “_USRDLL” /D “GMIC_LIBC_EXPORTS” /D “_UNICODE” /D “UNICODE” /errorReport:prompt /WX- /Zc:forScope /Gd /Oi /MD /openmp /FC /Fa"x64\Release" /EHsc /nologo /Fo"x64\Release" /Ot /Fp"x64\Release\gmic.pch" /diagnostics:column

link.exe /OUT:“C:\dev\gmic\src\VisualStudio_2019\x64\Release\gmic.exe” /MANIFEST /LTCG:incremental /NXCOMPAT /PDB:“C:\dev\gmic\src\VisualStudio_2019\x64\Release\gmic.pdb” /DYNAMICBASE “libpng.lib” “libjpeg.lib” “libfftw-3.3.lib” “zlib.lib” “kernel32.lib” “user32.lib” “gdi32.lib” “winspool.lib” “comdlg32.lib” “advapi32.lib” “shell32.lib” “ole32.lib” “oleaut32.lib” “uuid.lib” “odbc32.lib” “odbccp32.lib” /MACHINE:X64 /OPT:REF /INCREMENTAL:NO /PGD:“C:\dev\gmic\src\VisualStudio_2019\x64\Release\gmic.pgd” /SUBSYSTEM:CONSOLE /MANIFESTUAC:“level=‘asInvoker’ uiAccess=‘false’” /ManifestFile:“x64\Release\gmic.exe.intermediate.manifest” /OPT:ICF /ERRORREPORT:PROMPT /NOLOGO /LIBPATH:“C:\Program Files (x86)\Visual Leak Detector\lib\Win64” /TLBID:1

1 Like

Works perfectly, thanks!
Interesting to see that the Visual Studio build of the CLI is now faster than the MinGW one!

1 Like

Hi!

I am trying to build libgmic in Visual Studio using MSVC2019 and getting the error

D8021 invalid numeric argument '/Wno-error=narrowing'

in Release mode. That’s with Gmic version 2.9.2.

If I remove the argument I get more errors. Any ideas what to do?

1 Like

Isn’t that an argument only for g++? You should be able to remove it, then track down the other errors.

Yes you are right. Without the argument I am getting what I think is what you have been talking about?

'cimg_library::CImg<float>::assign': redefinition of default argument: parameter 1	
'cimg_library::CImg<float>::assign': redefinition of default argument: parameter 2	
'cimg_library::CImg<float>::assign': redefinition of default argument: parameter 3	

I have tried the develop branch and get this error a bunch of times:

Expression following '#pragma omp atomic' has improper form

Yes, the cimg assign errors are what I had found. You can simply remedy this by removing the defaults, as I have outlined above.
Not sure about that other error, you might be missing some defines. Have you enabled OpenMP support in the project settings?

I have taken out the argument defaults.

Now I am getting the pragma error, currently trying with 2.9.2 again.

OpenMP is enabled and has been found. The errors are coming from two sections in Cimg.h, starting at line 30733. The first block looks like this:

if (M==_width) { _cimg_fill_openmp_vector(YZ,y,z,X,x,0,y,z,1) }
else if (M==_height) { _cimg_fill_openmp_vector(XZ,x,z,Y,y,x,0,z,_width) }
else { _cimg_fill_openmp_vector(XY,x,y,Z,z,x,y,0,_width*_height) }

Unfortunately I don’t know enough about OpenMP to fix it.

Since you successfully built this with MSVC, would you share your binaries?

What about trying with the latest sources in the git ‘develop’ branch ?

We are currently trying to make it as much compatible with MSVC as we can, so any feedback would be great!

Hi!

Thanks for replying! I have tried the develop branch and I am getting the pragma openmp error.

Skimming through Stackoverflow I just learned that MSVC apparently still uses OpenMP 2.0.

Might that be causing the issues?

I assume you have set the “cimg_use_openmp” preprocessor define? If so, try removing it and see if it then compiles. I have set it in my project though and it still compiles, so I don’t assume this is the error.
As for sharing binaries, I am currently still experimenting and my builds do not yet include libtiff or OpenCV (as these are rarely used), and with libcurl I am still contemplating which https library to use before including it. What binaries are you looking for, the CLI, the libgmic, the libcgmic, the libcgmicstatic, etc.?

Yes if I disable OpenMP it does indeed compile.

That will do for testing I guess. I am just using the libgmic without any extras. Although OpenMP would be nice of course.

Thank you!

1 Like

I am not sure you can actually use the generated lib from libgmic on your system, as it has to match compiler versions exactly and you’ll probably also need third-party libraries and headers, but here is the package I just generated (libgmic.lib and other third-party libs like libpng):
http://reduxfx.com/rtmp/libgmic_vs2019.zip

Thanks I don’t have it working yet. I’ll try again tomorrow.

I have now managed to compile the latest sources from the G’MIC develop branch using Visual Studio, including support for OpenMP, FFTW3, CURL (including HTTPS/SSL), PNG, JPEG and TIFF and with full optimisations. Since all libraries are linked statically, the whole gmic.exe file is self-contained and does not need any other DLL to work (apart from the Microsoft runtime if that isn’t installed yet on your system, but event that could be linked statically).

Here is a binary build of the CLI for anyone that wants to test/compare:
http://reduxfx.com/rtmp/gmic_cli_vs2019.zip

3 Likes

I have been able to compile now. It throws lots of warnings but no errors.

Using the example code from here (Step 3) throws an exception on the line:

gmic("water[0] 20 flower[1] 20 blend vividlight", image_list, image_names);

The error message is:

Exception at 0x7ff90daf3b29, code: 0xe06d7363: C++ exception, flags=0x1 (execution cannot be continued) (first chance) in GmicTest2!cimg_library::CImgDisplay::_no_display_exception