Microsoft and the DevIL
Steps to compiling DevIL under Vista x64. http://openil.sourceforge.net/
After downloading and unzipping DevIL 1.78 Windows SDK, load the project into MSVC, and hit compile.
1) fatal error C1083: Cannot open include file: 'IL/config.h': No such file or directory.
(9 Errors /0 Warnings)
It would seem that DevIL uses some "configure.bat" to configure the appropriate options for "config.h.in" and should output "config.h" otherwise we get the above error.
As I'm new to 3rd party library compiling under MSVC, it would be nice to have a readme that explains in depth what is meant to happen at this stage. Configure.bat returns a "file not found" error in either a DOS box, or MSVC console. Over the last few days i have compiled Qt and Freeimage, Freeglut, etc without any such manually hacking or guess work. Regardless i manually change "config.h.in" to be "config.h" and rebuild.
As I'm not aware if the makefiles are even useful for MSVC, and if they are Nmake compatible, as there is no "Autoconf" for windows only GNU, and Cygwin to my knowledge.
http://www.adp-gmbh.ch/misc/tools/configure/configure_in.html
http://en.wikipedia.org/wiki/GNU_build_system
2) fatal error C1083: Cannot open include file: 'png.h': No such file or directory
(9 Errors / 3 Warnings)
It seems DevIL does not come with the external libraries used for many of the included file types. These must be manually downloaded all individually and not packaged with the main download. This does mean a lot more manual searching, configuration and editing files. There is a "libraries.txt" file that does relate this information, however the link for uncompiled sources is not current, and i have no easy way to grab them all in one package. http://openil.sourceforge.net/libs/LibSrc.zip -Non valid link:
Previously i downloaded just the TiffLib source files from the respective webpage, and had several more issues to solve with just the inclusion of libtiff and DevIL.
I will comment out the 3rd party libraries like Jpeg and TIFF etc, for the time being and rebuild.
3) fatal error C1083: Cannot open source file: '..\src\il_utx.c': No such file or directory\
(2 Errors / 3 Warnings)
Despite my fingers being crossed, another issue arises.... The file "il_utx.c" does not appear in the SDK. There is however a "il_utx.cpp" which is one of only two ".cpp" files in the directory, the rest are all ".c" files.. So i again manually rename the file to suit, but at this stage I start to wonder if this SDK is Windows friendly at all.
If i manually rename the file to "il_utx.c" i then get 100's of errors in cstdio and cstring. So I made a "#define IL_NO_UTX" in "IL.h" and this solved the issue, albeit with another less important image file type down from the list.
4) fatal error C1083: Cannot open include file: 'WMPGlue.h': No such file or directory
(1 Error / 3 Warnings)
It appears that another image library for Microsoft HDPhoto is included, but has been designed to throw an error because it's not LGPL compatible like the others. I'm not sure it should really be included in the package for those reasons.
So again we make another define in "IL.h" to remove support for it. (sigh)
5) fatal error RC1015: cannot open include file 'afxres.h'
(1 Error / 3 Warnings)
I don't have any reference to this file in my MSVC build or the SDK, however it does appear in a CodeBlocks Mingw install i have. But i do question why it's looking for "afxres.h" at all with the relevant Windows SDK. I can try to manually copy the file from mingw, but I'm not hopeful if 'afxres.h' references other libraries and such.
Interestingly the error is made in "IL.rc" i don't usually use such files, but i believe it's autogenerated resource file made when compiling. I vaguely remember them from Windows GUI projects. But i assume their is no interface for DevIL.
So i believe this could be a Microsoft issue. A google search seems to reveal it could be an MSVC configuration issue within MSVC. My question is why is MSVC 2008 giving such an error and asking for a file that isn't in my Visual Studio install? http://social.msdn.microsoft.com/Forums/en-US/Vsexpressvc/thread/d3480ee3-d880-4431-9264-b110a69c8a07
I'm using MSVC 2008 under Vista x64. I decided to just change "#include "afxres.h" " to "#include "windows.h" " in "IL.rc" And we again keep our fingers crossed and hit compile.
6) error PRJ0019: A tool returned an error code from "Performing Post-Build Event..."
(1 Error / 5 warnings)
It seems we are close, with the .dll being created but some "postwork" trying to copy the file back to windows directory on C:\.
For myself my instinct is to close Visual Studio and restart with "Run as Administrator" enabled, and recompile.....Thankfully you should always trust your instincts... :)
7) Build: 1 succeeded, " DevIL.dll output "
(0 Errors / 5 Warnings)
Success at last, well it's wasn't the easiest library to compile under Windows, and we still have some issues to overcome. This was a 32bit debug build, my aim is to compile a release x64 version. I also need to add PNG, JPEG and TIFF support to be able to use it in my own project, and this was just DevIL.dll, ILU (Utility) and ILUT (Utility Toolkit) also needs to be built.
Would also like to do some more testing with "config.h" "il.h" and "ilu.h" and disabling and enabling some defines for things like OGL/DX or SSE for example to see if perhaps some performance, memory and file sizes can be improved.
It seems issues 5 and 6 are issues Microsoft needs to think of rather than myself, and more investigation should be made from myself on issue 6 in particular as to why this error occurs, and why Microsoft have not documented this in more detail.
8) fatal error C1083: Cannot open source file: '..\src\ilut_directxm.c': No such file or directory
If we continue to build both other projects in the solution, ILU and ILUT, we see that ILU builds without any further complication, ILUT on the other hand does not. The above error, seems to caused by another missing file(s), in this case it seems DX10 features.
9) fatal error C1083: Cannot open source file: '..\src\ilut_directx10.c': No such file or directory
I did end up manually copying the file "ilut_directx9.c" and renamed and copied it back to the ILUT source directory with the above names. This allows a compile, but commenting out the define of DX10 in "ilut.h" solved the issues more precisely and allows all 3 libraries to be built, minus DX10 support. Or loading the DX10 SDK would also be another way around the issue.
Meanwhile, It's now time to attempt a Windows x64 build as it's my priority in this case.
10) LINK : fatal error LNK1181: cannot open input file 'lcms.lib'
"lcms.lib" "libtiff.lib" "libpng.lib" had to be removed from my project linker settings. Ideally i would of just copied and made them after i had compiled all 3 in 32bit (which i have now) So this error may be specific to not just 64bit, but to me personally. I will confirm at a later date
11) Build: 3 succeeded - 32/64bit libs/dll files for DevIL/ILU/ILUT are now compiled.
(0 Errors / 3 Warnings)
It would seem just png, tiff, and jpeg support needed to be added to my 64bit build, and then hopefully some optimizations before testing, implementing and integrating DevIL into my Qt GUI code. Also note that the examples files like OGL need both freeglut and glut lib's compiled before use or undefined references when linking will be found.
After downloading and unzipping DevIL 1.78 Windows SDK, load the project into MSVC, and hit compile.
1) fatal error C1083: Cannot open include file: 'IL/config.h': No such file or directory.
(9 Errors /0 Warnings)
It would seem that DevIL uses some "configure.bat" to configure the appropriate options for "config.h.in" and should output "config.h" otherwise we get the above error.
As I'm new to 3rd party library compiling under MSVC, it would be nice to have a readme that explains in depth what is meant to happen at this stage. Configure.bat returns a "file not found" error in either a DOS box, or MSVC console. Over the last few days i have compiled Qt and Freeimage, Freeglut, etc without any such manually hacking or guess work. Regardless i manually change "config.h.in" to be "config.h" and rebuild.
As I'm not aware if the makefiles are even useful for MSVC, and if they are Nmake compatible, as there is no "Autoconf" for windows only GNU, and Cygwin to my knowledge.
http://www.adp-gmbh.ch/misc/tools/configure/configure_in.html
http://en.wikipedia.org/wiki/GNU_build_system
2) fatal error C1083: Cannot open include file: 'png.h': No such file or directory
(9 Errors / 3 Warnings)
It seems DevIL does not come with the external libraries used for many of the included file types. These must be manually downloaded all individually and not packaged with the main download. This does mean a lot more manual searching, configuration and editing files. There is a "libraries.txt" file that does relate this information, however the link for uncompiled sources is not current, and i have no easy way to grab them all in one package. http://openil.sourceforge.net/libs/LibSrc.zip -Non valid link:
Previously i downloaded just the TiffLib source files from the respective webpage, and had several more issues to solve with just the inclusion of libtiff and DevIL.
I will comment out the 3rd party libraries like Jpeg and TIFF etc, for the time being and rebuild.
3) fatal error C1083: Cannot open source file: '..\src\il_utx.c': No such file or directory\
(2 Errors / 3 Warnings)
Despite my fingers being crossed, another issue arises.... The file "il_utx.c" does not appear in the SDK. There is however a "il_utx.cpp" which is one of only two ".cpp" files in the directory, the rest are all ".c" files.. So i again manually rename the file to suit, but at this stage I start to wonder if this SDK is Windows friendly at all.
If i manually rename the file to "il_utx.c" i then get 100's of errors in cstdio and cstring. So I made a "#define IL_NO_UTX" in "IL.h" and this solved the issue, albeit with another less important image file type down from the list.
4) fatal error C1083: Cannot open include file: 'WMPGlue.h': No such file or directory
(1 Error / 3 Warnings)
It appears that another image library for Microsoft HDPhoto is included, but has been designed to throw an error because it's not LGPL compatible like the others. I'm not sure it should really be included in the package for those reasons.
So again we make another define in "IL.h" to remove support for it. (sigh)
5) fatal error RC1015: cannot open include file 'afxres.h'
(1 Error / 3 Warnings)
I don't have any reference to this file in my MSVC build or the SDK, however it does appear in a CodeBlocks Mingw install i have. But i do question why it's looking for "afxres.h" at all with the relevant Windows SDK. I can try to manually copy the file from mingw, but I'm not hopeful if 'afxres.h' references other libraries and such.
Interestingly the error is made in "IL.rc" i don't usually use such files, but i believe it's autogenerated resource file made when compiling. I vaguely remember them from Windows GUI projects. But i assume their is no interface for DevIL.
So i believe this could be a Microsoft issue. A google search seems to reveal it could be an MSVC configuration issue within MSVC. My question is why is MSVC 2008 giving such an error and asking for a file that isn't in my Visual Studio install? http://social.msdn.microsoft.com/Forums/en-US/Vsexpressvc/thread/d3480ee3-d880-4431-9264-b110a69c8a07
I'm using MSVC 2008 under Vista x64. I decided to just change "#include "afxres.h" " to "#include "windows.h" " in "IL.rc" And we again keep our fingers crossed and hit compile.
6) error PRJ0019: A tool returned an error code from "Performing Post-Build Event..."
(1 Error / 5 warnings)
A closer look at the build log confirms my suspicions. The system root\system32 is not being given valid access by MSVC, due to Vista's stupidity, err security. It would be nice if MSVC was as clever to tell me simply access denied. Looking at google again, we see that being able to disable the postprocess of the compiler and possibly work around the issue. http://social.msdn.microsoft.com/Forums/en-US/vssmartdevicesvbcs/thread/df48e5f6-7a3a-49a6-a797-0983f710a6e4copy d:\Development\DevIL\lib\vc9\x86\debug\DevIL.dll %SYSTEMROOT%\system32
if errorlevel 1 goto VCReportError
goto VCEnd
:VCReportError
echo Project : error PRJ0019: A tool returned an error code from "Performing Post-Build Event...
For myself my instinct is to close Visual Studio and restart with "Run as Administrator" enabled, and recompile.....Thankfully you should always trust your instincts... :)
7) Build: 1 succeeded, " DevIL.dll output "
(0 Errors / 5 Warnings)
Success at last, well it's wasn't the easiest library to compile under Windows, and we still have some issues to overcome. This was a 32bit debug build, my aim is to compile a release x64 version. I also need to add PNG, JPEG and TIFF support to be able to use it in my own project, and this was just DevIL.dll, ILU (Utility) and ILUT (Utility Toolkit) also needs to be built.
Would also like to do some more testing with "config.h" "il.h" and "ilu.h" and disabling and enabling some defines for things like OGL/DX or SSE for example to see if perhaps some performance, memory and file sizes can be improved.
It seems issues 5 and 6 are issues Microsoft needs to think of rather than myself, and more investigation should be made from myself on issue 6 in particular as to why this error occurs, and why Microsoft have not documented this in more detail.
8) fatal error C1083: Cannot open source file: '..\src\ilut_directxm.c': No such file or directory
If we continue to build both other projects in the solution, ILU and ILUT, we see that ILU builds without any further complication, ILUT on the other hand does not. The above error, seems to caused by another missing file(s), in this case it seems DX10 features.
9) fatal error C1083: Cannot open source file: '..\src\ilut_directx10.c': No such file or directory
I did end up manually copying the file "ilut_directx9.c" and renamed and copied it back to the ILUT source directory with the above names. This allows a compile, but commenting out the define of DX10 in "ilut.h" solved the issues more precisely and allows all 3 libraries to be built, minus DX10 support. Or loading the DX10 SDK would also be another way around the issue.
Meanwhile, It's now time to attempt a Windows x64 build as it's my priority in this case.
10)
"lcms.lib" "libtiff.lib" "libpng.lib" had to be removed from my project linker settings. Ideally i would of just copied and made them after i had compiled all 3 in 32bit (which i have now) So this error may be specific to not just 64bit, but to me personally. I will confirm at a later date
(0 Errors / 3 Warnings)
It would seem just png, tiff, and jpeg support needed to be added to my 64bit build, and then hopefully some optimizations before testing, implementing and integrating DevIL into my Qt GUI code. Also note that the examples files like OGL need both freeglut and glut lib's compiled before use or undefined references when linking will be found.
Content is really helpful. For further support you can contact our Toll free number:+1-845-481-1722 or you can directly visit to our website:https://setup-microsoft-office.com/.
ReplyDelete