[Xapian-devel] Search::Xapian cygwin fix

Reini Urban rurban at x-ray.at
Sat Sep 22 09:38:25 BST 2007


Olly Betts schrieb:
> On Thu, Sep 20, 2007 at 01:59:17PM +0200, Reini Urban wrote:
>> The cygwin linker requires -shared, otherwise WinMain at 16 will not be skipped.
>>
>> BTW: mingw also. But this should test and fix someone else.
> 
> I think all platforms need to use -shared to create a shared object with GCC.
> 
> Hmm, looking at the generated Makefile here, the only place $(LD) is
> used is in this rule:
> 
> $(INST_DYNAMIC): $(OBJECT) $(MYEXTLIB) $(BOOTSTRAP) $(INST_ARCHAUTODIR)$(DFSEP).exists $(EXPORT_LIST) $(PERL_ARCHIVE) $(PERL_ARCHIVE_AFTER) $(INST_DYNAMIC_DEP)
> 	$(RM_F) $@
> 	$(LD)  $(LDDLFLAGS) $(LDFROM) $(OTHERLDFLAGS) -o $@ $(MYEXTLIB)	\
> 	  $(PERL_ARCHIVE) $(LDLOADLIBS) $(PERL_ARCHIVE_AFTER) $(EXPORT_LIST)	\
> 	  $(INST_DYNAMIC_FIX)
> 	$(CHMOD) $(PERM_RWX) $@
> 
> And on my Linux box, LDDLFLAGS is set to this in the generated Makefile:
> 
> LDDLFLAGS = -shared -L/usr/local/lib 
> 
> And that comes from the Config module:
> 
> perl -e 'use Config; print "$Config{lddlflags}\n"'
> 
> What value does LDDLFLAGS have for you?

The problem is that all older cygwin perl builds have their own linker 
driver called ld2. This sets LDDLFLAGS.
But since we use here the override LD=$(CC) this does not work for 
Search::Xapian. We miss -shared.

Starting from perl-5.10.0 LDDFLAGS is correct on cygwin, I managed to 
get a sane build env, because I'm the maintainer now.

With 5.10 (starting with 5.9.5) the module compiles fine.
LDDLFLAGS =  --shared  -Wl,--enable-auto-import -Wl,--export-all-symbols 
-Wl,--stack,83

$ perl -e 'use Config; print "$Config{lddlflags}\n"'
  -s -L/usr/local/lib

$ perl5.8.8 -e 'use Config; print "$Config{lddlflags}\n"'
  -s -L/usr/local/lib

$ perl5.8.8 -e 'use Config; print "$Config{ld}\n"'
ld2

$ perl5.10.0 -e 'use Config; print "$Config{lddlflags}\n"'
  --shared  -Wl,--enable-auto-import -Wl,--export-all-symbols 
-Wl,--stack,8388608 -Wl,--enable-auto-image-base 
-Wl,--enable-auto-import -L/usr/local/lib

$ perl5.10.0 -e 'use Config; print "$Config{ld}\n"'
g++

-- 
Reini Urban
http://phpwiki.org/  http://murbreak.at/
http://helsinki.at/  http://spacemovie.mur.at/



More information about the Xapian-devel mailing list