查看: 3378|回复: 10

mingw编译64位osg2.9.8中的jpeg时报错

[复制链接]

该用户从未签到

发表于 2010-8-29 16:21:59 | 显示全部楼层 |阅读模式
cmake版本2.8.2;
mingw64使用gcc4.4.5;jpeg使用预先编译好的64位jpeg8b版本;
注释掉osgPlugins可以编译成功,在编译osgPlugins中的jpeg时报错:
  1. [  0%] Built target OpenThreads
  2. [ 64%] Built target osg
  3. [ 82%] Built target osgUtil
  4. [100%] Built target osgDB
  5. [100%] Building CXX object src/osgPlugins/jpeg/CMakeFiles/osgdb_jpeg.dir/ReaderWriterJPEG.obj
  6. d:/library/OpenSceneGraph-2.9.8/src/osgPlugins/jpeg/ReaderWriterJPEG.cpp: In function 'boolean osgDBJPEG::fill_input_buffer(jpeg_decompress_struct*)':
  7. d:/library/OpenSceneGraph-2.9.8/src/osgPlugins/jpeg/ReaderWriterJPEG.cpp:159: error: too many arguments to function
  8. d:/library/OpenSceneGraph-2.9.8/src/osgPlugins/jpeg/ReaderWriterJPEG.cpp:160: error: too many arguments to function
  9. d:/library/OpenSceneGraph-2.9.8/src/osgPlugins/jpeg/ReaderWriterJPEG.cpp: In function 'void osgDBJPEG::jpeg_istream_src(jpeg_decompress_struct*, std::istream*)':
  10. d:/library/OpenSceneGraph-2.9.8/src/osgPlugins/jpeg/ReaderWriterJPEG.cpp:244: error: too many arguments to function
  11. d:/library/OpenSceneGraph-2.9.8/src/osgPlugins/jpeg/ReaderWriterJPEG.cpp:247: error: too many arguments to function
  12. d:/library/OpenSceneGraph-2.9.8/src/osgPlugins/jpeg/ReaderWriterJPEG.cpp:251: warning: invalid conversion from 'void (*)(jpeg_decompress_struct*)' to 'void (*)()'
  13. d:/library/OpenSceneGraph-2.9.8/src/osgPlugins/jpeg/ReaderWriterJPEG.cpp:252: warning: invalid conversion from 'boolean (*)(jpeg_decompress_struct*)' to 'boolean (*)()'
  14. d:/library/OpenSceneGraph-2.9.8/src/osgPlugins/jpeg/ReaderWriterJPEG.cpp:253: warning: invalid conversion from 'void (*)(jpeg_decompress_struct*, long int)' to 'void (*)()'
  15. d:/library/OpenSceneGraph-2.9.8/src/osgPlugins/jpeg/ReaderWriterJPEG.cpp:254: warning: invalid conversion from 'boolean (*)(jpeg_decompress_struct*, int)' to 'boolean (*)()'
  16. d:/library/OpenSceneGraph-2.9.8/src/osgPlugins/jpeg/ReaderWriterJPEG.cpp:255: warning: invalid conversion from 'void (*)(jpeg_decompress_struct*)' to 'void (*)()'
  17. d:/library/OpenSceneGraph-2.9.8/src/osgPlugins/jpeg/ReaderWriterJPEG.cpp: In function 'void osgDBJPEG::init_destination(jpeg_compress_struct*)':
  18. d:/library/OpenSceneGraph-2.9.8/src/osgPlugins/jpeg/ReaderWriterJPEG.cpp:286: error: too many arguments to function
  19. d:/library/OpenSceneGraph-2.9.8/src/osgPlugins/jpeg/ReaderWriterJPEG.cpp: In function 'boolean osgDBJPEG::empty_output_buffer(jpeg_compress_struct*)':
  20. d:/library/OpenSceneGraph-2.9.8/src/osgPlugins/jpeg/ReaderWriterJPEG.cpp:322: error: too many arguments to function
  21. d:/library/OpenSceneGraph-2.9.8/src/osgPlugins/jpeg/ReaderWriterJPEG.cpp: In function 'void osgDBJPEG::term_destination(jpeg_compress_struct*)':
  22. d:/library/OpenSceneGraph-2.9.8/src/osgPlugins/jpeg/ReaderWriterJPEG.cpp:349: error: too many arguments to function
  23. d:/library/OpenSceneGraph-2.9.8/src/osgPlugins/jpeg/ReaderWriterJPEG.cpp:354: error: too many arguments to function
  24. d:/library/OpenSceneGraph-2.9.8/src/osgPlugins/jpeg/ReaderWriterJPEG.cpp: In function 'void osgDBJPEG::jpeg_stream_dest(jpeg_compress_struct*, std::ostream*)':
  25. d:/library/OpenSceneGraph-2.9.8/src/osgPlugins/jpeg/ReaderWriterJPEG.cpp:376: error: too many arguments to function
  26. d:/library/OpenSceneGraph-2.9.8/src/osgPlugins/jpeg/ReaderWriterJPEG.cpp:380: warning: invalid conversion from 'void (*)(jpeg_compress_struct*)' to 'void (*)()'
  27. d:/library/OpenSceneGraph-2.9.8/src/osgPlugins/jpeg/ReaderWriterJPEG.cpp:381: warning: invalid conversion from 'boolean (*)(jpeg_compress_struct*)' to 'boolean (*)()'
  28. d:/library/OpenSceneGraph-2.9.8/src/osgPlugins/jpeg/ReaderWriterJPEG.cpp:382: warning: invalid conversion from 'void (*)(jpeg_compress_struct*)' to 'void (*)()'
  29. d:/library/OpenSceneGraph-2.9.8/src/osgPlugins/jpeg/ReaderWriterJPEG.cpp: In function 'unsigned char* osgDBJPEG::simage_jpeg_load(std::istream&, int*, int*, int*)':
  30. d:/library/OpenSceneGraph-2.9.8/src/osgPlugins/jpeg/ReaderWriterJPEG.cpp:496: warning: invalid conversion from 'void (*)(jpeg_common_struct*)' to 'void (*)()'
  31. d:/library/OpenSceneGraph-2.9.8/src/osgPlugins/jpeg/ReaderWriterJPEG.cpp:562: error: too many arguments to function
  32. d:/library/OpenSceneGraph-2.9.8/src/osgPlugins/jpeg/ReaderWriterJPEG.cpp:587: warning: invalid conversion from 'JSAMPLE*' to 'unsigned char*'
  33. make[2]: *** [src/osgPlugins/jpeg/CMakeFiles/osgdb_jpeg.dir/ReaderWriterJPEG.obj] Error 1
  34. make[1]: *** [src/osgPlugins/jpeg/CMakeFiles/osgdb_jpeg.dir/all] Error 2
  35. make: *** [all] Error 2
