#下载
wget http://downloads.sourceforge.net/freeimage/FreeImage3170.zip
#解压
unzip FreeImage3170.zip -d freeImage
#进入文件编译
cd /freeImage/FreeImage
make
报错:
make[1]: *** [Makefile.gnu:64: Source/LibRawLite/./internal/dcraw_common.o] Error 1
make[1]: Leaving directory '/home/lipinhao/cudnn_samples_v8/mnistCUDNN/freeImage/FreeImage'
make: *** [Makefile:21: default] Error 2
看具体错误信息
在目录中找到该文件:/freeImage/FreeImage/Source/LibRawLite/internal/dcraw_common.cpp
打开dcraw_common.cpp,在4522-4544段看到:
static const signed char *cp, terms[] = {
-2,-2,+0,-1,0,0x01, -2,-2,+0,+0,1,0x01, -2,-1,-1,+0,0,0x01,
-2,-1,+0,-1,0,0x02, -2,-1,+0,+0,0,0x03, -2,-1,+0,+1,1,0x01,
-2,+0,+0,-1,0,0x06, -2,+0,+0,+0,1,0x02, -2,+0,+0,+1,0,0x03,
-2,+1,-1,+0,0,0x04, -2,+1,+0,-1,1,0x04, -2,+1,+0,+0,0,0x06,
-2,+1,+0,+1,0,0x02, -2,+2,+0,+0,1,0x04, -2,+2,+0,+1,0,0x04,
-1,-2,-1,+0,0,0x80, -1,-2,+0,-1,0,0x01, -1,-2,+1,-1,0,0x01,
-1,-2,+1,+0,1,0x01, -1,-1,-1,+1,0,0x88, -1,-1,+1,-2,0,0x40,
-1,-1,+1,-1,0,0x22, -1,-1,+1,+0,0,0x33, -1,-1,+1,+1,1,0x11,
-1,+0,-1,+2,0,0x08, -1,+0,+0,-1,0,0x44, -1,+0,+0,+1,0,0x11,
-1,+0,+1,-2,1,0x40, -1,+0,+1,-1,0,0x66, -1,+0,+1,+0,1,0x22,
-1,+0,+1,+1,0,0x33, -1,+0,+1,+2,1,0x10, -1,+1,+1,-1,1,0x44,
-1,+1,+1,+0,0,0x66, -1,+1,+1,+1,0,0x22, -1,+1,+1,+2,0,0x10,
-1,+2,+0,+1,0,0x04, -1,+2,+1,+0,1,0x04, -1,+2,+1,+1,0,0x04,
+0,-2,+0,+0,1,0x80, +0,-1,+0,+1,1,0x88, +0,-1,+1,-2,0,0x40,
+0,-1,+1,+0,0,0x11, +0,-1,+2,-2,0,0x40, +0,-1,+2,-1,0,0x20,
+0,-1,+2,+0,0,0x30, +0,-1,+2,+1,1,0x10, +0,+0,+0,+2,1,0x08,
+0,+0,+2,-2,1,0x40, +0,+0,+2,-1,0,0x60, +0,+0,+2,+0,1,0x20,
+0,+0,+2,+1,0,0x30, +0,+0,+2,+2,1,0x10, +0,+1,+1,+0,0,0x44,
+0,+1,+1,+2,0,0x10, +0,+1,+2,-1,1,0x40, +0,+1,+2,+0,0,0x60,
+0,+1,+2,+1,0,0x20, +0,+1,+2,+2,0,0x10, +1,-2,+1,+0,0,0x80,
+1,-1,+1,+1,0,0x88, +1,+0,+1,+2,0,0x08, +1,+0,+2,-1,0,0x40,
+1,+0,+2,+1,0,0x10
}, chood[] = { -1,-1, -1,0, -1,+1, 0,+1, +1,+1, +1,0, +1,-1, 0,-1 };
将上一段替换为:
static const signed char *cp, terms[] = {
-2,-2,+0,-1,0,(char)0x01, -2,-2,+0,+0,1,(char)0x01, -2,-1,-1,+0,0,(char)0x01,
-2,-1,+0,-1,0,(char)0x02, -2,-1,+0,+0,0,(char)0x03, -2,-1,+0,+1,1,(char)0x01,
-2,+0,+0,-1,0,(char)0x06, -2,+0,+0,+0,1,(char)0x02, -2,+0,+0,+1,0,(char)0x03,
-2,+1,-1,+0,0,(char)0x04, -2,+1,+0,-1,1,(char)0x04, -2,+1,+0,+0,0,(char)0x06,
-2,+1,+0,+1,0,(char)0x02, -2,+2,+0,+0,1,(char)0x04, -2,+2,+0,+1,0,(char)0x04,
-1,-2,-1,+0,0,(char)0x80, -1,-2,+0,-1,0,(char)0x01, -1,-2,+1,-1,0,(char)0x01,
-1,-2,+1,+0,1,(char)0x01, -1,-1,-1,+1,0,(char)0x88, -1,-1,+1,-2,0,(char)0x40,
-1,-1,+1,-1,0,(char)0x22, -1,-1,+1,+0,0,(char)0x33, -1,-1,+1,+1,1,(char)0x11,
-1,+0,-1,+2,0,(char)0x08, -1,+0,+0,-1,0,(char)0x44, -1,+0,+0,+1,0,(char)0x11,
-1,+0,+1,-2,1,(char)0x40, -1,+0,+1,-1,0,(char)0x66, -1,+0,+1,+0,1,(char)0x22,
-1,+0,+1,+1,0,(char)0x33, -1,+0,+1,+2,1,(char)0x10, -1,+1,+1,-1,1,(char)0x44,
-1,+1,+1,+0,0,(char)0x66, -1,+1,+1,+1,0,(char)0x22, -1,+1,+1,+2,0,(char)0x10,
-1,+2,+0,+1,0,(char)0x04, -1,+2,+1,+0,1,(char)0x04, -1,+2,+1,+1,0,(char)0x04,
+0,-2,+0,+0,1,(char)0x80, +0,-1,+0,+1,1,(char)0x88, +0,-1,+1,-2,0,(char)0x40,
+0,-1,+1,+0,0,(char)0x11, +0,-1,+2,-2,0,(char)0x40, +0,-1,+2,-1,0,(char)0x20,
+0,-1,+2,+0,0,(char)0x30, +0,-1,+2,+1,1,(char)0x10, +0,+0,+0,+2,1,(char)0x08,
+0,+0,+2,-2,1,(char)0x40, +0,+0,+2,-1,0,(char)0x60, +0,+0,+2,+0,1,(char)0x20,
+0,+0,+2,+1,0,(char)0x30, +0,+0,+2,+2,1,(char)0x10, +0,+1,+1,+0,0,(char)0x44,
+0,+1,+1,+2,0,(char)0x10, +0,+1,+2,-1,1,(char)0x40, +0,+1,+2,+0,0,(char)0x60,
+0,+1,+2,+1,0,(char)0x20, +0,+1,+2,+2,0,(char)0x10, +1,-2,+1,+0,0,(char)0x80,
+1,-1,+1,+1,0,(char)0x88, +1,+0,+1,+2,0,(char)0x08, +1,+0,+2,-1,0,(char)0x40,
+1,+0,+2,+1,0,(char)0x10
}, chood[] = { -1,-1, -1,0, -1,+1, 0,+1, +1,+1, +1,0, +1,-1, 0,-1 };
同时将6940行错误:
6940 | LensData+9]>>2) * powf64(4, (table_buf[iLensData+9] & 0x03)-2);
改为:
LensData+9]>>2) * powf64(4.f, (table_buf[iLensData+9] & 0x03)-2);
将7812行的错误:
7812 | LensData+9]>>2) * powf64(4, (table_buf[iLensData+9] & 0x03)-2);
改为
LensData+9]>>2) * powf64(4.f, (table_buf[iLensData+9] & 0x03)-2));
make:
make
报错:
Source/LibWebP/./src/dsp/dsp.upsampling_mips_dsp_r2.c:37:34: error: invalid character ' ' in raw string delimiter
"shll_s.w %["#R"], %["#R"], 9 \n\t" \
^
Source/LibWebP/./src/dsp/dsp.upsampling_mips_dsp_r2.c:37:48: error: invalid character ' ' in raw string delimiter
"shll_s.w %["#R"], %["#R"], 9 \n\t" \
^
Source/LibWebP/./src/dsp/dsp.upsampling_mips_dsp_r2.c:40:34: error: invalid character ' ' in raw string delimiter
"precrqu_s.qb.ph %["#R"], %["#R"], $zero \n\t" \
^
Source/LibWebP/./src/dsp/dsp.upsampling_mips_dsp_r2.c:40:48: error: invalid character ' ' in raw string delimiter
"precrqu_s.qb.ph %["#R"], %["#R"], $zero \n\t" \
^
Source/LibWebP/./src/dsp/dsp.upsampling_mips_dsp_r2.c:43:34: error: invalid character ' ' in raw string delimiter
"srl %["#R"], %["#R"], 24 \n\t" \
^
Source/LibWebP/./src/dsp/dsp.upsampling_mips_dsp_r2.c:43:48: error: invalid character ' ' in raw string delimiter
"srl %["#R"], %["#R"], 24 \n\t" \
^
make[1]: *** [Makefile.gnu:61: Source/LibWebP/./src/dsp/dsp.upsampling_mips_dsp_r2.o] Error 1
make[1]: Leaving directory '/home/lipinhao/cudnn_samples_v8/mnistCUDNN/freeImage/FreeImage'
make: *** [Makefile:21: default] Error 2
找到文件:/freeImage/FreeImage/Source/LibWebP/src/dsp/dsp.upsampling_mips_dsp_r2.c
将24-45段中的R换成Red, 对齐格式,具体为,将下段:
#define YUV_TO_RGB(Y, U, V, R, G, B) do { \
const int t1 = kYScale * Y; \
const int t2 = kVToG * V; \
R = kVToR * V; \
G = kUToG * U; \
B = kUToB * U; \
R = t1 + R; \
G = t1 - G; \
B = t1 + B; \
R = R + kRCst; \
G = G - t2 + kGCst; \
B = B + kBCst; \
__asm__ volatile ( \
"shll_s.w %["#Red"], %["#Red"], 9 \n\t" \
"shll_s.w %["#R"], %["#R"], 9 \n\t" \
"shll_s.w %["#G"], %["#G"], 9 \n\t" \
"shll_s.w %["#B"], %["#B"], 9 \n\t" \
"precrqu_s.qb.ph %["#R"], %["#R"], $zero \n\t" \
"precrqu_s.qb.ph %["#G"], %["#G"], $zero \n\t" \
"precrqu_s.qb.ph %["#B"], %["#B"], $zero \n\t" \
"srl %["#R"], %["#R"], 24 \n\t" \
"srl %["#G"], %["#G"], 24 \n\t" \
"srl %["#B"], %["#B"], 24 \n\t" \
: [Red]"+r"(Red), [G]"+r"(G), [B]"+r"(B) \
: \
); \
} while (0)
改为:
#define YUV_TO_RGB(Y, U, V, Red, G, B) do { \
const int t1 = kYScale * Y; \
const int t2 = kVToG * V; \
Red = kVToR * V; \
G = kUToG * U; \
B = kUToB * U; \
Red = t1 + Red; \
G = t1 - G; \
B = t1 + B; \
Red = Red + kRCst; \
G = G - t2 + kGCst; \
B = B + kBCst; \
__asm__ volatile ( \
"shll_s.w %["#Red"], %["#Red"], 9 \n\t" \
"shll_s.w %["#G"], %["#G"], 9 \n\t" \
"shll_s.w %["#B"], %["#B"], 9 \n\t" \
"precrqu_s.qb.ph %["#Red"], %["#Red"], $zero \n\t" \
"precrqu_s.qb.ph %["#G"], %["#G"], $zero \n\t" \
"precrqu_s.qb.ph %["#B"], %["#B"], $zero \n\t" \
"srl %["#Red"], %["#Red"], 24 \n\t" \
"srl %["#G"], %["#G"], 24 \n\t" \
"srl %["#B"], %["#B"], 24 \n\t" \
: [Red]"+r"(Red), [G]"+r"(G), [B]"+r"(B) \
: \
); \
} while (0)
同样在/freeImage/FreeImage/Source/LibWebP/./src/dsp/dsp.yuv_mips_dsp_r2.c中,将第57行
"sb %[temp5], "#R"(%[dst]) \n\t" \
改为:
"sb %[temp5], "#Red"(%[dst]) \n\t" \
make
sudo make install