Erro de link do ImageMagick com libfpx.so: referência indefinida para

0

Eu estava tentando adicionar suporte para o formato FlashPIX em minha própria compilação do ImageMagick. Para conseguir isso eu baixei os fontes libfpx-1.3.1-3.tar.gz do servidor FTP do ImageMagick para os delegados , e compilou as fontes para fazer 2 pacotes Debian: libfpx e libfpx-dev .

No momento da configuração, os arquivos de cabeçalho são vistos e podem ser usados:

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

No entanto, a compilação configtest.cpp retorna um erro de vinculação para referências indefinidas dentro da biblioteca compartilhada libfpx.so (que é um link simbólico para libfpx.so.1.0.31 ). Parece que a maioria é definida na biblioteca de matemática que está vinculada por -lm. Embora eu não veja onde a declaração #include <math.h> está nos arquivos de cabeçalho.

No config.log eu vejo:

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

Aqui está o arquivo conftest.cpp para referência:

/* 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;
}

O ImageMagicks me disse que eles construíram com sucesso em um Fedora Linux. Eles também não podem fornecer suporte. Não vejo onde o erro de vinculação se originou.

    
por Antonio 28.02.2014 / 00:22

1 resposta

0

Após pesquisar por um tempo no g ++ ligando bibliotecas compartilhadas, decidi executar a linha de comando de compilação sem outras bibliotecas vinculadas que a libfpx:

$ g++ -o conftest -O3 -g3 -pthread -DMAGICKCORE_HDRI_ENABLE=1 -DMAGICKCORE_QUANTUM_DEPTH=16 conftest.cpp -lfpx

É compilado sem erros. Então eu tento procurar quais bibliotecas compartilhadas vinculadas o erro apareceu. Essa era a biblioteca libdjvulibre ... Remover o -ldjvulibre da linha de comando tinha o conftest.cpp compilado novamente sem erros:

$ 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

me dá um arquivo de objeto conftest.

Eu verifiquei no pacote que implementa a biblioteca compartilhada djvulibre : é o Official Ubuntu package for Raring 13.04 : o nome do pacote é libdjvulibre21 e a versão é 3.5.25.3-3 .

Obviamente, este é um bug no ImageMagick configure file.

    
por Antonio 28.02.2014 / 13:13