我试图在我自己构建的ImageMagick中添加对FlashPIX格式的支持。为了实现这一目标,我从ImageMagick FTP server for delegates下载了源代码libfpx-1.3.1-3.tar.gz,并编译了源代码以生成2个Debian软件包:libfpx
和libfpx-dev
。
在配置时,头文件可见并且可用,但configtest.cpp
编译会在共享库libfpx.so
(这是libfpx.so.1.0.31
的符号链接)中为未定义的引用返回链接错误。看起来大多数是在数学库中定义的,它由-lm
链接。在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上成功构建。我没有看到链接错误的来源。
答案 0 :(得分:2)
在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 script
。