NekMesh meshgen compilation error on Ubuntu 18.04
A problem was reported on the mailing list that results in the build failing while linking NekMesh
on Ubuntu 18.04 (and presumably also recent Debian distros?). The error that is received is:
//usr/lib/x86_64-linux-gnu/libpng16.so.16: undefined reference to `inflateValidate@ZLIB_1.2.9'
collect2: error: ld returned 1 exit status
utilities/NekMesh/CMakeFiles/NekMesh.dir/build.make:1021: recipe for target 'utilities/NekMesh/NekMesh' failed
make[2]: *** [utilities/NekMesh/NekMesh] Error 1
...
This occurs when NEKTAR_USE_MESHGEN=ON
and THIRDPARTY_BUILD_ZLIB=ON
when using the packaged version of OCE in Ubuntu (OCE 0.17).
It looks like this is a result of an incompatibility between zlib-1.2.7
, the version used by Nektar++ in a third party build, and libpng16.so.16
provided with Ubuntu 18.04. (See this bug report for more info)
I verified this by manually running the link command for NekMesh
, as found in build/utilities/NekMesh/CMakeFiles/NekMesh.dir/link.txt
and getting the error. If the reference to ../../ThirdParty/dist/lib/libz.a
is removed from the link command and the libz library files are removed from the ThirdParty/dist/lib directory, the linking picks up the system libz and completes successfully.