复制代码


注意到错误只产生在ReaderWriterJPEG.cpp中,是不是有什么宏定义不正确啊??

该用户从未签到

 楼主| 发表于 2010-8-29 16:23:00 | 显示全部楼层
上面是重定向输出的make信息

该用户从未签到

发表于 2010-8-29 16:56:14 | 显示全部楼层
64位我没有编译过,不过,这种错误是属于改变了函数指定参数所导致的,估计需要你根据64位的jpeg库来修改下~~~~

该用户从未签到

 楼主| 发表于 2010-8-29 18:35:41 | 显示全部楼层
3# FlySky
根据jpeg库的什么来修改呢?我是新手 不太了解唉……

该用户从未签到

发表于 2010-8-29 19:45:52 | 显示全部楼层
请尝试使用jpeg6b,这个是目前osgdb_jpeg插件所使用的版本

该用户从未签到

 楼主| 发表于 2010-8-29 20:34:50 | 显示全部楼层
请尝试使用jpeg6b,这个是目前osgdb_jpeg插件所使用的版本
array 发表于 2010-8-29 19:45
恩 好的 我来试试

该用户从未签到

 楼主| 发表于 2010-8-29 22:27:48 | 显示全部楼层
请尝试使用jpeg6b,这个是目前osgdb_jpeg插件所使用的版本
array 发表于 2010-8-29 19:45
6b版本的问题也很多哎。
首先报INT32未定义,在jmorecfg.h line166-168 是个平台相关的编译选项:
  1. #if !defined(XMD_H) && !defined(_WIN32)                        /* X11/xmd.h correctly defines INT32 */
  2. typedef long INT32;
  3. #endif
复制代码


