cd . && /home/zhl/cximage599c/admin/missing aclocal-1.4
WARNING: `aclocal-1.4' is needed, and you do not seem to have it handy on your
system. You might have modified some files without having the
proper tools for further handling them. Check the `README' file,
it often tells you about the needed prerequirements for installing
this package. You may also peek at any GNU archive site, in case
some other package would contain this missing `aclocal-1.4' program.
make: *** [aclocal.m4] Error 1
系统有安装高版本的automake,难道一定要切换到低版本?
rpm -aq | grep automake
automake-1.13.4-3.el7.noarch
尝试手动修改Makefile里面aclocal的版本号,仍然有问题。最后发现重新生成 aclocal.m4和Makefile就可以了:
解决步骤如下:
#重新生成 aclocal.m4
aclocal
#重新生成configure文件
autoconf -i -v -f
# 删除原来的makefile
find ./ -name Makefile -exec rm -rf {} \;
# 重新生成Makefile
./configure
4、
解决后重新make,编译报其他错:
mv -f .deps/ximajbg.Tpo .deps/ximajbg.Po
g++ -DHAVE_CONFIG_H -I. -I../.. -MT ximajas.o -MD -MP -MF .deps/ximajas.Tpo -c -o ximajas.o ximajas.cpp
In file included from ximajas.h:19:0,
from ximajas.cpp:8:
../jasper/include/jasper/jasper.h:114:31: fatal error: jasper/jas_config.h: No such file or directory
#include
估计是头文件路径设置的不完整,重新configure,添加头文件路径:
# 删除原来的 Makefile
find ./ -name Makefile -exec rm -rf {} \;
# 添加--with-extra-includes指定头文件路径,重新生成Makefile
./configure --with-extra-includes=/home/cximage599c/cximage/jasper/include/
之后可以在 cximage/jasper/Makefile 中看到添加的 include 路径。
5、 再次make clean;make ,还有错误.
mv -f .deps/ximabmp.Tpo .deps/ximabmp.Po
g++ -DHAVE_CONFIG_H -I. -I../.. -I/home/cximage599c/cximage/jasper/include/ -MT tif_xfile.o -MD -MP -MF .deps/tif_xfile.Tpo -c -o tif_xfile.o tif_xfile.cpp
tif_xfile.cpp: In function ‘TIFF* _TIFFOpenEx(CxFile*, const char*)’:
tif_xfile.cpp:102: error: cast from ‘CxFile*’ to ‘int’ loses precision
make[3]: *** [tif_xfile.o] Error 1
解决方法:修改代码 ./cximage/CxImage/tif_xfile.cpp
extern"C" TIFF* _TIFFOpenEx(CxFile* stream, constchar* mode)
{
//return (_TIFFFdOpen((int)stream, "TIFF IMAGE", mode));// 64bits 系统,int 改成long
return (_TIFFFdOpen((long)stream, "TIFF IMAGE", mode));
}
6、 最后cximage编译通过,但编译自己的程序,链接cximage相关的静态库时又提示需要-fPIC选项./usr/bin/ld: /home/xxxxx/libCxImage.a(ximatran.o): relocation R_X86_64_32S against `.rodata' can not be used when making a shared object; recompile with -fPIC
/home/xxxxx/libCxImage.a: could not read symbols: Bad value
因此删除Makefile后,添加CPPFLAGS="=-fPIC" 选项,重新执行configure生成Makefile
CPPFLAGS="=-fPIC" ./configure --with-extra-includes=/home/cximage599c/cximage/jasper/include/
编译步骤总结:
1、 修改 ./cximage/CxImage/tif_xfile.cpp 代码
2、 aclocal
3、 autoconf -i -v -f
4、 automake --add-mising
5、 find ./ -name Makefile -exec rm -rf {} \;
6、 CPPFLAGS="=-fPIC" ./configure --with-extra-includes=/home/cximage599c/cximage/jasper/include/
CPPFLAGS 根据实际需要添加。
7、 make; make install