【发布时间】:2018-11-23 00:14:53
【问题描述】:
当我运行make 编译xpdf 时出现以下错误。这似乎与未检测到纸张尺寸有关。我以前没有见过这种错误,通常是导致编译器抱怨的数学库。有没有人遇到过这种错误?
[ 71%] Linking CXX executable pdftohtml
CMakeFiles/xpdf_objs.dir/GlobalParams.cc.o: In function GlobalParams::GlobalParams(char const*)':
GlobalParams.cc:(.text+0xdbd): undefined reference to `paperinit'
GlobalParams.cc:(.text+0xdc2): undefined reference to `systempapername'
GlobalParams.cc:(.text+0xdde): undefined reference to `paperinfo'
GlobalParams.cc:(.text+0xdee): undefined reference to `paperpswidth'
GlobalParams.cc:(.text+0xe05): undefined reference to `paperpsheight'
GlobalParams.cc:(.text+0xe48): undefined reference to `paperdone'
collect2: error: ld returned 1 exit status
make[2]: *** [xpdf/CMakeFiles/pdftohtml.dir/build.make:219: xpdf/pdftohtml] Error 1
make[1]: *** [CMakeFiles/Makefile2:428: xpdf/CMakeFiles/pdftohtml.dir/all] Error 2
make: *** [Makefile:130: all] Error 2
cmake 命令的终端输出是:
$ cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_COMPILER=/usr/bin/g++ .
-- The C compiler identification is GNU 7.3.1
-- The CXX compiler identification is GNU 7.3.1
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/g++
-- Check for working CXX compiler: /usr/bin/g++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Looking for mkstemp
-- Looking for mkstemp - found
-- Looking for mkstemps
-- Looking for mkstemps - found
-- Looking for popen
-- Looking for popen - found
-- Performing Test HAVE_STD_SORT
-- Performing Test HAVE_STD_SORT - Success
-- Looking for fseeko
-- Looking for fseeko - found
-- Looking for fseek64
-- Looking for fseek64 - not found
-- Looking for _fseeki64
-- Looking for _fseeki64 - not found
-- Found FreeType (old-style includes): /usr/lib64/libfreetype.so
-- Found ZLIB: /usr/lib64/libz.so (found version "1.2.11")
-- Found PNG: /usr/lib64/libpng.so (found version "1.6.31")
-- Could NOT find JPEG (missing: JPEG_LIBRARY JPEG_INCLUDE_DIR)
-- Could NOT find TIFF (missing: TIFF_LIBRARY TIFF_INCLUDE_DIR)
-- lcms2 not found
-- Qt5 found
CMake Deprecation Warning at cmake-config.txt:263 (cmake_policy):
The OLD behavior for policy CMP0020 will be removed from a future version
of CMake.
The cmake-policies(7) manual explains that the OLD behaviors of all
policies are deprecated and that a policy should be set to OLD only under
specific short-term circumstances. Projects should be ported to the NEW
behavior and not rely on setting a policy to OLD.
Call Stack (most recent call first):
CMakeLists.txt:15 (include)
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
CMake Deprecation Warning at xpdf-qt/CMakeLists.txt:27 (cmake_policy):
The OLD behavior for policy CMP0020 will be removed from a future version
of CMake.
The cmake-policies(7) manual explains that the OLD behaviors of all
policies are deprecated and that a policy should be set to OLD only under
specific short-term circumstances. Projects should be ported to the NEW
behavior and not rely on setting a policy to OLD.
-- Configuring done
-- Generating done
-- Build files have been written to: /home/usr/build/xpdf-4.00
【问题讨论】:
-
未定义的引用通常是缺少
target_link_libraries调用的结果。你能提供你正在使用的 CMakeLists.txt 吗? -
@vre 这里是Makefile 和MakeList.txt 的链接。
-
@vre 这不是我的代码,但我相信你现在已经知道了。如何自己添加 target_link_library?
-
是的,我知道这不是您的代码。 CMake 试图找到 libpaper 但没有成功。它在
lib或lib64中查找paper或libpaper,但在那里找不到。它要么未安装在您的系统上,要么位于不同的路径中。请发布CMake配置步骤的终端输出并将其附加到您的帖子中。必须有一些关于在您的系统上找不到 libpaper 的通知。在重新运行 CMake 之前删除 CMakeCache.txt 文件。 -
@vre 我已经添加了您要求的终端输出。我注意到输出没有显示任何
cmake试图寻找 libpaper 的记录。我在cmake-config.txt中查看了libpaper 的代码,我认为它缺少告诉cmake去哪里查找的路径。
标签: makefile compiler-errors cmake linker-errors xpdf