[1.6.4] Cannot find codec for extension png

Problems building or running the engine, queries about how to use features etc.
Post Reply
User avatar
only_a_ptr
Halfling
Posts: 62
Joined: Sun Apr 26, 2009 8:43 pm
x 2

[1.6.4] Cannot find codec for extension png

Post by only_a_ptr »

Hello.

Ogre demos run fine for me. But when I run an ogre tutorial or my own app, I get this error:

Code: Select all

21:59:46: OGRE EXCEPTION(5:ItemIdentityException): Cannot find codec for extension png in Codec::getCodec at /home/an00bis/source/ogre/OgreMain/src/OgreCodec.cpp (line 62)
21:59:46: GLX backdrop image not found: Warning
Subsequentially, the config window has no background (see this post for demonstration) and when the app runs, the ogre logo and stats window are just rectangles of colored noise.

I've read existing posts about this problem, but they were all irrelevant. The error was always caused by mixing two versions of OGRE, which ain't my case. I'm on Slackware13 and I did a clean install from source. I'm using ogre 1.6.4 with FreeImage. All details about my configuration are here.

I reproduced this error with ogre tutorials 1 and 6 and with my own test app, which doesn't use ExampleApplication.h. I also tried using absolute paths in resources.cfg (no effect).

My log:

Code: Select all

