I am new to crosscompiling and I followed the steps from using-crosstool-ng-and-cygwin by MAKSYM SHYTE
The crosstool fails to build gettext when generating crosscompiler for i686-nptl-linux-gnu target
build = x86_64-unknown-cygwin
host = x86_64-unknown-cygwin
target = i686-nptl-linux-gnu or x86_64-unknown-linux-gnu
NOTE: This gnulib patch from Ken Brown is needed to get gettext module compile. Alternatively, it also compiles if we just comment out #include in /usr/include/sys/types.h as per thorrr from bountysource
[UPDATE1] building gettext module for host gives the exact same errors for the x86_64-unknown-linux-gnu target also.
The ct-ng build fails in the linking phase while building gettext module for host.
[ALL ] libtool: link: x86_64-build_unknown-cygwin-g++ -shared -nostdlib
/usr/lib/gcc/x86_64-pc-cygwin/5.4.0/crtbeginS.o
.libs/libgettextsrc_la-message.o .libs/libgettextsrc_la-po-error.o
.libs/libgettextsrc_la-po-xerror.o .libs/libgettextsrc_la-read-catalog-abstract.o
.libs/libgettextsrc_la-po-lex.o .libs/libgettextsrc_la-po-gram-gen.o
.libs/libgettextsrc_la-po-charset.o .libs/libgettextsrc_la-read-po.o
.libs/libgettextsrc_la-read-properties.o .libs/libgettextsrc_la-read-stringtable.o
.libs/libgettextsrc_la-open-catalog.o .libs/libgettextsrc_la-dir-list.o
.libs/libgettextsrc_la-str-list.o .libs/libgettextsrc_la-read-catalog.o
../woe32dll/.libs/libgettextsrc_la-c++color.o ../woe32dll/.libs/libgettextsrc_la-c++write-catalog.o
../woe32dll/.libs/libgettextsrc_la-c++write-properties.o
../woe32dll/.libs/libgettextsrc_la-c++write-stringtable.o
../woe32dll/.libs/libgettextsrc_la-c++write-po.o
.libs/libgettextsrc_la-msgl-ascii.o .libs/libgettextsrc_la-msgl-iconv.o
.libs/libgettextsrc_la-msgl-equal.o .libs/libgettextsrc_la-msgl-cat.o
.libs/libgettextsrc_la-msgl-header.o .libs/libgettextsrc_la-msgl-english.o
.libs/libgettextsrc_la-msgl-check.o .libs/libgettextsrc_la-file-list.o
.libs/libgettextsrc_la-msgl-charset.o .libs/libgettextsrc_la-po-time.o
.libs/libgettextsrc_la-plural-exp.o .libs/libgettextsrc_la-plural-eval.o
.libs/libgettextsrc_la-plural-table.o .libs/libgettextsrc_la-sentence.o
.libs/libgettextsrc_la-libexpat-compat.o ../woe32dll/.libs/libgettextsrc_la-c++format.o
.libs/libgettextsrc_la-format-c.o .libs/libgettextsrc_la-format-sh.o
.libs/libgettextsrc_la-format-python.o .libs/libgettextsrc_la-format-python-brace.o
.libs/libgettextsrc_la-format-lisp.o .libs/libgettextsrc_la-format-elisp.o
.libs/libgettextsrc_la-format-librep.o .libs/libgettextsrc_la-format-scheme.o
.libs/libgettextsrc_la-format-java.o .libs/libgettextsrc_la-format-csharp.o
.libs/libgettextsrc_la-format-awk.o .libs/libgettextsrc_la-format-pascal.o
.libs/libgettextsrc_la-format-ycp.o .libs/libgettextsrc_la-format-tcl.o
.libs/libgettextsrc_la-format-perl.o .libs/libgettextsrc_la-format-perl-brace.o
.libs/libgettextsrc_la-format-php.o .libs/libgettextsrc_la-format-gcc-internal.o
.libs/libgettextsrc_la-format-gfc-internal.o .libs/libgettextsrc_la-format-qt.o
.libs/libgettextsrc_la-format-qt-plural.o .libs/libgettextsrc_la-format-kde.o
.libs/libgettextsrc_la-format-kde-kuit.o .libs/libgettextsrc_la-format-boost.o
.libs/libgettextsrc_la-format-lua.o .libs/libgettextsrc_la-format-javascript.o
.libs/libgettextsrc_la-read-desktop.o ../woe32dll/.libs/libgettextsrc_la-gettextsrc-exports.o
-L/home/admin/l64/.build/i686-nptl-linux-gnu/build/build-gettext-host-x86_64-build_unknown-cygwin/gettext-tools/intl/.libs
../gnulib-lib/.libs/libgettextlib.dll.a
-L/home/admin/l64/.build/i686-nptl-linux-gnu/buildtools/lib /home/admin/l64/.build/i686-nptl-linux-gnu/build/build-gettext-host-x86_64-build_unknown-cygwin/gettext-tools/intl/.libs/libintl.dll.a
-lncurses ../intl/.libs/libintl.dll.a /home/admin/l64/.build/i686-nptl-linux-gnu/buildtools/lib/libiconv.dll.a
-L/usr/lib/gcc/x86_64-pc-cygwin/5.4.0
-L/usr/lib/gcc/x86_64-pc-cygwin/5.4.0/../../../../x86_64-pc-cygwin/lib/../lib
-L/usr/lib/gcc/x86_64-pc-cygwin/5.4.0/../../../../lib -L/lib/../lib
-L/usr/lib/../lib -L/usr/lib/gcc/x86_64-pc-cygwin/5.4.0/../../../../x86_64-pc-cygwin/lib
-L/usr/lib/gcc/x86_64-pc-cygwin/5.4.0/../../.. -lstdc++ -lgcc_s -lgcc
-lcygwin -ladvapi32 -lshell32 -luser32 -lkernel32 -lgcc_s -lgcc
/usr/lib/gcc/x86_64-pc-cygwin/5.4.0/crtend.o -g -O2
-Wl,--export-all-symbols -Wl,--disable-auto-import -o .libs/cyggettextsrc-0-19-6.dll
-Wl,--enable-auto-image-base -Xlinker --out-implib -Xlinker .libs/libgettextsrc.dll.a
[ALL ] .libs/libgettextsrc_la-libexpat-compat.o: In function `is_XML_LARGE_SIZE_ABI':
[ALL ] /home/admin/l64/.build/i686-nptl-linux-gnu/build/build-gettext-host-x86_64-build_unknown-cygwin/gettext-tools/src/libexpat-compat.c:74: undefined reference to `XML_GetFeatureList'
[ALL ] /home/admin/l64/.build/i686-nptl-linux-gnu/build/build-gettext-host-x86_64-build_unknown-cygwin/gettext-tools/src/libexpat-compat.c:74:(.text+0x28): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `XML_GetFeatureList'
[ALL ] .libs/libgettextsrc_la-libexpat-compat.o: In function `rpl_XML_GetCurrentLineNumber':
[ALL ] /home/admin/l64/.build/i686-nptl-linux-gnu/build/build-gettext-host-x86_64-build_unknown-cygwin/gettext-tools/src/libexpat-compat.c:90: undefined reference to `XML_GetCurrentLineNumber'
[ALL ] /home/admin/l64/.build/i686-nptl-linux-gnu/build/build-gettext-host-x86_64-build_unknown-cygwin/gettext-tools/src/libexpat-compat.c:90:(.text+0x96): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `XML_GetCurrentLineNumber'
[ALL ] .libs/libgettextsrc_la-libexpat-compat.o: In function `rpl_XML_GetCurrentColumnNumber':
[ALL ] /home/admin/l64/.build/i686-nptl-linux-gnu/build/build-gettext-host-x86_64-build_unknown-cygwin/gettext-tools/src/libexpat-compat.c:99: undefined reference to `XML_GetCurrentColumnNumber'
[ALL ] /home/admin/l64/.build/i686-nptl-linux-gnu/build/build-gettext-host-x86_64-build_unknown-cygwin/gettext-tools/src/libexpat-compat.c:99:(.text+0xb6): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `XML_GetCurrentColumnNumber'
[ALL ] .libs/libgettextsrc_la-format-kde-kuit.o: In function `format_parse':
[ALL ] /home/admin/l64/.build/i686-nptl-linux-gnu/build/build-gettext-host-x86_64-build_unknown-cygwin/gettext-tools/src/format-kde-kuit.c:236: undefined reference to `XML_ParserCreate'
[ALL ] /home/admin/l64/.build/i686-nptl-linux-gnu/build/build-gettext-host-x86_64-build_unknown-cygwin/gettext-tools/src/format-kde-kuit.c:236:(.text+0x27d): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `XML_ParserCreate'
[ALL ] /home/admin/l64/.build/i686-nptl-linux-gnu/build/build-gettext-host-x86_64-build_unknown-cygwin/gettext-tools/src/format-kde-kuit.c:244: undefined reference to `XML_SetElementHandler'
[ALL ] /home/admin/l64/.build/i686-nptl-linux-gnu/build/build-gettext-host-x86_64-build_unknown-cygwin/gettext-tools/src/format-kde-kuit.c:244:(.text+0x29f): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `XML_SetElementHandler'
[ALL ] /home/admin/l64/.build/i686-nptl-linux-gnu/build/build-gettext-host-x86_64-build_unknown-cygwin/gettext-tools/src/format-kde-kuit.c:248: undefined reference to `XML_Parse'
[ALL ] /home/admin/l64/.build/i686-nptl-linux-gnu/build/build-gettext-host-x86_64-build_unknown-cygwin/gettext-tools/src/format-kde-kuit.c:248:(.text+0x2b8): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `XML_Parse'
[ALL ] /home/admin/l64/.build/i686-nptl-linux-gnu/build/build-gettext-host-x86_64-build_unknown-cygwin/gettext-tools/src/format-kde-kuit.c:258: undefined reference to `XML_Parse'
[ALL ] /home/admin/l64/.build/i686-nptl-linux-gnu/build/build-gettext-host-x86_64-build_unknown-cygwin/gettext-tools/src/format-kde-kuit.c:258:(.text+0x2d3): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `XML_Parse'
[ALL ] /home/admin/l64/.build/i686-nptl-linux-gnu/build/build-gettext-host-x86_64-build_unknown-cygwin/gettext-tools/src/format-kde-kuit.c:269: undefined reference to `XML_ParserFree'
[ALL ] /home/admin/l64/.build/i686-nptl-linux-gnu/build/build-gettext-host-x86_64-build_unknown-cygwin/gettext-tools/src/format-kde-kuit.c:269:(.text+0x2eb): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `XML_ParserFree'
[ALL ] /home/admin/l64/.build/i686-nptl-linux-gnu/build/build-gettext-host-x86_64-build_unknown-cygwin/gettext-tools/src/format-kde-kuit.c:261: undefined reference to `XML_GetErrorCode'
[ALL ] /home/admin/l64/.build/i686-nptl-linux-gnu/build/build-gettext-host-x86_64-build_unknown-cygwin/gettext-tools/src/format-kde-kuit.c:261:(.text+0x4ec): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `XML_GetErrorCode'
[ALL ] /home/admin/l64/.build/i686-nptl-linux-gnu/build/build-gettext-host-x86_64-build_unknown-cygwin/gettext-tools/src/format-kde-kuit.c:261: undefined reference to `XML_ErrorString'
[ALL ] /home/admin/l64/.build/i686-nptl-linux-gnu/build/build-gettext-host-x86_64-build_unknown-cygwin/gettext-tools/src/format-kde-kuit.c:261:(.text+0x4f3): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `XML_ErrorString'
[ALL ] /home/admin/l64/.build/i686-nptl-linux-gnu/build/build-gettext-host-x86_64-build_unknown-cygwin/gettext-tools/src/format-kde-kuit.c:264: undefined reference to `XML_ParserFree'
[ALL ] /home/admin/l64/.build/i686-nptl-linux-gnu/build/build-gettext-host-x86_64-build_unknown-cygwin/gettext-tools/src/format-kde-kuit.c:264:(.text+0x52a): additional relocation overflows omitted from the output
[ERROR] collect2: error: ld returned 1 exit status
[ERROR] make[6]: *** [Makefile:2388: libgettextsrc.la] Error 1
[ALL ] make[6]: Leaving directory '/home/admin/l64/.build/i686-nptl-linux-gnu/build/build-gettext-host-x86_64-build_unknown-cygwin/gettext-tools/src'
[ERROR] make[5]: *** [Makefile:2300: all] Error 2
[ALL ] make[5]: Leaving directory '/home/admin/l64/.build/i686-nptl-linux-gnu/build/build-gettext-host-x86_64-build_unknown-cygwin/gettext-tools/src'
[ERROR] make[4]: *** [Makefile:1742: all-recursive] Error 1
[ALL ] make[4]: Leaving directory '/home/admin/l64/.build/i686-nptl-linux-gnu/build/build-gettext-host-x86_64-build_unknown-cygwin/gettext-tools'
[ERROR] make[3]: *** [Makefile:1608: all] Error 2
[ALL ] make[3]: Leaving directory '/home/admin/l64/.build/i686-nptl-linux-gnu/build/build-gettext-host-x86_64-build_unknown-cygwin/gettext-tools'
[ERROR] make[2]: *** [Makefile:380: all-recursive] Error 1
[ALL ] make[2]: Leaving directory '/home/admin/l64/.build/i686-nptl-linux-gnu/build/build-gettext-host-x86_64-build_unknown-cygwin'
[ERROR] make[1]: *** [Makefile:336: all] Error 2
[ALL ] make[1]: Leaving directory '/home/admin/l64/.build/i686-nptl-linux-gnu/build/build-gettext-host-x86_64-build_unknown-cygwin'
[ERROR]
[ERROR] >>
[ERROR] >> Build failed in step 'Installing gettext for host'
[ERROR] >> called in step '(top-level)'
[ERROR] >>
[ERROR] >> Error happened in: CT_DoExecLog[scripts/functions@257]
[ERROR] >> called from: do_gettext_backend[scripts/build/companion_libs/330-gettext.sh@131]
[ERROR] >> called from: do_gettext_for_host[scripts/build/companion_libs/330-gettext.sh@63]
[ERROR] >> called from: do_companion_libs_for_host[scripts/build/companion_libs.sh@36]
[ERROR] >> called from: main[scripts/crosstool-NG.sh@646]
[ERROR] >>
[ERROR] >> For more info on this error, look at the file: 'build.log'
[UPDATE2] filled in all the logs before "collect2: error: ld returned 1 exit status"
1) The build logs show that the "building and installing gettext module for build" succeeding but it failing when "building and installing gettext module for host" - What could be the difference since build and host architecture is the same - x86/cygwin ?? Am I missing any configuration settings?
2) If anyone got the crosstool-ng working on recent cygwin releases for a linux 64/32bit targets, please share detailed steps or links.
[UPDATE3]
As I was going no where trying to crosscompile for linux(ubuntu) I tried arm-unknown-linux-gnueabi and armv7-rpi2-linux-gnueabihf targets, cygwin can generate the cross-compoilers just fine for both targets. Its strange that crosscompiler generation for 32 and 64 bit plain linux target fails in Cygwin. I am probably missing something trivial.
[/UPDATE3]
Anyone with recent success on (x86/i686)_linux target please share your steps or links.
[ERROR] collect2: error: ld returned 1 exit status
? – matzeriundefined reference to 'XML_GetFeatureList'
is the error. You need to link your lib against a library that provide that simbol. It can be an external lib. – matzeri