libftdi Archives

Subject: cross-compiling libftdi-1.1 with MinGW under Linux (MXE)

From: Samuel Bryner <s.bryner@xxxxxxxxx>
To: libftdi@xxxxxxxxxxxxxxxxxxxxxxx
Date: Wed, 11 Jun 2014 17:28:50 +0200
Hi,

I'm trying to cross-compile libftdi-1.1 with the MXE toolchain
(http://mxe.cc/, uses mingw32) and ran across two issues:

Cmake cannot find gettext() as it's in a separate library and not part
of libc. There's a TODO in the corresponding .cmake file
(cmake/FindLibintl.cmake) for this case but unfortunately I know nothing
of cmake to fix this properly. The following hack works though:

--- a/cmake/FindLibintl.cmake
+++ b/cmake/FindLibintl.cmake
@@ -34,6 +34,7 @@
   else (LIBINTL_LIBC_HAS_DGETTEXT)
     find_library(LIBINTL_LIBRARIES NAMES intl libintl )
     if(LIBINTL_LIBRARIES)
+      set(LIBINTL_LIBRARIES "-lintl -liconv")
       set(LIBINTL_LIB_FOUND TRUE)
     endif(LIBINTL_LIBRARIES)
   endif (LIBINTL_LIBC_HAS_DGETTEXT)

The other thing is that I didn't manage to compile the tests due to some
weird undefined references to boost_test:

Linking CXX executable test_libftdi1.exe
CMakeFiles/test_libftdi1.dir/objects.a(basic.obj):basic.cpp:(.text+0x21): 
undefined
reference to `_imp___ZTVN5boost9unit_test13test_observerE'
CMakeFiles/test_libftdi1.dir/objects.a(basic.obj):basic.cpp:(.text+0x7b): 
undefined
reference to
`_imp___ZN5boost9unit_test15unit_test_log_t14set_checkpointENS0_13basic_cstringIKcEEjS4_'
CMakeFiles/test_libftdi1.dir/objects.a(basic.obj):basic.cpp:(.text+0x198):
undefined reference to
`_imp___ZN5boost10test_tools9tt_detail10check_implERKNS0_16predicate_resultERKNS_9unit_test12lazy_ostreamENS5_13basic_cstringIKcEEjNS1_10tool_levelENS1_10check_typeEjz'
/opt/mxe/usr/lib/gcc/i686-pc-mingw32/4.8.1/../../../../i686-pc-mingw32/bin/ld:
CMakeFiles/test_libftdi1.dir/objects.a(basic.obj): bad reloc address 0x2
in section
`.text$_ZN5boost6detail15sp_counted_baseD1Ev[__ZN5boost6detail15sp_counted_baseD1Ev]'
/opt/mxe/usr/lib/gcc/i686-pc-mingw32/4.8.1/../../../../i686-pc-mingw32/bin/ld:
final link failed: Invalid operation

I tried tracking this down but got nowhere. The only way I got libftdi
to compile was to disable the tests completely by removing
test/CMakeLists.txt.

Some additional information about my environment:

$ i686-pc-mingw32-gcc --version
i686-pc-mingw32-gcc (GCC) 4.8.1

Boost Version: 1.53.0
libusb: 1.0.18
libconfuse: 2.7

Cheers,
Sam



--
libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to libftdi+unsubscribe@xxxxxxxxxxxxxxxxxxxxxxx   

Current Thread