21:59:46: Creating resource group General
21:59:46: Creating resource group Internal
21:59:46: Creating resource group Autodetect
21:59:46: SceneManagerFactory for type 'DefaultSceneManager' registered.
21:59:46: Registering ResourceManager for type Material
21:59:46: Registering ResourceManager for type Mesh
21:59:46: Registering ResourceManager for type Skeleton
21:59:46: MovableObjectFactory for type 'ParticleSystem' registered.
21:59:46: OverlayElementFactory for type Panel registered.
21:59:46: OverlayElementFactory for type BorderPanel registered.
21:59:46: OverlayElementFactory for type TextArea registered.
21:59:46: Registering ResourceManager for type Font
21:59:46: ArchiveFactory for archive type FileSystem registered.
21:59:46: ArchiveFactory for archive type Zip registered.
21:59:46: FreeImage version: 3.11.0
21:59:46: This program uses FreeImage, a free, open source image library supporting all common bitmap formats. See http://freeimage.sourceforge.net for details
21:59:46: Supported formats: bmp,ico,jpg,jif,jpeg,jpe,jng,koa,iff,lbm,mng,pbm,pbm,pcd,pcx,pgm,pgm,png,ppm,ppm,ras,tga,targa,tif,tiff,wap,wbmp,wbm,psd,cut,xbm,xpm,gif,hdr,g3,sgi,exr,j2k,j2c,jp2
21:59:46: DDS codec registering
21:59:46: Registering ResourceManager for type HighLevelGpuProgram
21:59:46: Registering ResourceManager for type Compositor
21:59:46: MovableObjectFactory for type 'Entity' registered.
21:59:46: MovableObjectFactory for type 'Light' registered.
21:59:46: MovableObjectFactory for type 'BillboardSet' registered.
21:59:46: MovableObjectFactory for type 'ManualObject' registered.
21:59:46: MovableObjectFactory for type 'BillboardChain' registered.
21:59:46: MovableObjectFactory for type 'RibbonTrail' registered.
21:59:46: Loading library ./RenderSystem_GL_d
21:59:46: Installing plugin: GL RenderSystem
21:59:46: OpenGL Rendering Subsystem created.
21:59:46: Plugin successfully installed
21:59:46: Loading library ./Plugin_ParticleFX_d
21:59:46: Installing plugin: ParticleFX
21:59:46: Particle Emitter Type 'Point' registered
21:59:46: Particle Emitter Type 'Box' registered
21:59:46: Particle Emitter Type 'Ellipsoid' registered
21:59:46: Particle Emitter Type 'Cylinder' registered
21:59:46: Particle Emitter Type 'Ring' registered
21:59:46: Particle Emitter Type 'HollowEllipsoid' registered
21:59:46: Particle Affector Type 'LinearForce' registered
21:59:46: Particle Affector Type 'ColourFader' registered
21:59:46: Particle Affector Type 'ColourFader2' registered
21:59:46: Particle Affector Type 'ColourImage' registered
21:59:46: Particle Affector Type 'ColourInterpolator' registered
21:59:46: Particle Affector Type 'Scaler' registered
21:59:46: Particle Affector Type 'Rotator' registered
21:59:46: Particle Affector Type 'DirectionRandomiser' registered
21:59:46: Particle Affector Type 'DeflectorPlane' registered
21:59:46: Plugin successfully installed
21:59:46: Loading library ./Plugin_BSPSceneManager_d
21:59:46: Installing plugin: BSP Scene Manager
21:59:46: Plugin successfully installed
21:59:46: Loading library ./Plugin_CgProgramManager_d
21:59:46: Installing plugin: Cg Program Manager
21:59:46: Plugin successfully installed
21:59:46: Loading library ./Plugin_OctreeSceneManager_d
21:59:46: Installing plugin: Octree & Terrain Scene Manager
21:59:46: Plugin successfully installed
21:59:46: *-*-* OGRE Initialising
21:59:46: *-*-* Version 1.6.4 (Shoggoth)
21:59:46: Creating resource group Bootstrap
21:59:46: Added resource location '/home/an00bis/source/ogre/Samples/Media/packs/OgreCore.zip' of type 'Zip' to resource group 'Bootstrap'
21:59:46: Added resource location '/home/an00bis/source/ogre/Samples/Media' of type 'FileSystem' to resource group 'General'
21:59:46: Added resource location '/home/an00bis/source/ogre/Samples/Media/fonts' of type 'FileSystem' to resource group 'General'
21:59:46: Added resource location '/home/an00bis/source/ogre/Samples/Media/materials/programs' of type 'FileSystem' to resource group 'General'
21:59:46: Added resource location '/home/an00bis/source/ogre/Samples/Media/materials/scripts' of type 'FileSystem' to resource group 'General'
21:59:46: Added resource location '/home/an00bis/source/ogre/Samples/Media/materials/textures' of type 'FileSystem' to resource group 'General'
21:59:46: Added resource location '/home/an00bis/source/ogre/Samples/Media/models' of type 'FileSystem' to resource group 'General'
21:59:46: Added resource location '/home/an00bis/source/ogre/Samples/Media/overlays' of type 'FileSystem' to resource group 'General'
21:59:46: Added resource location '/home/an00bis/source/ogre/Samples/Media/particle' of type 'FileSystem' to resource group 'General'
21:59:46: Added resource location '/home/an00bis/source/ogre/Samples/Media/gui' of type 'FileSystem' to resource group 'General'
21:59:46: Added resource location '/home/an00bis/source/ogre/Samples/Media/DeferredShadingMedia' of type 'FileSystem' to resource group 'General'
21:59:46: Added resource location '/home/an00bis/source/ogre/Samples/Media/PCZAppMedia' of type 'FileSystem' to resource group 'General'
21:59:46: Added resource location '/home/an00bis/source/ogre/Samples/Media/packs/cubemap.zip' of type 'Zip' to resource group 'General'
21:59:46: Added resource location '/home/an00bis/source/ogre/Samples/Media/packs/cubemapsJS.zip' of type 'Zip' to resource group 'General'
21:59:46: Added resource location '/home/an00bis/source/ogre/Samples/Media/packs/dragon.zip' of type 'Zip' to resource group 'General'
21:59:46: Added resource location '/home/an00bis/source/ogre/Samples/Media/packs/fresneldemo.zip' of type 'Zip' to resource group 'General'
21:59:46: Added resource location '/home/an00bis/source/ogre/Samples/Media/packs/ogretestmap.zip' of type 'Zip' to resource group 'General'
21:59:46: Added resource location '/home/an00bis/source/ogre/Samples/Media/packs/skybox.zip' of type 'Zip' to resource group 'General'
21:59:46: OGRE EXCEPTION(5:ItemIdentityException): Cannot find codec for extension png in Codec::getCodec at /home/an00bis/source/ogre/OgreMain/src/OgreCodec.cpp (line 62)
21:59:46: GLX backdrop image not found: Warning
21:59:49: *-*-* OGRE Shutdown
21:59:49: Unregistering ResourceManager for type Compositor
21:59:49: Unregistering ResourceManager for type Font
21:59:49: Unregistering ResourceManager for type Skeleton
21:59:49: Unregistering ResourceManager for type Mesh
21:59:49: Unregistering ResourceManager for type HighLevelGpuProgram
21:59:49: Uninstalling plugin: Octree & Terrain Scene Manager
21:59:49: Plugin successfully uninstalled
21:59:49: Unloading library ./Plugin_OctreeSceneManager_d
21:59:49: Uninstalling plugin: Cg Program Manager
21:59:49: Plugin successfully uninstalled
21:59:49: Unloading library ./Plugin_CgProgramManager_d
21:59:49: Uninstalling plugin: BSP Scene Manager
21:59:49: Plugin successfully uninstalled
21:59:49: Unloading library ./Plugin_BSPSceneManager_d
21:59:49: Uninstalling plugin: ParticleFX
21:59:49: Plugin successfully uninstalled
21:59:49: Unloading library ./Plugin_ParticleFX_d
21:59:49: Uninstalling plugin: GL RenderSystem
21:59:49: ******************************
*** Stopping GLX Subsystem ***
******************************
21:59:49: Plugin successfully uninstalled
21:59:49: Unloading library ./RenderSystem_GL_d
21:59:49: Unregistering ResourceManager for type Material
Anyone can tell me what causes this problem?
Rigs of Rods is alive and kicking!
schwissig
Gnoblar
Posts: 6
Joined: Sat May 23, 2009 8:31 pm