我强制定义为[size=14.1667px]typedef long INT32;再次编译,之前的错误过去了,然后报的错误好像是未定义的内部应用?:
[size=14.1667px]
  1. $ make
  2. /c/mingw64/bin/gcc  -o cjpeg cjpeg.o rdppm.o rdgif.o rdtarga.o rdrle.o rdbmp.o rdswitch.o cdjpeg.o libjpeg.a
  3. cjpeg.o:cjpeg.c:(.text+0x3fc): undefined reference to `__imp_jpeg_set_quality'
  4. cjpeg.o:cjpeg.c:(.text+0x515): undefined reference to `__imp_jpeg_simple_progression'
  5. cjpeg.o:cjpeg.c:(.text+0x67c): undefined reference to `__imp_jpeg_set_colorspace'
  6. cjpeg.o:cjpeg.c:(.text+0x8b1): undefined reference to `__imp_jpeg_quality_scaling'
  7. cjpeg.o:cjpeg.c:(.text+0xb17): undefined reference to `__imp_jpeg_std_error'
  8. cjpeg.o:cjpeg.c:(.text+0xb30): undefined reference to `__imp_jpeg_CreateCompress'
  9. cjpeg.o:cjpeg.c:(.text+0xb66): undefined reference to `__imp_jpeg_set_defaults'
  10. cjpeg.o:cjpeg.c:(.text+0xcad): undefined reference to `__imp_jpeg_default_colorspace'
  11. cjpeg.o:cjpeg.c:(.text+0xccc): undefined reference to `__imp_jpeg_stdio_dest'
  12. cjpeg.o:cjpeg.c:(.text+0xcda): undefined reference to `__imp_jpeg_start_compress'
  13. cjpeg.o:cjpeg.c:(.text+0xcee): undefined reference to `__imp_jpeg_write_scanlines'
  14. cjpeg.o:cjpeg.c:(.text+0xd22): undefined reference to `__imp_jpeg_finish_compress'
  15. cjpeg.o:cjpeg.c:(.text+0xd2b): undefined reference to `__imp_jpeg_destroy_compress'
  16. rdswitch.o:rdswitch.c:(.text+0x8f7): undefined reference to `__imp_jpeg_add_quant_table'
  17. collect2: ld returned 1 exit status
  18. make: *** [cjpeg] Error 1
复制代码




[size=14.1667px]网上找了下,好像没有人遇到过类似的情况……

该用户从未签到

发表于 2010-8-30 08:23:25 | 显示全部楼层
  1. gcc  -o cjpeg cjpeg.o rdppm.o rdgif.o rdtarga.o rdrle.o rdbmp.o rdswitch.o cdjpeg.o libjpeg.a
复制代码
您是自己用gcc去编译jpeg库的?那您需要附带的.o文件至少得超过20个……

该用户从未签到

 楼主| 发表于 2010-8-30 09:44:43 | 显示全部楼层
gcc  -o cjpeg cjpeg.o rdppm.o rdgif.o rdtarga.o rdrle.o rdbmp.o rdswitch.o cdjpeg.o libjpeg.a您是自己用gcc去编译jpeg库的?那您需要附带的.o文件至少得超过20个……
array 发表于 2010-8-30 08:23

不是 我就是在jpeg6b源码包里执行
./configure
make
的啊

该用户从未签到

发表于 2010-8-30 13:42:41 | 显示全部楼层
如果您使用的是msys的话,那么在configure之后把jpeg-6b文件夹中的jconfig.h拷贝到jpeg-6b-src中,覆盖原有的,然后make

该用户从未签到

 楼主| 发表于 2010-8-30 13:59:18 | 显示全部楼层
如果您使用的是msys的话,那么在configure之后把jpeg-6b文件夹中的jconfig.h拷贝到jpeg-6b-src中,覆盖原有的,然后make
array 发表于 2010-8-30 13:42
要是早一会看到你的回复就好了 之前我只能生成静态库,无法生成动态的,后来用gcc命令手动生成了.dll动态库。
刚刚用depengds工具比对了下两种方法生成的dll文件,里面都是一样的,osg现在也能顺利编译了,呵呵 十分感谢!!!
您需要登录后才可以回帖 登录 | 注册

本版积分规则

OSG中国官方论坛-有您OSG在中国才更好

网站简介:osgChina是国内首个三维相关技术开源社区,旨在为国内更多的技术开发人员提供最前沿的技术资讯,为更多的三维从业者提供一个学习、交流的技术平台。

联系我们

  • 工作时间:09:00--18:00
  • 反馈邮箱:1315785073@qq.com
快速回复 返回顶部 返回列表