Changeset 32256 for gs2-extensions/xpdf-tools/trunk
- Timestamp:
- 2018-07-11T17:46:20+12:00 (6 years ago)
- Location:
- gs2-extensions/xpdf-tools/trunk/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
gs2-extensions/xpdf-tools/trunk/src/GS-README.txt
r32255 r32256 128 128 129 129 130 2. To compile Xpdf-Tools dynamically and make it find *our* dynamically linked libraries for its helper packages zlib, libpng and freetype, edit packages/CASCADE-MAKE/XPDFTOOLS.sh to contain:130 2. To compile Xpdf-Tools dynamically and make it find *our* dynamically linked libraries for its helper packages zlib, libpng, libjpeg and freetype, edit packages/CASCADE-MAKE/XPDFTOOLS.sh to contain: 131 131 132 132 cmake -DCMAKE_BUILD_TYPE=Release \ … … 134 134 -DZLIB_LIBRARY=$prefix/lib/libz.so.1.2.7 \ # <========= THIS 135 135 -DPNG_LIBRARY=$prefix/lib/libpng15.so.15.30.0 \ # <========= THIS 136 -DJPEG_LIBRARY=$prefix/lib/libjpeg.so.PUT_THE_NUMBER_HERE \ # <========= THIS AND ENTER THE .SO VERSION NUMBER 136 137 -DFREETYPE_LIBRARY=$prefix/lib/libfreetype.so.6.3.20 \ # <========= THIS 137 138 -DCMAKE_DISABLE_FIND_PACKAGE_Qt4=1 \ … … 207 208 Since we're compiling up freetype, libpng and zlib packages as part of the Xpdf-Tools GS2-extension with CASCADE-MAKE, the next step was to compile xpdf-tools by dynamically linking against our .so files for these 3 libraries. To do so, XPDFTOOL.sh should have the following changes 208 209 209 (1) set up CFLAGS, CXXFLAGS, CPPFLAGS and LDFLAGS to help linkage of xpdf-tools find our .so versions of the necessary libs: 210 (1) For linux, we need to build on the LSB environment. 211 We're moreover hoping that 32 bit binaries generated this way will work on both 32 and 64 bit machines. 212 213 However, on the 32 bit LSB environment, we additionally need to pass in "-march=i486|i586|i686" to gcc 214 Without it, things end up with the error 215 undefined reference to `__sync_add_and_fetch_4' 216 See https://stackoverflow.com/questions/130740/link-error-when-compiling-gcc-atomic-operation-in-32-bit-mode 217 which further explains that 218 "-march=" means "generate code for a particular CPU (and don't run on older CPUs)". 219 So, although uname -m returns i686 on the 32 bit linux VM that generates the nightly bins, we 220 still want to support i586 and i486 systems, so passing that in as the architecture 221 Don't do this for 64 bit systems. 222 And it seems it only needs to be set on CXXFLAGS in this case. 223 224 arch=`uname -m` 225 if [[ $arch = *"64"* ]]; then 226 arch= 227 else 228 echo "@@@ 32 bit machine, need to pass in -march=i486 to avoid certain linking errors" 229 arch="-march=i486" 230 fi 231 ... 232 export CXXFLAGS="$CXXFLAGS -I$GEXTXPDFTOOLS_INSTALLED/include -I$GEXTXPDFTOOLS_INSTALLED/include/libpng15 $arch" 233 234 (2) set up CFLAGS, CXXFLAGS, CPPFLAGS and LDFLAGS to help linkage of xpdf-tools find our .so versions of the necessary libs: 210 235 211 236 export CFLAGS="$CFLAGS -I$GEXTXPDFTOOLS_INSTALLED/include -I$GEXTXPDFTOOLS_INSTALLED/include/libpng15" 212 237 export CPPFLAGS="$CPPFLAGS -I$GEXTXPDFTOOLS_INSTALLED/include -I$GEXTXPDFTOOLS_INSTALLED/include/libpng15" 213 export CXXFLAGS="$CXXFLAGS -I$GEXTXPDFTOOLS_INSTALLED/include -I$GEXTXPDFTOOLS_INSTALLED/include/libpng15 "238 export CXXFLAGS="$CXXFLAGS -I$GEXTXPDFTOOLS_INSTALLED/include -I$GEXTXPDFTOOLS_INSTALLED/include/libpng15 $arch" 214 239 export LDFLAGS="$LDFLAGS -L$GEXTXPDFTOOLS_INSTALLED/lib" 215 240 216 ( 2) The CMAKE command we run must pass the full paths to the actual .so library files (the ones with specific241 (3) The CMAKE command we run must pass the full paths to the actual .so library files (the ones with specific 217 242 versions in their files names) rather than the symbolically linked generally-named .so files (the latter won't 218 243 be found when building xpdf-tools and CMake will try to look for the .so library files elsewhere on the system): … … 239 264 240 265 241 ( 3) Since CMakeLists.txt has been modified, we initially renamed the xpdf src tarball to gs-xpdf-4.00.tar.gz.266 (4) Since CMakeLists.txt has been modified, we initially renamed the xpdf src tarball to gs-xpdf-4.00.tar.gz. 242 267 However, the current version works with the regular downloaded xpdf-4.00.tar.gz tarball. But after extraction, 243 268 XPDFTOOLS.sh copies across the custom packages/gs-CMakeLists.txt into the extracted tarball's xpdf subdirectory, … … 362 387 Initial attempts at modifying gs-CMakeLists.txt for static compiling that proved to be unnecessary: 363 388 364 ( 1) Setting -static globally doesn't have a useful effect.389 (i) Setting -static globally doesn't have a useful effect. 365 390 366 391 # We want to build static xpdf-tools binaries. See … … 381 406 ---- 382 407 383 ( 2) Threads::Threads instead of -lpthread results in a partially dynamic executable.408 (ii) Threads::Threads instead of -lpthread results in a partially dynamic executable. 384 409 385 410 # The original, unmodified CMakeLists.txt was not set up sufficiently … … 404 429 405 430 406 (5)To view the unmodified CMakeLists.txt included in the xpdf-4.00 source code tarball, untar it and look for its "xpdf/CMakeLists.txt" (not the toplevel file of the same name).431 5. To view the unmodified CMakeLists.txt included in the xpdf-4.00 source code tarball, untar it and look for its "xpdf/CMakeLists.txt" (not the toplevel file of the same name). 407 432 Run a 'diff' against gs-CMakeLists.txt to see further differences, such as debug statements and comments. Most comments have been removed and placed into this readme file instead. 408 433 409 434 410 (6)When CASCADE-MAKE is run on the xpdf-tools GS2-extension, it first compiles up CMake, needed to compile up xpdf-tools.435 6. When CASCADE-MAKE is run on the xpdf-tools GS2-extension, it first compiles up CMake, needed to compile up xpdf-tools. 411 436 Unlike the library packages like freetype, libpng and zlib that we also build for xpdf-tools as part of this gs2-extension, CMake's build products don't need to be included in the distribution tarball of our built xpdf-tools executables. 412 437 -
gs2-extensions/xpdf-tools/trunk/src/packages/CASCADE-MAKE/XPDFTOOLS.sh
r32249 r32256 12 12 prefix=$GEXTXPDFTOOLS_INSTALLED 13 13 14 # When trying to compile xpdf-tools on a 32 bit linux LSB, we get the error 15 # "undefined reference to `__sync_add_and_fetch_4'" unless we follow the instructions at 16 # https://stackoverflow.com/questions/130740/link-error-when-compiling-gcc-atomic-operation-in-32-bit-mode 17 # and append to CXXFLAGS "-march=i486", which is the earliest architecture for which compilation 18 # succeeds and the xpdftool binaries produced work (even though our 32 bit LSB is i686). 19 arch=`uname -m` 20 if [[ $arch = *"64"* ]]; then 21 arch= 22 else 23 echo "@@@ 32 bit unix, passing in -march=i486 to avoid certain linking errors" 24 arch="-march=i486" 25 fi 26 14 27 # Use C/CPP/CXX FLAGS and LDFLAGS for further setting up 15 28 # libpng and libz for compiling xpdftools 16 29 export CFLAGS="$CFLAGS -I$GEXTXPDFTOOLS_INSTALLED/include -I$GEXTXPDFTOOLS_INSTALLED/include/libpng15" 17 30 export CPPFLAGS="$CPPFLAGS -I$GEXTXPDFTOOLS_INSTALLED/include -I$GEXTXPDFTOOLS_INSTALLED/include/libpng15" 18 export CXXFLAGS="$CXXFLAGS -I$GEXTXPDFTOOLS_INSTALLED/include -I$GEXTXPDFTOOLS_INSTALLED/include/libpng15 "31 export CXXFLAGS="$CXXFLAGS -I$GEXTXPDFTOOLS_INSTALLED/include -I$GEXTXPDFTOOLS_INSTALLED/include/libpng15 $arch" 19 32 export LDFLAGS="$LDFLAGS -L$GEXTXPDFTOOLS_INSTALLED/lib" 20 33 … … 114 127 115 128 ## For building dynamic xpdf-tools executables, change the above to have the following instead 116 ## (still unable get the .so for LIBJPEG generated, so could try JPEG_LIBRARY set same as above)129 ## The .so for LIBJPEG gets generated for libjpeg version 9c (but not 6b). Correct the .so version number below. 117 130 # -DZLIB_LIBRARY=$prefix/lib/libz.so.1.2.7 \ 118 131 # -DTIFF_LIBRARY=$prefix/lib/libtiff.so.5.2.2 \ 119 132 # -DPNG_LIBRARY=$prefix/lib/libpng15.so.15.30.0 \ 133 # -DJPEG_LIBRARY=$prefix/lib/libjpeg.so.PUT_THE_NUMBER_HERE \ 120 134 # -DFREETYPE_LIBRARY=$prefix/lib/libfreetype.so.6.3.20 \ 121 135 # (The 3rd line can alternatively be "-DFREETYPE_DIR=$prefix")
Note:
See TracChangeset
for help on using the changeset viewer.