Re: [1.6.4] Cannot find codec for extension png

Post by schwissig »

I am having this same problem, and I have also build from source on Slackware 13. If I find a fix, I'll post it.

I've found a post about this problem that someone was having on Gentoo here, but that had to do with a "portage" property, and I'm not sure how that would connect with Slackware. Thought I'd post it if anyone else knows though.

EDIT

Here are some possible fixes that I will investigate tomorrow and keep you posted.
https://www.ogre3d.org/forums/viewtopic ... 34&start=0
http://www.linuxformat.co.uk/forums/vie ... dad1e45f2a
schwissig
Gnoblar
Posts: 6
Joined: Sat May 23, 2009 8:31 pm

Re: [1.6.4] Cannot find codec for extension png

Post by schwissig »

I appears, in my case anyway, that freeimage is not "registering" with ogre, but it is install, because I after performing the cmake, it told me that freeimage was present. I don't think me and the original poster have the exact same problem, as in his log freeimage appears to be working at least.

I'm very close to just using windows.
schwissig
Gnoblar
Posts: 6
Joined: Sat May 23, 2009 8:31 pm

Re: [1.6.4] Cannot find codec for extension png

Post by schwissig »

SOLVED!

If anyone else is having this problem, here is what I did to fix it: (Keep in mind I build this on Slackware 13.0 64 bit.)

During the "cmake" guide to building 1.7, in the "make" command, add "FREEIMAGE_LIBRARY_TYPE = STATIC", as such:

Code: Select all

$ make FREEIMAGE_LIBRARY_TYPE = STATIC
I found this out from this post.

If anyone wants anymore info on this problem or doesn't quite understand something, please post here and/or PM me and I'll try to elaborate more.
ilya80
Gnoblar
Posts: 9
Joined: Mon Jan 18, 2010 11:20 pm

