[Solved] CMake can't find FreeImage in 1.12.11 Topic is solved

Problems building or running the engine, queries about how to use features etc.
Post Reply
Oogst
OGRE Expert User
OGRE Expert User
Posts: 1067
Joined: Mon Mar 29, 2004 8:49 pm
Location: the Netherlands
x 43
Contact:

[Solved] CMake can't find FreeImage in 1.12.11

Post by Oogst »

Ogre Version: 1.12.11
Operating System: Windows 10

I'm trying to compile Ogre myself in Visual Studio 2019, including FreeImage. So I'm going through the CMake steps that are described here. However, that says I need to add the FreeImage dependency myself. I've tried that, but CMake keeps saying this:
Looking for FreeImage...
Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE)
Could not locate FreeImage
Here's what I've done:
  • Download FreeImage here.
  • Created a folder Dependencies in Ogre's source folder and put the FreeImage folder in there.
  • Opened the FreeImage SLN file in Visual Studio 2019 and compiled both release and debug for 32bit. Build says 11 succeeded, 0 failed, 1 skipped.
  • Clicked Configure in CMake (which is also set to 32bit). I now get the "Could not locate FreeImage error"
My guess is that the thing I'm missing is where to put FreeImage, and/or how to tell CMake where it is.

How can I get CMake to find FreeImage?
Last edited by Oogst on Fri Apr 02, 2021 8:02 pm, edited 1 time in total.
My dev blog
Awesomenauts: platforming MOBA (PC/Mac/Linux/XBox360/X1/PS3/PS4)
Blightbound: coop online dungeon crawler (PC)
Swords & Soldiers: side-scrolling RTS (Switch/PS3/Wii/PC/Mac/Linux/iPhone/iPad/Android)
Proun: abstract racing game (PC)
Cello Fortress: mixing game and live cello performance
The Ageless Gate: cello album
paroj
OGRE Team Member
OGRE Team Member
Posts: 1993
Joined: Sun Mar 30, 2014 2:51 pm
x 1073
Contact:

Re: CMake can't find FreeImage in 1.12.11

Post by paroj »

Oogst wrote: Fri Apr 02, 2021 1:06 pm Created a folder Dependencies in Ogre's source folder and put the FreeImage folder in there.
the docs say:
Inside this directory you must have the subdirectories bin, lib and include where you place .dll, .lib and header files of the dependencies, respectively.
I dont build FreeImage myself, but you likely need to build the INSTALL target, while setting CMAKE_INSTALL_PREFIX (if it uses cmake) to the dependencies folder.

alternatively, it should probably do if you set FreeImage_LIBRARY_DBG, FreeImage_INCLUDE_DIR etc. in Ogre CMake.
Oogst
OGRE Expert User
OGRE Expert User
Posts: 1067
Joined: Mon Mar 29, 2004 8:49 pm
Location: the Netherlands
x 43
Contact:

Re: CMake can't find FreeImage in 1.12.11

Post by Oogst »

Thanks, your reply has helped me get one step closer! :) It turns out there's an Advanced button in CMake and when I press that, settings to manually enter the FreeImage folder and lib files appear. CMake now tells me it found FreeImage and the Ogre solution contains a Codec_FreeImage project. However, when I build that I get 32 linker errors about not being able to find FreeImage stuff:

Image

This is stuff that I would expect would be in the lib file, but apparently isn't? From the looks of it, it seems like maybe the linker can't find anything for FreeImage, but looking at the project settings for Codec_FreeImage I see the lib as an Additional Dependency as expected. Both Ogre and FreeImage are being compiled as Release Win32.

Why does it fail to link FreeImage?
My dev blog
Awesomenauts: platforming MOBA (PC/Mac/Linux/XBox360/X1/PS3/PS4)
Blightbound: coop online dungeon crawler (PC)
Swords & Soldiers: side-scrolling RTS (Switch/PS3/Wii/PC/Mac/Linux/iPhone/iPad/Android)
Proun: abstract racing game (PC)
Cello Fortress: mixing game and live cello performance
The Ageless Gate: cello album
paroj
OGRE Team Member
OGRE Team Member
Posts: 1993
Joined: Sun Mar 30, 2014 2:51 pm
x 1073
Contact:

Re: CMake can't find FreeImage in 1.12.11

Post by paroj »

no idea. maybe some compile flags dont match.

However, if you just want to load some png/ jpg files, you can also go with Codec_STBI which has no external dependencies.
Oogst
OGRE Expert User
OGRE Expert User
Posts: 1067
Joined: Mon Mar 29, 2004 8:49 pm
Location: the Netherlands
x 43
Contact:

Re: CMake can't find FreeImage in 1.12.11

Post by Oogst »

Oh lol, I didn't realise there was such a much simpler solution! I'm using STBI now and that fixes it.

Be gone, FreeImage!

Thanks for the quick responses! Image
My dev blog
Awesomenauts: platforming MOBA (PC/Mac/Linux/XBox360/X1/PS3/PS4)
Blightbound: coop online dungeon crawler (PC)
Swords & Soldiers: side-scrolling RTS (Switch/PS3/Wii/PC/Mac/Linux/iPhone/iPad/Android)
Proun: abstract racing game (PC)
Cello Fortress: mixing game and live cello performance
The Ageless Gate: cello album
Post Reply