Subject: | Compile and test failure using dmake on Win32 (Strawberry Perl) |
During 'perl Makefike.PL' of GD-2.35 on MS WindowsXP Home Edition SP 2,
I was asked "Where is libgd installed?" to which I answered
"C:/Progra~1/GnuWin32" (I had installed the package of GD from the
GNUWin32 project). Then I edited the Makefile, changing:
$(LD) -o $@ -Wl,--base-file -Wl,dll.base $(LDDLFLAGS) $(LDFROM)
$(OTHERLDFLAGS) $(MYEXTLIB) $(PERL_ARCHIVE) $(LDLOADLIBS) dll.exp
dlltool --def $(EXPORT_LIST) --base-file dll.base --output-exp dll.exp
$(LD) -o $@ $(LDDLFLAGS) $(LDFROM) $(OTHERLDFLAGS) $(MYEXTLIB)
$(PERL_ARCHIVE) $(LDLOADLIBS) dll.exp
to:
$(LD) -o $@ -Wl,--base-file -Wl,dll.base $(LDDLFLAGS) $(LDFROM)
$(OTHERLDFLAGS) $(MYEXTLIB) $(PERL_ARCHIVE) $(LDLOADLIBS)
C:\Progra~1\GnuWin32\lib\libgd.dll.a dll.exp
dlltool --def $(EXPORT_LIST) --base-file dll.base --output-exp dll.exp
$(LD) -o $@ $(LDDLFLAGS) $(LDFROM) $(OTHERLDFLAGS) $(MYEXTLIB)
$(PERL_ARCHIVE) $(LDLOADLIBS) C:\Progra~1\GnuWin32\lib\libgd.dll.a dll.exp
With those changes, GD.pm built successfully. Without the Makefile
changes, I get errors like:
g++ -o blib\arch\auto\GD\GD.dll -Wl,--base-file -Wl,dll.base -mdll -s
-L"c:\strawberry-perl\perl\lib\CORE" -L"c:\strawberry-perl\mingw\lib"
GD.o -Wl,--image-base,0x2b280000
C:\strawberry-perl\perl\lib\CORE\libperl58.a
c:\strawberry-perl\mingw\lib\libmsvcrt.a
c:\strawberry-perl\mingw\lib\libmoldname.a
c:\strawberry-perl\mingw\lib\libkernel32.a
c:\strawberry-perl\mingw\lib\libuser32.a
c:\strawberry-perl\mingw\lib\libgdi32.a
c:\strawberry-perl\mingw\lib\libwinspool.a
c:\strawberry-perl\mingw\lib\libcomdlg32.a
c:\strawberry-perl\mingw\lib\libadvapi32.a
c:\strawberry-perl\mingw\lib\libshell32.a
c:\strawberry-perl\mingw\lib\libole32.a
c:\strawberry-perl\mingw\lib\liboleaut32.a
c:\strawberry-perl\mingw\lib\libnetapi32.a
c:\strawberry-perl\mingw\lib\libuuid.a
c:\strawberry-perl\mingw\lib\libws2_32.a
c:\strawberry-perl\mingw\lib\libmpr.a
c:\strawberry-perl\mingw\lib\libwinmm.a
c:\strawberry-perl\mingw\lib\libversion.a
c:\strawberry-perl\mingw\lib\libodbc32.a
c:\strawberry-perl\mingw\lib\libodbccp32.a dll.exp
GD.o:GD.c:(.text+0x16f): undefined reference to
`_imp__gdImageCreateTrueColor@8'
GD.o:GD.c:(.text+0x188): undefined reference to `_imp__gdImageCreate@8'
GD.o:GD.c:(.text+0x2ae): undefined reference to
`_imp__gdImageTrueColorToPalette @12'
...
GD.o:GD.c:(.text+0x13712): undefined reference to
`_imp__gdFontGetMediumBold@0'
GD.o:GD.c:(.text+0x13872): undefined reference to `_imp__gdFontGetTiny@0'
collect2: ld returned 1 exit status
dmake: Error code 129, while making 'blib\arch\auto\GD\GD.dll'
When running 'dmake test', there were more problems. 'perl.exe'
complained that it couldn't find 'libgd2.dll' (which was located at
'C:\Program Files\GnuWin32\bin\libgd2.dll') when trying to load
'./blib/auto/GD/GD.dll'. The following is some of what the test harness
reported, but 'perl.exe' actually gave a popup dialog stating 'This
application has failed to start because libgd2.dll was not found.
Re-installing the application may fix the problem.':
t/Polyline....Can't load
'C:\Temp\cpan\build\GD-2.35\blib\arch/auto/GD/GD.dll' for module GD:
load_file:The specified module could not be found at
C:/strawberry-perl/perl/lib/DynaLoader.pm line 230.
at C:\Temp\cpan\build\GD-2.35\blib\lib/GD/Polyline.pm line 45
Compilation failed in require at
C:\Temp\cpan\build\GD-2.35\blib\lib/GD/Polyline.pm line 45.
BEGIN failed--compilation aborted at
C:\Temp\cpan\build\GD-2.35\blib\lib/GD/Polyline.pm line 45.
Compilation failed in require at t/Polyline.t line 10.
So I set the following environment variables to make the tests pass:
C:\Temp\cpan\build\GD-2.35>set LIB=%LIB%;C:\Program
Files\GnuWin32\bin;C:\Program Files\GnuWin32\lib;
C:\Temp\cpan\build\GD-2.35>set PATH=%PATH%;C:\Program
Files\GnuWin32\bin;C:\Program Files\GnuWin32\lib;
To make sure I wouldn't have problems in the future, I went to Control
Panel->System->Advanced->Environment Variables and changed those
variables permanently to include the GnuWin32 paths. I don't usually
develop on Win32, but thought you might like to be aware of the problem.
perl -V
Summary of my perl5 (revision 5 version 8 subversion 8) configuration:
Platform:
osname=MSWin32, osvers=5.1, archname=MSWin32-x86-multi-thread
uname=''
config_args='undef'
hint=recommended, useposix=true, d_sigaction=undef
usethreads=define use5005threads=undef useithreads=define
usemultiplicity=define
useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
use64bitint=undef use64bitall=undef uselongdouble=undef
usemymalloc=n, bincompat5005=undef
Compiler:
cc='gcc', ccflags =' -s -O2 -DWIN32 -DHAVE_DES_FCRYPT
-DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -fno-strict-aliasing
-DPERL_MSVCRT_READFIX',
optimize='-s -O2',
cppflags='-DWIN32'
ccversion='', gccversion='3.4.5', gccosandvers=''
intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
d_longlong=undef, longlongsize=8, d_longdbl=define, longdblsize=12
ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='long
long', lseek size=8
alignbytes=8, prototype=define
Linker and Libraries:
ld='g++', ldflags ='-s -L"c:\strawberry-perl\perl\lib\CORE"
-L"c:\strawberry-perl\mingw\lib"'
libpth=c:\strawberry-perl\mingw\lib
libs= -lmsvcrt -lmoldname -lkernel32 -luser32 -lgdi32 -lwinspool
-lcomdlg32 -ladvapi32 -lshell32 -lole32 -loleaut32 -lnetapi32 -luuid
-lws2_32 -lmpr -lwinmm -lversion -lodbc32 -lodbccp32
perllibs= -lmsvcrt -lmoldname -lkernel32 -luser32 -lgdi32 -lwinspool
-lcomdl
g32 -ladvapi32 -lshell32 -lole32 -loleaut32 -lnetapi32 -luuid -lws2_32
-lmpr -lwinmm -lversion -lodbc32 -lodbccp32
libc=-lmsvcrt, so=dll, useshrplib=yes, libperl=libperl58.a
gnulibc_version=''
Dynamic Linking:
dlsrc=dl_win32.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' '
cccdlflags=' ', lddlflags='-mdll -s
-L"c:\strawberry-perl\perl\lib\CORE" -L"
c:\strawberry-perl\mingw\lib"'
Characteristics of this binary (from libperl):
Compile-time options: MULTIPLICITY PERL_IMPLICIT_CONTEXT
PERL_IMPLICIT_SYS PERL_MALLOC_WRAP
PL_OP_SLAB_ALLOC USE_ITHREADS USE_LARGE_FILES
USE_PERLIO
Built under MSWin32
Compiled at Aug 27 2006 17:17:50
@INC:
C:/strawberry-perl/perl/lib
C:/strawberry-perl/perl/site/lib
.