Re: [1.6.4] Cannot find codec for extension png

Post by ilya80 »

Hey there Schwissig,

I tried your approach with FREEIMAGE_LIBRARY_TYPE and it didnt help me, and I`m not sure how it could, since I made a search for anything containing FREEIMAGE_LIBRARY_TYPE in cmake generated files and found nothing.

I`m facing same problem basically - examples run fine for some reason, but when i try to run my own application, OGRE fails to find png codec.
I tried to debug it a bit, but cant see whats going wrong:

Code: Select all

FreeImageCodec::startup() 
gets called and supposedly iterates over comma separated list of freeimage supported file types, however as far as I can see

Code: Select all

static void Codec::registerCodec( Codec *pCodec )
gets called only once. I must admit though that i cant see what the codec is, will add more logging tomorrow maybe, I`m using Netbeans with Debian Lenny x64 and Netbeans refuses to show me local variables for some reason.

Subsequently it fails to find an entry for "png" key in codecs map and dies with the exception later.

Will keep everyone updated.
ilya80
Gnoblar
Posts: 9
Joined: Mon Jan 18, 2010 11:20 pm

Re: [1.6.4] Cannot find codec for extension png

Post by ilya80 »

I suspect interference with freeimageimagecodec that is part of CEGUI, other than that i`m out of ideas atm :?:
ilya80
Gnoblar
Posts: 9
Joined: Mon Jan 18, 2010 11:20 pm

Re: [1.6.4] Cannot find codec for extension png

Post by ilya80 »

Hmm happens to me only when using debug built plugins *_d.so.
When using RelWithDebInfo type of build the problem goes away.
schwissig
Gnoblar
Posts: 6
Joined: Sat May 23, 2009 8:31 pm

Re: [1.6.4] Cannot find codec for extension png

Post by schwissig »

Just to clarify a bit, are you getting the lines:

Code: Select all

21:59:46: FreeImage version: 3.11.0
21:59:46: This program uses FreeImage, a free, open source image library supporting all common bitmap formats. See http://freeimage.sourceforge.net for details
21:59:46: Supported formats: bmp,ico,jpg,jif,jpeg,jpe,jng,koa,iff,lbm,mng,pbm,pbm,pcd,pcx,pgm,pgm,png,ppm,ppm,ras,tga,targa,tif,tiff,wap,wbmp,wbm,psd,cut,xbm,xpm,gif,hdr,g3,sgi,exr,j2k,j2c,jp2
in your ogre.log?
ilya80
Gnoblar
Posts: 9
Joined: Mon Jan 18, 2010 11:20 pm

Re: [1.6.4] Cannot find codec for extension png

Post by ilya80 »

Yeh, definitely. It gets a comma separated string of supported formats from freeimage and outputs the sting you mentioned. But it still fails to find the correct codec afterwards. I was at loss.

However later I found out that everything works fine when i build ogre in release with debug info and stopped bashing my head against this.

Arrogance is bliss.
feiyunw
Gnoblar
Posts: 23
Joined: Sat Mar 05, 2005 10:24 am

Re: [1.6.4] Cannot find codec for extension png

Post by feiyunw »

I have the same problem with Ogre-1.7.1 in MinGW(tdm-gcc-4.5.0)/Windows XP.
It pops up a dialog that reads "OGRE EXCEPTION(5:ItemIdentityException): Can not find codec for 'png' image format." and "Supported formats are: bmp dds ico iff jif jng jpe jpeg jpg koa lbm. in Codec::getCodec at D:\prj\ogre\v1-7\OgreMain\src\OgreCodec.cpp (line 69)", then exits quietly.
I think it may be a OgreMain.dll problem.

Code: Select all

(gdb) run

Starting program: D:\prj\ogre\build-ogre-1.7\sdk\bin\relwithdebinfo/SampleBrowse
r.exe
[New Thread 3892.0xdcc]

