Unable to build - undefined references to inflate methods

Problems building or running the engine, queries about how to use features etc.
Post Reply
rbaleksandar
Gnoblar
Posts: 2
Joined: Thu Aug 05, 2021 7:45 pm

Unable to build - undefined references to inflate methods

Post by rbaleksandar »

Ogre Version: 1.12
Operating System: Xubuntu 20.04
Render System: OpenGL

Hi all! Brand new user of Ogre 3d. :)

I'm attempting to build the engine on an Xubuntu 20.04 64bit standard desktop system. And I'm failing miserably. :D Below you can see the lines where the error starts.

Code: Select all

[...]
[ 89%] Linking CXX executable ../../../bin/TestContext
/usr/bin/ld: ../../../lib/libOgreOverlay.so.13.0: undefined reference to `inflateInit2_'
/usr/bin/ld: ../../../lib/libOgreOverlay.so.13.0: undefined reference to `inflate'
/usr/bin/ld: ../../../lib/libOgreOverlay.so.13.0: undefined reference to `inflateReset'
/usr/bin/ld: ../../../lib/libOgreOverlay.so.13.0: undefined reference to `inflateEnd'
collect2: error: ld returned 1 exit status
make[2]: *** [Tests/VisualTests/Context/CMakeFiles/TestContext.dir/build.make:88: bin/TestContext] Error 1
make[1]: *** [CMakeFiles/Makefile2:2844: Tests/VisualTests/Context/CMakeFiles/TestContext.dir/all] Error 2
make: *** [Makefile:163: all] Error 2
According to my research this may be due to zlib. I have installed the library (develop package included) from the official repository of my distro.

I had to fix the issue with libIrrXML (which is also mentioned in the CMakeLists.txt for the dependencies by building the static library (made a small cmake project for that and copied the output library). However this here would involve a lot more trail and error. Can anyone tell me how to fix the issue without changing the source of Ogre? I checkout the master branch and want to keep it clean unless I decide to contribute to it.
paroj
OGRE Team Member
OGRE Team Member
Posts: 1994
Joined: Sun Mar 30, 2014 2:51 pm
x 1074
Contact:

Re: Unable to build - undefined references to inflate methods

Post by paroj »

check the zlib and freetype paths in cmake. Zlib is likely pulled in via freetype there.
rbaleksandar
Gnoblar
Posts: 2
Joined: Thu Aug 05, 2021 7:45 pm

Re: Unable to build - undefined references to inflate methods

Post by rbaleksandar »

Well, according to a recursive search I did on /usr I have `/usr/lib/x86_64-linux-gnu/ruby/2.7.0/zlib.so` as well as the header in `/usr/include`. I don't know if this place is ok for CMake or at least the configuration that Ogre has in place. How can I check? I did install `zlib1g` (including the `-dev` version of that package) from the official repositories. I really don't want to compile an link against a library that should be compatible and can be found and used by other software on the system. The thing with the the IrrXML library is that it's not available in the repos. So there is no conflict.

Last but not least since my build is using GCC I checked (just in case) if the path is somewhere where GCC looks for stuff:

Code: Select all

gcc -print-search-dirs | grep /usr/lib/x86_64-linux-gnu
libraries: =/usr/lib/gcc/x86_64-linux-gnu/9/:/usr/lib/gcc/x86_64-linux-gnu/9/../../../../x86_64-linux-gnu/lib/x86_64-linux-gnu/9/:/usr/lib/gcc/x86_64-linux-gnu/9/../../../../x86_64-linux-gnu/lib/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/9/../../../../x86_64-linux-gnu/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/9/:/usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/9/../../../../lib/:/lib/x86_64-linux-gnu/9/:/lib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/9/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/9/../../../../x86_64-linux-gnu/lib/:/usr/lib/gcc/x86_64-linux-gnu/9/../../../:/lib/:/usr/lib/
Further:

Code: Select all

ldconfig -p | grep libz.so
	libz.so.1 (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libz.so.1
	libz.so.1 (libc6) => /lib/i386-linux-gnu/libz.so.1
	libz.so (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libz.so
It is, so I don't see a reason of this error occurring.
Last edited by rbaleksandar on Sat Aug 07, 2021 2:54 pm, edited 2 times in total.
Post Reply