有很多人发现还是无法compile,特此更正几点注意事项:
1,如果你要build 64bit的ijl,请安装Intel IPP em64t版本,譬如w_ipp_em64t_p_6.0.0.130.exe、w_ipp_em64t_p_6.0.2.074.exe,只是不同的版本。
2,需要安装Intel compiler 或者 Visual Studio,VS默认支持的版本包括 VS2003、VS2005、VS2008,如果不是这些版本,可以通过修改env来支持
譬如需要支持VS2010,需要新增修改的几个文件,下面给出一个sample,支持VS2005、VS2008、VS2010进行build。
(sample path为 ipp-samples\image-codecs\jpeg-ijl )
a) 新增 buildem64t.bat,路径 ipp-samples\image-codecs\jpeg-ijl\
@echo off rem rem INTEL CORPORATION PROPRIETARY INFORMATION rem This software is supplied under the terms of a license agreement or rem nondisclosure agreement with Intel Corporation and may not be copied rem or disclosed except in accordance with the terms of that agreement. rem Copyright(c) 2007-2008 Intel Corporation. All Rights Reserved. rem cls REM REM Usage: REM build{32|64|em64t}.bat [ cl7 | cl8 | cl9 | cl10 | icl101 | icl110 ] REM :::::::::::::::::: setlocal set ARG=%1 @CALL:GET_VARS @%HEADER% @%GET_ENVIRONMENT% nmake clean ARCH=%ARCH% nmake ARCH=%ARCH% CC=%COMPILER% LINKAGE="dynamic" @%FOOTER% endlocal GOTO:EOF :::::::::::::::::::: :GET_VARS set SCRIPT=%~n0 set ENV_FILE=env.bat SET PLTF=%SCRIPT:build=% SET ARCH=win%PLTF% IF "%PLTF%" == "32" SET ARCH_C= IF "%PLTF%" == "64" SET ARCH_C=64 IF "%PLTF%" == "em64t" SET ARCH_C=em64t SET x=%~d0%~p0 SET y=%x:\ipp-samples\=*% FOR /F "tokens=1 delims=*" %%i IN ("%y%") DO SET SAMPLES_ROOT=%%i\ipp-samples\ SET HEADER=CALL "%SAMPLES_ROOT%\tools\env\tools" TYPE_HEADER SET FOOTER=CALL "%SAMPLES_ROOT%\tools\env\tools" TYPE_FOOTER SET GET_ENVIRONMENT=PUSHD "%SAMPLES_ROOT%\tools\env" ^& CALL %ENV_FILE% ^& POPD EXIT /B
b) 新增 winem64t.ini,路径 ipp-samples\image-codecs\jpeg-ijl\
#!INCLUDE <win32.mak> LIB_ARCH = em64t LINK_ARCH = AMD64
c) 修改 env.bat,路径 ipp-samples\tools\env\
@echo off rem rem INTEL CORPORATION PROPRIETARY INFORMATION rem This software is supplied under the terms of a license agreement or rem nondisclosure agreement with Intel Corporation and may not be copied rem or disclosed except in accordance with the terms of that agreement. rem Copyright(c) 2007-2008 Intel Corporation. All Rights Reserved. rem rem rem Usage: rem This scipt has to be called from sample's build*.bat files rem :::::::::::::::::::: set IPPVER=6.0 :::::::::::::::::::: For /F "delims=;." %%i IN ('Cmd /c Ver') DO ( IF "%%i"=="Microsoft Windows XP [Version 5" ( SET vsdk_arg=/xp ) ELSE IF "%%i"=="Microsoft Windows [Version 5" ( SET vsdk_arg=/2003 ) ELSE IF "%%i"=="Microsoft Windows [Version 6" ( SET vsdk_arg=/vista ) ELSE ( SET vsdk_arg=/vista ) ) set PrF=%ProgramFiles% set IPP_CPU_TYPE=%PROCESSOR_ARCHITECTURE% if /I "%PROCESSOR_ARCHITECTURE%"=="x86" if defined PROCESSOR_ARCHITEW6432 set IPP_CPU_TYPE=%PROCESSOR_ARCHITEW6432% if /I "%PROCESSOR_ARCHITECTURE%"=="x86" if defined PROCESSOR_ARCHITEW6432 set PrF=%ProgramFiles(x86)% if /I "%PROCESSOR_ARCHITECTURE%"=="AMD64" set PrF=%ProgramFiles(x86)% set ProComp=%ProgramFiles(x86)% if /I "%PROCESSOR_ARCHITECTURE%"=="x86" set ProComp=%ProgramFiles% if "%ARCH%" == "win32" ( set AR=IA32 set vsdk_opt="/x86 %vsdk_arg%" set MSAR=vcvars32.bat set icl_opt=ia32 ) if "%ARCH%" == "win64" ( set AR=Itanium set MSAR=x86_ia64\vcvarsx86_ia64.bat if "%PROCESSOR_ARCHITECTURE%"=="IA64" set MSAR=ia64\vcvarsia64.bat set vsdk_opt="/ia64 %vsdk_arg%" set sdk_opt="/SRV64 /RETAIL" set icl_opt=ia32_ia64 if "%IPP_CPU_TYPE%"=="IA64" set icl_opt=ia64 ) if "%ARCH%" == "winem64t" ( set AR=EM64T set MSAR=x86_amd64\vcvarsx86_amd64.bat if "%PROCESSOR_ARCHITECTURE%"=="AMD64" set MSAR=amd64\vcvars64.bat set vsdk_opt="/x64 %vsdk_arg%" set sdk_opt="/X64 /RETAIL" set icl_opt=ia32_intel64 if "%IPP_CPU_TYPE%"=="AMD64" set icl_opt=intel64 if "%ARG%"=="ipc2009" set icl_opt=ia32_intel64 ) if "%ARCH%" == "winwceixp" ( set AR=IXP SET LINKAGE=static SET ARG=clarm ) if "%ARCH%" == "winwcex86" ( set AR=IA32 SET LINKAGE=static SET ARG=ecl ) if not defined AR ( @call :ERR "Invalid %AR% Architecture configuration" GOTO:EOF ) @echo +++ %AR% architecture is picked out. rem Definition of custom environment set __EXTERN_TOOL=extern_tools_%AR%.bat if exist %__EXTERN_TOOL% ( @call %__EXTERN_TOOL% goto setenv ) @call search_compilers :setenv @call %TOOL% %icl_opt% if not defined IPPROOT goto try2find set IPPENVF="%IPPROOT%\tools\env\ippenv%ARCH_C%.bat" if not exist %IPPENVF% ( @call :WRN "Custom environment for IPP %AR% is not found." goto try2find ) set IPPVER=custom set IPPENV=%IPPENVF% set IPPCUSTOM=OK set lib=%IPPROOT%\lib;%IPPROOT%\stublib;%lib% set include=%IPPROOT%\include;%include% set path=%IPPROOT%\bin;%path% @echo +++ Custom Intel(R) IPP %IPPVER% environment is found at %IPPENV% goto:eof :try2find for /F %%i in ( 'dir /b /on "%ProgramFiles%\Intel\IPP\%IPPVER%*"') do ( set IPPENVF="%ProgramFiles%\Intel\IPP\%%i\%AR%\tools\env\ippenv%ARCH_C%.bat" ) if exist %IPPENVF% ( set IPPENV=%IPPENVF% & goto begin ) for /F %%i in ( 'dir /b /on "%ProgramFiles(x86)%\Intel\IPP\%IPPVER%*"') do ( set IPPENVF="%ProgramFiles(x86)%\Intel\IPP\%%i\%AR%\tools\env\ippenv%ARCH_C%.bat" ) if exist %IPPENVF% (set IPPENV=%IPPENVF% & goto begin) @call :WRN "Default IPP %IPPVER% environment for %AR% is not found." exit /b 1 :begin @echo +++ Default Intel(R) IPP %IPPVER% environment is found at %IPPENV% @call %IPPENV% goto :eof :ERR @echo --- @echo --- ERROR: %~1 @echo --- exit /b -1 :WRN @echo *** @echo *** WARNING: %~1 @echo *** exit /b -1
d) 修改 search_compilers.bat,路径 ipp-samples\tools\env\
@echo off rem rem INTEL CORPORATION PROPRIETARY INFORMATION rem This software is supplied under the terms of a license agreement or rem nondisclosure agreement with Intel Corporation and may not be copied rem or disclosed except in accordance with the terms of that agreement. rem Copyright(c) 2007-2008 Intel Corporation. All Rights Reserved. rem set _WIN32_WINNT=0x0501 @if "%ARG%"=="" goto waterfall if "%COMP_TYPE%" == "fortran" ( if not "%ARG%" == "ifort110" if not "%ARG%" == "ifort101" if not "%ARG%" == "ifort10" if not "%ARG%" == "ifort9" ( set ARG= goto waterfall ) ) @if "%ARG%"=="ifort110" @CALL :SET_INTEL_ENV_PRO 11.0 @if "%ARG%"=="ifort101" @CALL :SET_INTEL_FOR_ENV 10.1 @if "%ARG%"=="ifort10" @CALL :SET_INTEL_FOR_ENV 10.0 @if "%ARG%"=="ifort9" @CALL :SET_INTEL_FOR_ENV 9.1 @if "%ARG%"=="icl110" @CALL :SET_INTEL_ENV_PRO 11.0 @if "%ARG%"=="icl101" @CALL :SET_INTEL_ENV 10.1 @if "%ARG%"=="icl10" @CALL :SET_INTEL_ENV 10.0 @if "%ARG%"=="icl91" @CALL :SET_INTEL_ENV 9.1 @if "%ARG%"=="cl10" @CALL :SET_VS10_ENV %vsdk_opt% @if "%ARG%"=="cl9" @CALL :SET_VS9_ENV %vsdk_opt% @if "%ARG%"=="cl8" @CALL :SET_VS8_ENV %vsdk_opt% @if "%ARG%"=="cl7" @CALL :SET_VS7_ENV %sdk_opt% @if "%ARG%"=="clarm" @CALL :SET_WCE500_TOOLS @if "%ARG%"=="ecl" @CALL :SET_WCE500_TOOLS @if "%ARG%"=="ipc2009" @CALL :SET_INTEL_PC 2009 @if defined TOOL (set COMP=%ARG%&goto:eof) @CALL :ERR "Compiler "%ARG%" environment is not found" goto:eof :waterfall if "%COMP_TYPE%" == "fortran" ( @CALL :SET_INTEL_ENV_PRO 11.0 @if not defined TOOL @CALL :SET_INTEL_FOR_ENV 10.1 @if not defined TOOL @CALL :SET_INTEL_FOR_ENV 10.0 @if not defined TOOL @CALL :SET_INTEL_FOR_ENV 9.1 @if not defined TOOL @CALL :ERR "Intel Fortran environment not found" goto:eof ) @if not defined TOOL ( set COMP=icl110 @CALL :SET_INTEL_ENV_PRO 11.0 ) @if not defined TOOL ( set COMP=icl101 @CALL :SET_INTEL_ENV 10.1 ) @if not defined TOOL ( set COMP=icl10 @CALL :SET_INTEL_ENV 10.0 ) @if not defined TOOL ( set COMP=icl91 @CALL :SET_INTEL_ENV 9.1 ) @if not defined TOOL ( set COMP=cl10 @CALL :SET_VS10_ENV %sdk_opt% ) @if not defined TOOL ( set COMP=cl9 @CALL :SET_VS9_ENV %sdk_opt% ) @if not defined TOOL ( set COMP=cl8 @CALL :SET_VS8_ENV %vsdk_opt% ) @if not defined TOOL ( set COMP=cl7 @CALL :SET_VS7_ENV %sdk_opt% ) @if defined TOOL goto:eof @CALL :ERR "No any valid compiler environment found" goto:eof :::::::::::::::::::::::: :SET_INTEL_ENV_PRO set COMPILER=icl.exe if "%COMP_TYPE%" == "fortran" set COMPILER=ifort.exe set ptn= dir /B /ON "%ProComp%\Intel\Compiler\%1\*" @%ptn% 2>NUL 1>&2 if "%errorlevel%"=="0" for /F "usebackq" %%i in (`%ptn%`) do set LASTVERSION=%%i set ENV="%ProComp%\Intel\Compiler\%1\%LASTVERSION%\cpp\bin\iclvars.bat" if "%COMP_TYPE%" == "fortran" set ENV="%ProComp%\Intel\Compiler\%1\%LASTVERSION%\fortran\bin\ifortvars.bat" if exist %ENV% ( set TOOL=%ENV% @echo +++ Intel Pro Compiler v.%LASTVERSION% for %AR% is taken exit /b ) echo --- Intel Pro Compiler %ARG% for %AR% environment is not found. exit /b 1 :::::::::::::::::::::::: :SET_INTEL_ENV set COMPILER=icl.exe set ptn= dir /B /ON "%PrF%\Intel\Compiler\C++\%1.*" @%ptn% 2>NUL 1>&2 if "%errorlevel%"=="0" for /F "usebackq" %%i in (`%ptn%`) do set LASTVERSION=%%i set ENV="%PrF%\Intel\Compiler\C++\%LASTVERSION%\%AR%\Bin\iclvars.bat" if exist %ENV% ( set TOOL=%ENV% @echo +++ Intel C++ Compiler v.%LASTVERSION% for %AR% is taken exit /b ) echo --- Intel C++ Compiler %ARG% for %AR% environment is not found. exit /b 1 :::::::::::::::::::::::: :SET_INTEL_PC set COMPILER=icl.exe set ENV="%PrF%\Intel\Parallel Studio\Composer\bin\iclvars.bat" if not exist %ENV% set ENV="%PrF%\Intel\Composer\%1\bin\iclvars.bat" if exist %ENV% ( set TOOL=%ENV% @echo +++ Intel Composer %1 for %AR% is taken exit /b ) echo --- Intel Composer %1 for %AR% environment is not found. exit /b 1 ::::::::::::::::::::::::: :SET_VS10_ENV set COMPILER=cl.exe set _WIN32_WINNT=0x0502 set ENV="%VS100COMNTOOLS%\..\..\vc\bin\%MSAR%" @echo ENV is %ENV% if exist %ENV% ( set TOOL=%ENV% @echo +++ Microsoft Visual Studio 2010 compiler for %AR% is taken exit /b ) set ENV="%ProgramFiles%\Microsoft SDKs\windows\v6.0\bin\setenv.cmd" if defined ProgramW6432 set ENV="%ProgramW6432%\Microsoft SDKs\windows\v6.0\bin\setenv.cmd" if exist %ENV% ( @echo +++ Microsoft Vista SDK v6.0 is taken set VistaSDK=yes set TOOL=%ENV% %~1 exit /b ) echo --- Microsoft Visual Studio 2010 environment is not found. exit /b 1 ::::::::::::::::::::::::: :SET_VS9_ENV set COMPILER=cl.exe set _WIN32_WINNT=0x0502 set ENV="%VS90COMNTOOLS%\..\..\vc\bin\%MSAR%" if exist %ENV% ( set TOOL=%ENV% @echo +++ Microsoft Visual Studio 2008 compiler for %AR% is taken exit /b ) set ENV="%ProgramFiles%\Microsoft SDKs\windows\v6.0\bin\setenv.cmd" if defined ProgramW6432 set ENV="%ProgramW6432%\Microsoft SDKs\windows\v6.0\bin\setenv.cmd" if exist %ENV% ( @echo +++ Microsoft Vista SDK v6.0 is taken set VistaSDK=yes set TOOL=%ENV% %~1 exit /b ) echo --- Microsoft Visual Studio 2008 environment is not found. exit /b 1 :SET_VS8_ENV set COMPILER=cl.exe set ENV="%VS80COMNTOOLS%\..\..\vc\bin\%MSAR%" if exist %ENV% ( set TOOL=%ENV% @echo +++ Microsoft Visual Studio 2005 compiler for %AR% is taken exit /b ) set ENV="%ProgramFiles%\Microsoft SDKs\windows\v6.0\bin\setenv.cmd" if defined ProgramW6432 set ENV="%ProgramW6432%\Microsoft SDKs\windows\v6.0\bin\setenv.cmd" if exist %ENV% ( @echo +++ Microsoft Vista SDK v6.0 is taken set VistaSDK=yes set TOOL=%ENV% %~1 exit /b ) echo --- Microsoft Visual Studio 2005 environment is not found. exit /b 1 :SET_VS7_ENV set COMPILER=cl.exe if not "%AR%" == "IA32" goto sdk set ENV="%VS71COMNTOOLS%\vsvars32.bat" if exist %ENV% ( set TOOL=%ENV% @echo +++ Microsoft Visual Studio 2003 compiler is taken exit /b ) echo --- Microsoft Visual Studio 2003 environment is not found. exit /b 1 :sdk set ENV="%ProgramFiles%\Microsoft Platform SDK for Windows Server 2003 R2\setenv.cmd" if exist %ENV% ( @echo +++ Microsoft Platform SDK for Windows Server 2003 R2 is taken set TOOL=%ENV% %~1 exit /b ) set ENV="%ProgramFiles%\Microsoft Platform SDK\setenv.cmd" if exist %ENV% ( @echo +++ Microsoft Platform SDK is taken set TOOL=%ENV% %~1 exit /b ) set ENV="%ProgramFiles%\Microsoft Platform SDK\setenv.bat" if exist %ENV% ( @echo +++ Microsoft Platform SDK is taken set TOOL=%ENV% %~1 exit /b ) @echo --- MS Platform SDK is not found. exit /b 1 :::::::::::::::::::::::: :SET_INTEL_FOR_ENV set COMPILER=ifort.exe set ptn= dir /B /ON "%PrF%\Intel\Compiler\fortran\%1.*" @%ptn% 2>NUL 1>&2 if "%errorlevel%"=="0" for /F "usebackq" %%i in (`%ptn%`) do set LASTVERSION=%%i set ENV="%PrF%\Intel\Compiler\fortran\%LASTVERSION%\%AR%\Bin\ifortvars.bat" if exist %ENV% ( set TOOL=%ENV% @echo +++ Intel Fortran Compiler v.%LASTVERSION% for %AR% is taken set COMP=f%LASTVERSION% exit /b ) echo --- Intel Fortran Compiler %ARG% for %AR% environment is not found. exit /b 1 :SET_WCE500_TOOLS set COMPILER=%ARG% if exist %SDKROOT% goto pass_SDKROOT_SET set __SDK_TOUCH="C:\Program Files\Windows CE Tools\wce500\" if exist %__SDK_TOUCH% set SDKROOT=C:\Program Files\Windows CE Tools :pass_SDKROOT_SET set TOOL="%ProgramFiles%\Microsoft eMbedded C++ 4.0\EVC\wce500\bin\WCEARMV4I.BAT" if "%ARG%"=="ecl" ( set TOOL="%ProgramFiles%\Microsoft eMbedded C++ 4.0\EVC\wce500\bin\WCEx86.BAT" set COMPILER=cl ) @echo +++ Microsoft eMbedded C++ 4.0 for %AR% is taken exit /b ::::::::::::::::::::::: :ERR @echo --- @echo --- ERROR: %~1 @echo --- exit /b -1
上述修改完成后,可以在路径 ipp-samples\image-codecs\jpeg-ijl\ 下执行 buildem64t.bat,即可产生lib、dll文件。
------------------------------------------------------------------------------------
Ipp 6.0安装包,包括了ia32, em64t 以及 itanium。
而 ijl 2.0 (intel jpeg library) 则放在了sample中给出, 如果需要自己编译 ijl2.0, 则需要下载w_ipp-samples_p_6.0.0.130.zip, 解压缩后,在ipp-samples/image-codecs/jpeg-ijl/ 下可见 build32.bat
直接运行,可以编译生成 win32 (x86) 所需的 ijl20l.lib (静态链接所需库文件) 以及 ijl20.lib (动态链接所需库文件)
这里,需要介绍的是如何产生 win64 (x64) 所需的 ijl20l.lib 以及 ijl20.lib
参考其他目录下的编译文件,我们发现,编译文件 build32.bat 包括了各种编译器以及各种系统的情况, 所以无需修改此bat文件, 只需要修改与他在同一目录下的 win32.ini.
win32.ini:
#!INCLUDE <win32.mak>
LIB_ARCH =
LINK_ARCH = I386
而win64(x64),只需将其修改为 winem64t.ini
winem64t.ini:
#!INCLUDE <win32.mak>
LIB_ARCH = em64t
LINK_ARCH = AMD64
同时将 build32.bat 拷贝并重命名为 buildem64t.bat:
点击运行buildem64t.bat即可。
产生的lib 文件在 ipp-samples/image-codecs/jpeg-ijl/lib/ 目录下对应编译器类型的文件夹内