Breakpoint 2, Ogre::FreeImageCodec::startup ()
    at D:\prj\ogre\v1-7\OgreMain\src\OgreFreeImageCodec.cpp:111
111                             String exts(FreeImage_GetFIFExtensionList((FREE_
IMAGE_FORMAT)i));
(gdb) p i
$14 = 0
(gdb) n
112                             if (!first)
(gdb) p exts
$15 = {static npos = 4294967295,
  _M_dataplus = {<std::allocator<char>> = {<__gnu_cxx::new_allocator<char>> = {<
No data fields>}, <No data fields>}, _M_p = 0x7a4538c "bmp"}}
(gdb) c
Continuing.

Breakpoint 2, Ogre::FreeImageCodec::startup ()
    at D:\prj\ogre\v1-7\OgreMain\src\OgreFreeImageCodec.cpp:111
111                             String exts(FreeImage_GetFIFExtensionList((FREE_
IMAGE_FORMAT)i));
(gdb) p i
$16 = 1
(gdb) n
112                             if (!first)
(gdb) p exts
$17 = {static npos = 4294967295,
  _M_dataplus = {<std::allocator<char>> = {<__gnu_cxx::new_allocator<char>> = {<
No data fields>}, <No data fields>}, _M_p = 0x7a4538c "ico"}}
(gdb) c
Continuing.

Breakpoint 2, Ogre::FreeImageCodec::startup ()
    at D:\prj\ogre\v1-7\OgreMain\src\OgreFreeImageCodec.cpp:111
111                             String exts(FreeImage_GetFIFExtensionList((FREE_
IMAGE_FORMAT)i));
(gdb) p i
$18 = 2
(gdb) n
112                             if (!first)
(gdb) p exts
$19 = {static npos = 4294967295,
  _M_dataplus = {<std::allocator<char>> = {<__gnu_cxx::new_allocator<char>> = {<
No data fields>}, <No data fields>}, _M_p = 0x7a456c4 "jpg,jif,jpeg,jpe"}}
(gdb) c
Continuing.

Breakpoint 2, Ogre::FreeImageCodec::startup ()
    at D:\prj\ogre\v1-7\OgreMain\src\OgreFreeImageCodec.cpp:111
111                             String exts(FreeImage_GetFIFExtensionList((FREE_
IMAGE_FORMAT)i));
(gdb) p i
$20 = 3
(gdb) n
112                             if (!first)
(gdb) p exts
$21 = {static npos = 4294967295,
  _M_dataplus = {<std::allocator<char>> = {<__gnu_cxx::new_allocator<char>> = {<
No data fields>}, <No data fields>}, _M_p = 0x7a45784 "jng"}}
(gdb) c
Continuing.

Breakpoint 2, Ogre::FreeImageCodec::startup ()
    at D:\prj\ogre\v1-7\OgreMain\src\OgreFreeImageCodec.cpp:111
111                             String exts(FreeImage_GetFIFExtensionList((FREE_
IMAGE_FORMAT)i));
(gdb) p i
$22 = 4
(gdb) n
112                             if (!first)
(gdb) p exts
$23 = {static npos = 4294967295,
  _M_dataplus = {<std::allocator<char>> = {<__gnu_cxx::new_allocator<char>> = {<
No data fields>}, <No data fields>}, _M_p = 0x7a45a44 "koa"}}
(gdb) c
Continuing.

Breakpoint 2, Ogre::FreeImageCodec::startup ()
    at D:\prj\ogre\v1-7\OgreMain\src\OgreFreeImageCodec.cpp:111
