Opened 13 years ago

Closed 12 years ago

#567 closed defect (fixed)

Cross building with mingw from Linux fails

Reported by: Greg Owned by: Olly Betts
Priority: normal Milestone: 1.2.9
Component: Build system Version: 1.2.7
Severity: normal Keywords:
Cc: Blocked By:
Blocking: Operating System: Linux

Description

I am attempting to build Xapian for 32- and 64-bit Windows using MinGW tools under Ubuntu (a set that I maintain on Launchpad). I am configuring with the options --enable-shared --disable-static --disable-documentation --host=i686-w64-mingw32

as well as passing a number of CFLAGS and LDFLAGS to configure. When it gets to the linking stage I am getting the undefined errors located in the attached file.

Attachments (1)

errors.txt (11.5 KB ) - added by Greg 13 years ago.
Linker invocation and errors resulting from it

Download all attachments as: .zip

Change History (15)

by Greg, 13 years ago

Attachment: errors.txt added

Linker invocation and errors resulting from it

comment:1 by Olly Betts, 13 years ago

Status: newassigned

mingw32 cross-builds used to work, but I'm not sure it's been tested for a while. I don't know of anyone trying 64-bit mingw before though.

The log doesn't suggest anything obvious to me though.

What's the exact configure command you're using (including CFLAGS, etc)?

comment:2 by Richard Boulton, 12 years ago

I've just successfully performed a build of Xapian core under mingw32, using an installation of mingw32 compiled with the makefile from http://mingw-cross-env.nongnu.org/

I had to apply a couple of patches to trunk to remove some compiler warnings to make this succeed, but saw no problems like the ones reported in this patch.

It may be that these problems are something to do with trying a 64 bit mingw build, but this seems a little unlikely to me.

greg: if you're still having problems, can you try again with trunk, and post your exact invocation?

comment:3 by Olly Betts, 12 years ago

Component: OtherBuild system
Milestone: 1.3.0

I've applied a better fix for the warning from FD_SET (well, one which doesn't require us to add more instances of #ifdef __WIN32__ in the code at least) in r16100.

Marking to fix this in trunk first.

comment:4 by Greg, 12 years ago

I was trying to build both 32-bit and 64-bit versions of the library. I am rebuilding the dependent libraries for Ubuntu Oneiric now and will let you know within a day or two and give you more details if the problem persists. The attached errors were specifically with the 32-bit build - I hadn't progressed that far with the 64-bit version yet.

comment:5 by Olly Betts, 12 years ago

Backported the r16100 fix for 1.2.8 in r16130.

greg: How did the rebuilds go?

comment:6 by Greg, 12 years ago

I just tried again now. I had made some significant changes to my toolchain, so I wanted to test both the 1.2.7 release and your git master. Both 64 and 32 bit still give the above errors with 1.2.7 stock.

git head gives the following issue, which seems unrelated:

libtool: compile: /usr/bin/x86_64-w64-mingw32-g++ -DHAVE_CONFIG_H -I. -I/tmp/buildd/mingw64-x-xapian-core-1.2.7+svn20111213 -I/tmp/buildd/mingw64-x-xapian-core-1.2.7+svn20111213/common -I/tmp/buildd/mingw64-x-xapian-core-1.2.7+svn20111213/include -I./include -I/tmp/buildd/mingw64-x-xapian-core-1.2.7+svn20111213/languages -Ilanguages -I/tmp/buildd/mingw64-x-xapian-core-1.2.7+svn20111213/queryparser -fshow-column -Wall -W -Wredundant-decls -Wpointer-arith -Wcast-qual -Wcast-align -Wno-long-long -Wformat-security -fno-gnu-keywords -Wundef -Woverloaded-virtual -Wstrict-null-sentinel -Wshadow -Wstrict-overflow=1 -Winit-self -Wlogical-op -Wmissing-declarations -fvisibility=hidden -I/usr/x86_64-w64-mingw32/sys-root/mingw/include -O2 -g -pipe -Wall -fexceptions -fno-omit-frame-pointer -fno-optimize-sibling-calls --param=ssp-buffer-size=4 -mms-bitfields -MT api/compactor.lo -MD -MP -MF api/.deps/compactor.Tpo -c /tmp/buildd/mingw64-x-xapian-core-1.2.7+svn20111213/api/compactor.cc -DDLL_EXPORT -DPIC -o api/.libs/compactor.o In file included from /tmp/buildd/mingw64-x-xapian-core-1.2.7+svn20111213/api/compactor.cc:57:0: /tmp/buildd/mingw64-x-xapian-core-1.2.7+svn20111213/include/xapian.h:30:26: fatal error: xapian/error.h: No such file or directory compilation terminated.

