------------------------------------------------------------------- Modfications to xpdf-4.00.tar.gz to produce gs-xpdf-4.00.tar.gz ------------------------------------------------------------------- In order to successfully compile xpdf-tools-4.00 against *dynamically* linked libraries for zlib (and libpng), needed to modify the CMakeLists.txt. The changes. if (PNG_FOUND) include_directories("${PNG_INCLUDE_DIRS}") add_definitions("${PNG_DEFINITIONS}") endif () #--------- NEW # https://stackoverflow.com/questions/36126333/mingw-cmake-undefined-reference-to-zlib if (ZLIB_FOUND) include_directories("${ZLIB_INCLUDE_DIRS}") add_definitions("${ZLIB_DEFINITIONS}") endif () #--------- ENDNEW if (HAVE_LCMS) ... Note that the xpdftools binaries produced in this fashion are still linked to the system zlib and libpng rather than the ones we're compiling up as part of the GEXT XPDFTOOLS extension. But just to get the compilation to succeed with the references to our local library in XPDFTOOLS.sh below (a step toward getting the statically linked xpdftools binaries to compile), we needed the above changes. cmake -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_INSTALL_PREFIX=$prefix \ -DZLIB_LIBRARY=$prefix/lib/libz.a \ <======== -DPNG_LIBRARY=$prefix/lib/libpng15.a \ <======== -DFREETYPE_LIBRARY=$prefix/lib/libfreetype.a \ <======== -DCMAKE_DISABLE_FIND_PACKAGE_Qt4=1 \ -DCMAKE_DISABLE_FIND_PACKAGE_Qt5Widgets=1 \ -DCMAKE_C_FLAGS="$CFLAGS" \ -DCMAKE_CXX_FLAGS="$CXXFLAGS" \ -DCMAKE_EXE_LINKER_FLAGS="$LDFLAGS" \ -DPNG_LINK_FLAGS="-lpng15" \ $GEXT_XPDFTOOLS/packages/$package$version ------------------------------------------------------------------- Redundant CMakeLists.txt files ------------------------------------------------------------------- I've also committed work in progress versions of CMakeLists.txt - CMakeLists.txt.orig: the original version of this file in the unmodified xpdf-4.00.tar.gz - CMakeLists.txt.static1_notworking: Sets up CMake settings for static compilation. Which then required some further changes to stop compilation from complaining about undefined references to thread mutex or something. (-lpthread/pthread library was necessary, but needed to set this the CMake way). Not a working version. - CMakeLists.txt.static2_notworking: more changes in an attempt to bypass the errors about undefined references to png (and 'inflate' of zlib). Still not working. It's this version that briefly attempted to use the override to PNG_LINK_FLAGS I am setting in XPDFTOOLS.sh (the line containing: -DPNG_LINK_FLAGS="-lpng15" \). Not sure why it never got set. - CMakeLists.txt: the version of this file first committed with the modified gs-xpdf-4.00.tar.gz. For getting xpdf-tools to compile with dynamic linking and with the current setup of XPDFTOOLS.sh There are comments in the modified CMakeLists.txt file above to provide URLs explaining why I made various changes.