111                             String exts(FreeImage_GetFIFExtensionList((FREE_
IMAGE_FORMAT)i));
(gdb) p i
$24 = 5
(gdb) n
112                             if (!first)
(gdb) p exts
$25 = {static npos = 4294967295,
  _M_dataplus = {<std::allocator<char>> = {<__gnu_cxx::new_allocator<char>> = {<
No data fields>}, <No data fields>}, _M_p = 0x7a45b04 "iff,lbm"}}
(gdb) n
114                                     strExt << ",";
(gdb)
117                             strExt << exts;
(gdb)
120                             StringVector extsVector = StringUtil::split(exts
, ",");
(gdb) p i
$26 = 5
(gdb) s
Ogre::StringUtil::split (str=..., delims=..., maxSplits=0)
    at D:\prj\ogre\v1-7\OgreMain\src\OgreString.cpp:73
73              vector<String>::type ret;
(gdb) bt
#0  Ogre::StringUtil::split (str=..., delims=..., maxSplits=0)
    at D:\prj\ogre\v1-7\OgreMain\src\OgreString.cpp:73
#1  0x00a16e4c in Ogre::FreeImageCodec::startup ()
    at D:\prj\ogre\v1-7\OgreMain\src\OgreFreeImageCodec.cpp:120
#2  0x0094235c in Root (this=0x3eb770, pluginFileName=...,
    configFileName=..., logFileName=...)
    at D:\prj\ogre\v1-7\OgreMain\src\OgreRoot.cpp:236
#3  0x004333e5 in _fu11___ZN4Ogre10StringUtil5BLANKE (this=0x22fdcc)
    at D:/prj/ogre/v1-7/Samples/Common/include/SampleContext.h:474
#4  0x00401b25 in OgreBites::SampleContext::go ()
    at D:/prj/ogre/v1-7/Samples/Common/include/SampleContext.h:226
#5  WinMain@16 () at D:\prj\ogre\v1-7\Samples\Browser\src\SampleBrowser.cpp:99
#6  0x00417416 in main ()
(gdb) f 1
#1  0x00a16e4c in Ogre::FreeImageCodec::startup ()
    at D:\prj\ogre\v1-7\OgreMain\src\OgreFreeImageCodec.cpp:120
120                             StringVector extsVector = StringUtil::split(exts
, ",");
(gdb) p i
$27 = 0
(gdb) f 0
#0  Ogre::StringUtil::split (str=..., delims=..., maxSplits=0)
    at D:\prj\ogre\v1-7\OgreMain\src\OgreString.cpp:73
73              vector<String>::type ret;
(gdb) n
75              ret.reserve(maxSplits ? maxSplits+1 : 10);    // 10 is guessed c
apacity for most case
(gdb) f 1
#1  0x00a16e4c in Ogre::FreeImageCodec::startup ()
    at D:\prj\ogre\v1-7\OgreMain\src\OgreFreeImageCodec.cpp:120
120                             StringVector extsVector = StringUtil::split(exts
, ",");
(gdb) p i
$28 = 0
(gdb) f 0
#0  Ogre::StringUtil::split (str=..., delims=..., maxSplits=0)
    at D:\prj\ogre\v1-7\OgreMain\src\OgreString.cpp:75
75              ret.reserve(maxSplits ? maxSplits+1 : 10);    // 10 is guessed c
apacity for most case
(gdb) finish
Run till exit from #0  Ogre::StringUtil::split (str=..., delims=...,
    maxSplits=0) at D:\prj\ogre\v1-7\OgreMain\src\OgreString.cpp:75
0x00a16e4c in Ogre::FreeImageCodec::startup ()
    at D:\prj\ogre\v1-7\OgreMain\src\OgreFreeImageCodec.cpp:120