comment:7 by Olly Betts, 12 years ago

Sounds like you tried to build from git without bootstrapping - see the instructions here (which apply to git as well as SVN):

http://trac.xapian.org/browser/trunk/xapian-core/HACKING#L263

There are also snapshot tarballs which are already bootstrapped, so those are just like releases to build:

http://oligarchy.co.uk/xapian/trunk/

comment:8 by Greg, 12 years ago

I bootstrapped, then attempted to build only the xapian-core. It actually got a good 5 minutes into the build before the error above. The 'find' command confirms that there is no file named error.h anywhere in my checkout. I did execute a './bootstrap --without-autotools' instead of the full bootstrap.

I kicked off a build of your pre-created tarball and will report in the morning.

comment:9 by Olly Betts, 12 years ago

If you don't use the top-level configure, you need to pass --enable-maintainer-mode when you configure a sub-directory to enable the rules to rebuild files which are shipped in releases (include/xapian/error.h is one such file).

We found that if those rules are left enabled in release builds, they can get incorrectly invoked by some versions of make, or by any version of make if you copy a source tree without preserving timestamps.

comment:10 by Greg, 12 years ago

With 1.3.0_svn16161 from last night I get this error.

libtool: link: /usr/bin/x86_64-w64-mingw32-g++ -fshow-column -Wall -W -Wredundant-decls -Wpointer-arith -Wcast-qual -Wcast-align -Wno-long-long -Wformat-security -fno-gnu-keywords -Wundef -Woverloaded-virtual -Wstrict-null-sentinel -Wshadow -Wstrict-overflow=1 -Winit-self -Wlogical-op -Wmissing-declarations -fvisibility=hidden -I/usr/x86_64-w64-mingw32/sys-root/mingw/include -O2 -g -pipe -Wall -fexceptions -fno-omit-frame-pointer -fno-optimize-sibling-calls --param=ssp-buffer-size=4 -mms-bitfields -Wl,--exclude-libs=libintl.a -Wl,--exclude-libs=libiconv.a -o bin/.libs/xapian-check.exe bin/bin_xapian_check-xapian-check.o bin/bin_xapian_check-xapian-check-brass.o bin/bin_xapian_check-xapian-check-chert.o -Wl,--enable-runtime-pseudo-reloc -L/usr/x86_64-w64-mingw32/sys-root/mingw/lib ./.libs/libxapian.dll.a -lz -lws2_32 -lrpcrt4 ./.libs/libbrasscheck.a ./.libs/libchertcheck.a /usr/lib/gcc/x86_64-w64-mingw32/4.6.2/libstdc++.dll.a -L/usr/x86_64-w64-mingw32/sys-root/mingw/lib -L/usr/lib/gcc/x86_64-w64-mingw32/4.6.2 ./.libs/libbrasscheck.a(brass_check.o):/tmp/buildd/mingw64-x-xapian-core-1.3.0+svn16161/backends/brass/brass_check.cc:138: undefined reference to `BrassTable_base::block_free_at_start(unsigned int) const' ./.libs/libbrasscheck.a(brass_check.o):/tmp/buildd/mingw64-x-xapian-core-1.3.0+svn16161/backends/brass/brass_check.cc:140: undefined reference to `BrassTable_base::block_free_now(unsigned int)' ./.libs/libbrasscheck.a(brass_check.o):/tmp/buildd/mingw64-x-xapian-core-1.3.0+svn16161/backends/brass/brass_check.cc:142: undefined reference to `BrassTable_base::free_block(unsigned int)' ./.libs/libbrasscheck.a(brass_check.o): In function `Brass::Key::operator>=(Brass::Key) const': /tmp/buildd/mingw64-x-xapian-core-1.3.0+svn16161/backends/brass/brass_table.h:126: undefined reference to `Brass::Key::operator<(Brass::Key) const' ./.libs/libbrasscheck.a(brass_check.o):/tmp/buildd/mingw64-x-xapian-core-1.3.0+svn16161/backends/brass/brass_check.cc:175: undefined reference to `BrassTable::block_to_cursor(Brass::Cursor*, int, unsigned int) const' ./.libs/libbrasscheck.a(brass_check.o): In function `Brass::Key::operator>=(Brass::Key) const': /tmp/buildd/mingw64-x-xapian-core-1.3.0+svn16161/backends/brass/brass_table.h:126: undefined reference to `Brass::Key::operator<(Brass::Key) const' ./.libs/libbrasscheck.a(brass_check.o):/tmp/buildd/mingw64-x-xapian-core-1.3.0+svn16161/backends/brass/brass_check.cc:191: undefined reference to `Brass::Key::operator<(Brass::Key) const' ./.libs/libbrasscheck.a(brass_check.o):/tmp/buildd/mingw64-x-xapian-core-1.3.0+svn16161/backends/brass/brass_check.cc:184: undefined reference to `Brass::Key::operator<(Brass::Key) const' ./.libs/libbrasscheck.a(brass_check.o): In function `BrassTableCheck': /tmp/buildd/mingw64-x-xapian-core-1.3.0+svn16161/backends/brass/brass_check.h:40: undefined reference to `BrassTable::BrassTable(char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool, int, bool)' ./.libs/libbrasscheck.a(brass_check.o):/tmp/buildd/mingw64-x-xapian-core-1.3.0+svn16161/backends/brass/brass_check.cc:236: undefined reference to `BrassTable_base::block_free_at_start(unsigned int) const' ./.libs/libbrasscheck.a(brass_check.o): In function `~BrassTableCheck': /tmp/buildd/mingw64-x-xapian-core-1.3.0+svn16161/backends/brass/brass_check.h:33: undefined reference to `BrassTable::~BrassTable()' ./.libs/libbrasscheck.a(brass_check.o):/tmp/buildd/mingw64-x-xapian-core-1.3.0+svn16161/backends/brass/brass_check.cc:255: undefined reference to `BrassTable_base::is_empty() const' ./.libs/libbrasscheck.a(brass_check.o): In function `~BrassTableCheck': /tmp/buildd/mingw64-x-xapian-core-1.3.0+svn16161/backends/brass/brass_check.h:33: undefined reference to `BrassTable::~BrassTable()' ./.libs/libchertcheck.a(chert_check.o):/tmp/buildd/mingw64-x-xapian-core-1.3.0+svn16161/backends/chert/chert_check.cc:137: undefined reference to `ChertTable_base::block_free_at_start(unsigned int) const' ./.libs/libchertcheck.a(chert_check.o):/tmp/buildd/mingw64-x-xapian-core-1.3.0+svn16161/backends/chert/chert_check.cc:139: undefined reference to `ChertTable_base::block_free_now(unsigned int)' ./.libs/libchertcheck.a(chert_check.o):/tmp/buildd/mingw64-x-xapian-core-1.3.0+svn16161/backends/chert/chert_check.cc:141: undefined reference to `ChertTable_base::free_block(unsigned int)' ./.libs/libchertcheck.a(chert_check.o): In function `Key::operator>=(Key) const': /tmp/buildd/mingw64-x-xapian-core-1.3.0+svn16161/backends/chert/chert_table.h:124: undefined reference to `Key::operator<(Key) const' ./.libs/libchertcheck.a(chert_check.o):/tmp/buildd/mingw64-x-xapian-core-1.3.0+svn16161/backends/chert/chert_check.cc:174: undefined reference to `ChertTable::block_to_cursor(Cursor*, int, unsigned int) const' ./.libs/libchertcheck.a(chert_check.o): In function `Key::operator>=(Key) const': /tmp/buildd/mingw64-x-xapian-core-1.3.0+svn16161/backends/chert/chert_table.h:124: undefined reference to `Key::operator<(Key) const' ./.libs/libchertcheck.a(chert_check.o):/tmp/buildd/mingw64-x-xapian-core-1.3.0+svn16161/backends/chert/chert_check.cc:190: undefined reference to `Key::operator<(Key) const' ./.libs/libchertcheck.a(chert_check.o):/tmp/buildd/mingw64-x-xapian-core-1.3.0+svn16161/backends/chert/chert_check.cc:183: undefined reference to `Key::operator<(Key) const' ./.libs/libchertcheck.a(chert_check.o): In function `ChertTableCheck': /tmp/buildd/mingw64-x-xapian-core-1.3.0+svn16161/backends/chert/chert_check.h:40: undefined reference to `ChertTable::ChertTable(char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool, int, bool)' ./.libs/libchertcheck.a(chert_check.o):/tmp/buildd/mingw64-x-xapian-core-1.3.0+svn16161/backends/chert/chert_check.cc:235: undefined reference to `ChertTable_base::block_free_at_start(unsigned int) const' ./.libs/libchertcheck.a(chert_check.o): In function `~ChertTableCheck': /tmp/buildd/mingw64-x-xapian-core-1.3.0+svn16161/backends/chert/chert_check.h:33: undefined reference to `ChertTable::~ChertTable()' ./.libs/libchertcheck.a(chert_check.o):/tmp/buildd/mingw64-x-xapian-core-1.3.0+svn16161/backends/chert/chert_check.cc:254: undefined reference to `ChertTable_base::is_empty() const' ./.libs/libchertcheck.a(chert_check.o): In function `~ChertTableCheck': /tmp/buildd/mingw64-x-xapian-core-1.3.0+svn16161/backends/chert/chert_check.h:33: undefined reference to `ChertTable::~ChertTable()' collect2: ld returned 1 exit status make[3]: * [bin/xapian-check.exe] Error 1 make[3]: Leaving directory `/tmp/buildd/mingw64-x-xapian-core-1.3.0+svn16161/build-64' make[2]: * [all-recursive] Error 1 make[2]: Leaving directory `/tmp/buildd/mingw64-x-xapian-core-1.3.0+svn16161/build-64' make[1]: * [all] Error 2 make[1]: Leaving directory `/tmp/buildd/mingw64-x-xapian-core-1.3.0+svn16161/build-64' make: * [build-stamp] Error 2

comment:11 by Olly Betts, 12 years ago

It looks like the issue is it that libxapian is on the link line before libbrasscheck and libchertcheck. I'll try to fix that.

BTW, if you add {{{ before a paste and }}} after trac will treat it as preformatted.

comment:12 by Olly Betts, 12 years ago

OK, trunk r16216 should fix that link error.

comment:13 by Olly Betts, 12 years ago

Backported that fix for 1.2.9 in r16224.

comment:14 by Olly Betts, 12 years ago

Milestone: 1.3.01.2.9
Resolution: fixed
Status: assignedclosed

I'm going to close this, as all the issues mentioned here should be solved now and have been backported to the 1.2 branch as well.

If the link error still happens after the most recent change above, please reopen. If there are further build errors, a new ticket would be less confusing.

Note: See TracTickets for help on using tickets.