我试图在自己构建的 ImageMagick 中添加对 FlashPIX 格式的支持。为了实现这一点,我从为代表提供的 ImageMagick FTP 服务器,并编译源代码以制作 2 个 Debian 软件包:libfpx
和libfpx-dev
。
在配置时,可以看到并使用头文件:
configure:28755: checking for FlashPIX
configure:28755: checking for FlashPIX
configure:28757: result:
configure:28768: checking fpxlib.h usability
configure:28768: g++ -c -O3 -g3 -pthread -DMAGICKCORE_HDRI_ENABLE=1 -DMAGICKCORE_QUANTUM_DEPTH=16 conftest.cpp >&5
configure:28768: $? = 0
configure:28768: result: yes
configure:28768: checking fpxlib.h presence
configure:28768: g++ -E -DMAGICKCORE_HDRI_ENABLE=1 -DMAGICKCORE_QUANTUM_DEPTH=16 conftest.cpp
configure:28768: $? = 0
configure:28768: result: yes
configure:28768: checking for fpxlib.h
configure:28768: result: yesconfigure:28757: result:
configure:28768: checking fpxlib.h usability
configure:28768: g++ -c -O3 -g3 -pthread -DMAGICKCORE_HDRI_ENABLE=1 -DMAGICKCORE_QUANTUM_DEPTH=16 conftest.cpp >&5
configure:28768: $? = 0
configure:28768: result: yes
configure:28768: checking fpxlib.h presence
configure:28768: g++ -E -DMAGICKCORE_HDRI_ENABLE=1 -DMAGICKCORE_QUANTUM_DEPTH=16 conftest.cpp
configure:28768: $? = 0
configure:28768: result: yes
configure:28768: checking for fpxlib.h
configure:28768: result: yes
但是,configtest.cpp
编译返回共享库libfpx.so
(指向 的符号链接libfpx.so.1.0.31
)中未定义引用的链接错误。看起来大多数都是在通过 -lm 链接的数学库中定义的。虽然我没有看到声明#include <math.h>
在头文件中的什么位置。
在 config.log 中我看到:
checking for FPX_OpenImageByFilename in -lfpx
$ g++ -o conftest -O3 -g3 -pthread -DMAGICKCORE_HDRI_ENABLE=1 -DMAGICKCORE_QUANTUM_DEPTH=16 conftest.cpp -lfpx -lfftw3 -ldjvulibre -lz -lXext -lXt -lSM -lICE -lX11 -lbz2 -lgomp -lm >&5
/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../x86_64-linux-gnu/libfpx.so: undefined reference to `operator delete(void*)'
/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../x86_64-linux-gnu/libfpx.so: undefined reference to `operator new[](unsigned long)'
/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../x86_64-linux-gnu/libfpx.so: undefined reference to `atan2'
/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../x86_64-linux-gnu/libfpx.so: undefined reference to `std::ios_base::Init::~Init()'
/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../x86_64-linux-gnu/libfpx.so: undefined reference to `__cxa_pure_virtual'
/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../x86_64-linux-gnu/libfpx.so: undefined reference to `operator delete[](void*)'
/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../x86_64-linux-gnu/libfpx.so: undefined reference to `__gxx_personality_v0'
/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../x86_64-linux-gnu/libfpx.so: undefined reference to `std::ios_base::Init::Init()'
/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../x86_64-linux-gnu/libfpx.so: undefined reference to `vtable for __cxxabiv1::__si_class_type_info'
/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../x86_64-linux-gnu/libfpx.so: undefined reference to `pow'
/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../x86_64-linux-gnu/libfpx.so: undefined reference to `operator new(unsigned long)'
/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../x86_64-linux-gnu/libfpx.so: undefined reference to `sqrt'
/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../x86_64-linux-gnu/libfpx.so: undefined reference to `sincosf'
/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../x86_64-linux-gnu/libfpx.so: undefined reference to `vtable for __cxxabiv1::__class_type_info'
/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../x86_64-linux-gnu/libfpx.so: undefined reference to `vtable for __cxxabiv1::__vmi_class_type_info'
collect2: ld returned 1 exit status
以下是供参考的conftest.cpp文件:
/* confdefs.h */
#define PACKAGE_NAME "ImageMagick"
#define PACKAGE_TARNAME "ImageMagick"
#define PACKAGE_VERSION "6.8.6-10"
#define PACKAGE_STRING "ImageMagick 6.8.6-10"
#define PACKAGE_BUGREPORT "http://www.imagemagick.org"
#define PACKAGE_URL ""
#define MAGICK_TARGET_CPU x86_64
#define MAGICK_TARGET_VENDOR unknown
#define MAGICK_TARGET_OS linux-gnu
#define PACKAGE "ImageMagick"
#define VERSION "6.8.6-10"
#define STDC_HEADERS 1
#define HAVE_SYS_TYPES_H 1
#define HAVE_SYS_STAT_H 1
#define HAVE_STDLIB_H 1
#define HAVE_STRING_H 1
#define HAVE_MEMORY_H 1
#define HAVE_STRINGS_H 1
#define HAVE_INTTYPES_H 1
#define HAVE_STDINT_H 1
#define HAVE_UNISTD_H 1
#define __EXTENSIONS__ 1
#define _ALL_SOURCE 1
#define _GNU_SOURCE 1
#define _POSIX_PTHREAD_SEMANTICS 1
#define _TANDEM_SOURCE 1
#define HAVE___ATTRIBUTE__ 1
#define HAVE_PTHREAD_PRIO_INHERIT 1
#define HAVE_PTHREAD 1
#define THREAD_SUPPORT 1
#define HAVE_PTHREAD_PRIO_INHERIT 1
#define HAVE_PTHREAD 1
#define HAVE_FSEEKO 1
#define HAVE_DLFCN_H 1
#define LT_OBJDIR ".libs/"
#define INSTALLED_SUPPORT 1
#define CIPHER_SUPPORT 1
#define HDRI_ENABLE_OBSOLETE_IN_H 1
#define QUANTUM_DEPTH_OBSOLETE_IN_H 16
#define STDC_HEADERS 1
#define HAVE_DIRENT_H 1
#define HAVE_ARPA_INET_H 1
#define HAVE_COMPLEX_H 1
#define HAVE_ERRNO_H 1
#define HAVE_FCNTL_H 1
#define HAVE_LIMITS_H 1
#define HAVE_LINUX_UNISTD_H 1
#define HAVE_LOCALE_H 1
#define HAVE_NETINET_IN_H 1
#define HAVE_STDARG_H 1
#define HAVE_SYS_IPC_H 1
#define HAVE_SYS_MMAN_H 1
#define HAVE_SYS_RESOURCE_H 1
#define HAVE_SYS_SOCKET_H 1
#define HAVE_SYS_TIME_H 1
#define HAVE_SYS_TIMEB_H 1
#define HAVE_SYS_TIMES_H 1
#define HAVE_SYS_WAIT_H 1
#define HAVE_WCHAR_H 1
#define HAVE_XLOCALE_H 1
#define HAVE__BOOL 1
#define HAVE_STDBOOL_H 1
#define HAVE_STRINGIZE 1
#define TIME_WITH_SYS_TIME 1
#define HAVE_STRUCT_TM_TM_ZONE 1
#define HAVE_TM_ZONE 1
#define restrict __restrict
#define HAVE_UNSIGNED_LONG_LONG_INT 1
#define HAVE_LONG_LONG_INT 1
#define HAVE_INTMAX_T 1
#define HAVE_INTPTR_T 1
#define HAVE_LONG_DOUBLE 1
#define HAVE_LONG_DOUBLE_WIDER 1
#define HAVE_LONG_LONG_INT 1
#define HAVE_MBSTATE_T 1
#define HAVE_UINTMAX_T 1
#define HAVE_UINTPTR_T 1
#define HAVE_UNSIGNED_LONG_LONG_INT 1
#define HAVE_FLOAT_T 1
#define HAVE_DOUBLE_T 1
#define SIZEOF_FLOAT_T 4
#define SIZEOF_DOUBLE_T 8
#define SIZEOF_FLOAT 4
#define SIZEOF_DOUBLE 8
#define SIZEOF_LONG_DOUBLE 16
#define SIZEOF_SIGNED_SHORT 2
#define SIZEOF_UNSIGNED_SHORT 2
#define SIZEOF_SIGNED_INT 4
#define SIZEOF_UNSIGNED_INT 4
#define SIZEOF_SIGNED_LONG 8
#define SIZEOF_UNSIGNED_LONG 8
#define SIZEOF_SIGNED_LONG_LONG 8
#define SIZEOF_UNSIGNED_LONG_LONG 8
#define SIZEOF_OFF_T 8
#define SIZEOF_SIZE_T 8
#define SIZEOF_SSIZE_T 8
#define SIZEOF_UNSIGNED_INTP 8
#define HAVE_STDLIB_H 1
#define HAVE_UNISTD_H 1
#define HAVE_SYS_PARAM_H 1
#define HAVE_GETPAGESIZE 1
#define HAVE_MMAP 1
#define HAVE_FORK 1
#define HAVE_VFORK 1
#define HAVE_WORKING_VFORK 1
#define HAVE_WORKING_FORK 1
#define HAVE_SYS_SELECT_H 1
#define HAVE_SYS_SOCKET_H 1
#define SELECT_TYPE_ARG1 int
#define SELECT_TYPE_ARG234 (fd_set *)
#define SELECT_TYPE_ARG5 (struct timeval *)
#define RETSIGTYPE void
#define HAVE_DECL_STRERROR_R 1
#define HAVE_STRERROR_R 1
#define STRERROR_R_CHAR_P 1
#define HAVE_VPRINTF 1
#define HAVE_SOCKET 1
#define HAVE_ACOSH 1
#define HAVE_ASINH 1
#define HAVE_ATANH 1
#define HAVE_ATOLL 1
#define HAVE_ATEXIT 1
#define HAVE_CABS 1
#define HAVE_CARG 1
#define HAVE_CIMAG 1
#define HAVE_CREAL 1
#define HAVE_CLOCK 1
#define HAVE_CTIME_R 1
#define HAVE__EXIT 1
#define HAVE_EXECVP 1
#define HAVE_FCHMOD 1
#define HAVE_FLOOR 1
#define HAVE_FORK 1
#define HAVE_FTIME 1
#define HAVE_FTRUNCATE 1
#define HAVE_GETC_UNLOCKED 1
#define HAVE_GETCWD 1
#define HAVE_GETPID 1
#define HAVE_GETDTABLESIZE 1
#define HAVE_GETPAGESIZE 1
#define HAVE_GETRLIMIT 1
#define HAVE_GETRUSAGE 1
#define HAVE_GETTIMEOFDAY 1
#define HAVE_GMTIME_R 1
#define HAVE_ISNAN 1
#define HAVE_J0 1
#define HAVE_J1 1
#define HAVE_LOCALTIME_R 1
#define HAVE_LSTAT 1
#define HAVE_MEMMOVE 1
#define HAVE_MEMSET 1
#define HAVE_MKSTEMP 1
#define HAVE_MUNMAP 1
#define HAVE_NANOSLEEP 1
#define HAVE_NEWLOCALE 1
#define HAVE_PCLOSE 1
#define HAVE_POLL 1
#define HAVE_POPEN 1
#define HAVE_POSIX_FADVISE 1
#define HAVE_POSIX_FALLOCATE 1
#define HAVE_POSIX_MADVISE 1
#define HAVE_POSIX_MEMALIGN 1
#define HAVE_POSIX_SPAWNP 1
#define HAVE_POW 1
#define HAVE_PREAD 1
#define HAVE_PWRITE 1
#define HAVE_QSORT_R 1
#define HAVE_RAISE 1
#define HAVE_RAND_R 1
#define HAVE_READLINK 1
#define HAVE_READDIR_R 1
#define HAVE_REALPATH 1
#define HAVE_SELECT 1
#define HAVE_SEEKDIR 1
#define HAVE_SETLOCALE 1
#define HAVE_SOCKET 1
#define HAVE_SQRT 1
#define HAVE_SETVBUF 1
#define HAVE_STAT 1
#define HAVE_STRCHR 1
#define HAVE_STRERROR_R 1
#define HAVE_STRRCHR 1
#define HAVE_STRCSPN 1
#define HAVE_STRDUP 1
#define HAVE_STRPBRK 1
#define HAVE_STRSPN 1
#define HAVE_STRSTR 1
#define HAVE_STRTOD 1
#define HAVE_STRTOD_L 1
#define HAVE_STRTOL 1
#define HAVE_STRTOUL 1
#define HAVE_SYMLINK 1
#define HAVE_SYSCONF 1
#define HAVE_SIGEMPTYSET 1
#define HAVE_SIGACTION 1
#define HAVE_STRERROR 1
#define HAVE_STRCASECMP 1
#define HAVE_STRNCASECMP 1
#define HAVE_TELLDIR 1
#define HAVE_TEMPNAM 1
#define HAVE_TIMES 1
#define HAVE_USELOCALE 1
#define HAVE_USLEEP 1
#define HAVE_UTIME 1
#define HAVE_VFPRINTF 1
#define HAVE_VSPRINTF 1
#define HAVE_VSNPRINTF 1
#define HAVE_WAITPID 1
#define HAVE_CLOCK_GETTIME 1
#define HAVE_CLOCK_REALTIME 1
#define HAVE_DECL_PREAD 1
#define HAVE_DECL_PWRITE 1
#define HAVE_DECL_STRLCPY 0
#define HAVE_DECL_VSNPRINTF 1
#define HAVE_BOOL /**/
#define HAVE_NAMESPACES /**/
#define HAVE_NAMESPACE_STD /**/
#define HAVE_STD_LIBS /**/
#define X11_CONFIGURE_PATH ""
#define BZLIB_DELEGATE 1
#define X11_DELEGATE 1
#define HAVE_SHARED_MEMORY 1
#define HAVE_SHAPE 1
#define ZLIB_DELEGATE 1
#define DJVU_DELEGATE 1
#define FFTW_DELEGATE 1
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char FPX_OpenImageByFilename ();
int
main ()
{
return FPX_OpenImageByFilename ();
;
return 0;
}
ImageMagicks 告诉我他们在 Fedora Linux 上成功构建。但他们无法提供支持。我不知道链接错误源自何处。
答案1
在 g++ 链接共享库上搜索了一段时间后,我决定运行编译命令行,除了 libfpx 之外不使用其他链接库:
$ g++ -o conftest -O3 -g3 -pthread -DMAGICKCORE_HDRI_ENABLE=1 -DMAGICKCORE_QUANTUM_DEPTH=16 conftest.cpp -lfpx
编译时没有错误。然后我尝试查找错误弹出的链接共享库。那是 libdjvulibre 库...从命令行中删除 -ldjvulibre 后,conftest.cpp 再次编译时没有错误:
$ g++ -o conftest -O3 -g3 -pthread -DMAGICKCORE_HDRI_ENABLE=1 -DMAGICKCORE_QUANTUM_DEPTH=16 conftest.cpp -lfpx -lfftw3 -lz -lXext -lXt -lSM -lICE -lX11 -lbz2 -lgomp -lm
给我一个目标文件 conftest。
我确实检查了实现这个共享库的包djvulibre
:它是Official Ubuntu package for Raring 13.04
:包名称是libdjvulibre21
,版本是3.5.25.3-3
。
bug
显然这是ImageMagick configure file.