120                             StringVector extsVector = StringUtil::split(exts
, ",");
Value returned is $29 =
      {<std::_Vector_base<std::basic_string<char, std::char_traits<char>, std::a
llocator<char> >, Ogre::STLAllocator<std::basic_string<char, std::char_traits<ch
ar>, std::allocator<char> >, Ogre::CategorisedAllocPolicy<(Ogre::MemoryCategory)
0> > >> = {_M_impl = {<Ogre::STLAllocator<std::basic_string<char, std::char_trai
ts<char>, std::allocator<char> >, Ogre::CategorisedAllocPolicy<(Ogre::MemoryCate
gory)0> >> = {<Ogre::STLAllocatorBase<std::basic_string<char, std::char_traits<c
har>, std::allocator<char> > >> = {<No data fields>}, _vptr.STLAllocator = 0xc1d
330}, _M_start = 0x7a45bb8, _M_finish = 0x7a45bc0, _M_end_of_storage = 0x7a45be0
}}, <No data fields>}
(gdb) p i
$30 = 0
(gdb) bt
#0  0x00a16e4c in Ogre::FreeImageCodec::startup ()
    at D:\prj\ogre\v1-7\OgreMain\src\OgreFreeImageCodec.cpp:120
#1  0x0094235c in Root (this=0x3eb770, pluginFileName=...,
    configFileName=..., logFileName=...)
    at D:\prj\ogre\v1-7\OgreMain\src\OgreRoot.cpp:236
#2  0x004333e5 in _fu11___ZN4Ogre10StringUtil5BLANKE (this=0x22fdcc)
    at D:/prj/ogre/v1-7/Samples/Common/include/SampleContext.h:474
#3  0x00401b25 in OgreBites::SampleContext::go ()
    at D:/prj/ogre/v1-7/Samples/Common/include/SampleContext.h:226
#4  WinMain@16 () at D:\prj\ogre\v1-7\Samples\Browser\src\SampleBrowser.cpp:99
#5  0x00417416 in main ()
(gdb) l
115                             }
116                             first = false;
117                             strExt << exts;
118
119                             // Pull off individual formats (separated by com
ma by FI)
120                             StringVector extsVector = StringUtil::split(exts
, ",");
121                             for (StringVector::iterator v = extsVector.begin
(); v != extsVector.end(); ++v)
122                             {
123                                     // FreeImage 3.13 lists many formats twi
ce: once under their own codec and
124                                     // once under the "RAW" codec, which is
listed last. Avoid letting the RAW override
(gdb) n
121                             for (StringVector::iterator v = extsVector.begin
(); v != extsVector.end(); ++v)
(gdb) p i
$31 = 0
(gdb) c
Continuing.

Breakpoint 2, Ogre::FreeImageCodec::startup ()
    at D:\prj\ogre\v1-7\OgreMain\src\OgreFreeImageCodec.cpp:111
111                             String exts(FreeImage_GetFIFExtensionList((FREE_
IMAGE_FORMAT)i));
(gdb) p i
$32 = 1
(gdb) n
112                             if (!first)
(gdb) p exts
$33 = {static npos = 4294967295,
  _M_dataplus = {<std::allocator<char>> = {<__gnu_cxx::new_allocator<char>> = {<
No data fields>}, <No data fields>}, _M_p = 0x7a45bc4 "ico"}}
(gdb) c
Continuing.
[New Thread 3892.0xb88]
[New Thread 3892.0xf8c]
[New Thread 3892.0xd64]

Program exited normally.
(gdb)
It's a bad idea to pass STL objects across DLL boundaries. Check this:
http://www.eggheadcafe.com/software/asp ... value.aspx
feiyunw
Gnoblar
Posts: 23
Joined: Sat Mar 05, 2005 10:24 am

Re: [1.6.4] Cannot find codec for extension png

Post by feiyunw »

The Key to this problem is not mixing different types of lib/dll, or header files/lib.
There are a few mistakes I made before I succeeded building OGRE the state of the art.

1. I mistakenly linked a wrong zlib library:
http://www.ogre3d.org/forums/viewtopic. ... 55#p393355
Thus the lib does not correspond with the dll.

2. When I tried to build FreeImage from source code, I forgot to "set FREEIMAGE_LIBRARY_TYPE=STATIC" before make the target.
Thus the function calling convention in the header file does not match that in lib/dll.
Actually, the one in the MinGW Precompiled Dependencies (http://www.ogre3d.org/download/source) works fine, even the gcc version (4.4) differs from what I am using (4.5.0).
FreeImage must be static linked, because FREEIMAGE_LIB is defined in OgreMain/CMakeLists.txt and not configurable, at least for now.

3. I changed compiler from the official MinGW g++ to TDM-gcc (http://tdm-gcc.tdragon.net), and this gave different error phenomenon when I debugged the resulting SampleBrowser.exe.
This distracted me and it made me think that the standard libraries go with them may be quite different.
However, I am using TDM-gcc now. It can yield working OGRE samples. I will try to fall back when I have time.
feiyunw
Gnoblar
Posts: 23
Joined: Sat Mar 05, 2005 10:24 am

Re: [1.6.4] Cannot find codec for extension png

Post by feiyunw »

feiyunw wrote:However, I am using TDM-gcc now. It can yield working OGRE samples. I will try to fall back when I have time.
I failed to build the OGRE soruce, from the default branch, with the offical MinGW g++-4.5.0.
There are too many "undefined reference to `__gxx_personality_sj0'" stuff.
By building the FreeImage from the source, I can move a little further, but stopped by a g++ internal error finally.
For the "__gxx_personality_sj0" issue, there is not such an entry in the offical MinGW libstdc++-6.dll, which has __gxx_personality_v0 instead. But it exists in the TDM package gcc-4.5.0-tdm-1-c++.tar.lzma. So the base libraries of them are different.
I think I'd better stay with TDM-gcc.
wingated
Gnoblar
Posts: 1
Joined: Mon Aug 16, 2010 12:59 pm

Re: [1.6.4] Cannot find codec for extension png

Post by wingated »

I had this problem as well. I still don't understand why the samples work and my code doesn't, but I did find a workaround: I had originally compiled OGRE with 'static' enabled, generating static libraries. When I compiled my code, I was still inadvertently linking to the static ogre libraries.

I recompiled my code using the shared libraries, and everything worked fine.

*shrugs*
pra
Halfling
Posts: 55
Joined: Sat Jul 15, 2006 4:03 pm
Contact:

Re: [1.6.4] Cannot find codec for extension png

Post by pra »

this problem and this one seem to be related.

the strange thing is, the samples work, a new project I made with the ogre app wizard works, too, but not my actual project.
Now I think this might be something really trivial.
gmueckl
Halfling
Posts: 44
Joined: Wed Aug 06, 2003 2:22 pm

Re: [1.6.4] Cannot find codec for extension png

Post by gmueckl »

Just for reference: I had the same symptoms for me and the ultimate cause was a serious linking mess on my part. Different versions of the Ogre library were used at the same time, duplicating static variables like the (internal) codec map. Straightening that out fixed it for me.
brendor
Gnoblar
Posts: 1
Joined: Thu Jul 03, 2014 10:33 pm
x 1

Re: [1.6.4] Cannot find codec for extension png

Post by brendor »

I had similar problem using statically linked Ogre libraries, solved it by using the following code before initializing root. Dynamically linked Ogre worked fine, so I'm not sure what was different in the static build that prevented codecs from loading.

Code: Select all

    FreeImage_Initialise();
    Ogre::DDSCodec::startup();
    Ogre::FreeImageCodec::startup();
EDIT: I'm using Ogre 1.9
User avatar
prosaic2000
Kobold
Posts: 30
Joined: Wed Jul 18, 2007 4:16 am
Location: MoTown

Re: [1.6.4] Cannot find codec for extension png

Post by prosaic2000 »

struggled with this and fixed it by unistalling pre-built stuff and compiling source. I had to:
sudo apt-get remove libogre-1.9-dev

Hope this helps someone else, I still had to fix a thing or two, but this was the biggest hangup. Works now :D
Post Reply