puploki has asked for the wisdom of the Perl Monks concerning the following question:

Learned Brethren,

I seek your advice on building/compiling Perl for use on 64bit Windows.

The short question:How do I build a true 64bit binary of Perl for use on Windows?

The longer question (and what I've done so far):

Following the details on perl 5.8.805 on windows 64bit I've got hold of the MS Platform SDK suitable for my AMD64 machine (which is running Windows XP x64 Edition).

I think I've configured the Makefile correctly, but as I'm Windows through and through I haven't done this much, so may have screwed it up. If people think it will help, I'll post it.

When I try and run nmake in the Win32 Perl source directory, I get:

perlglob.obj : error LNK2001: unresolved external symbol __security_ch +eck_cookie ..\perlglob.obj : fatal error LNK 1120: 1 unresolved externals

Any pointers as to what I'm doing wrong would be gratefully received! I realise that this isn't necessarily the best place to pose such a question, so if anyone could also recommend a better outlet, I'll also try there.

As an aside, I'm trying to build Perl 64bit so that it runs in WindowsPE 64 - unlike regular Windows, WindowsPE cannot run the WOW layer to run 32bit apps. WindowsPE is used in our unattended install environment.

Many thanks,
Loki

Replies are listed 'Best First'.
Re: Building 64bit Perl for Windows
by Joost (Canon) on Aug 10, 2005 at 16:52 UTC
      Thanks for that, I had Googled for pretty much the same but I thought I'd turned up nothing. I must be blind :)

      However, I've tried disabling the GS flag with...

      set CL=/GS-

      ... but that doesn't help. The command line it seems to be running is using "link" rather than "cl" though:

      link -nologo -nodefaultlib -debug -opt:ref,icf -ltcg -libpath:"c: +\perl\lib\CORE" -machine:AMD64 oldnames.lib kernel32.lib user32.li +b gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32 +.lib oleaut32.lib netapi32.lib uuid.lib ws2_32.lib mpr.lib winmm.lib + version.lib msvcrt.lib -out:..\perlglob.exe -subsystem:console per +lglob.obj setargv.obj perlglob.obj : error LNK2001: unresolved external symbol __security_ch +eck_cookie ..\perlglob.exe : fatal error LNK1120: 1 unresolved externals

      Like I said, I'm waaay out of my depth here, so please bear with me :) It's odd that there's isn't an ActiveState 64bit Perl release yet - the architecture of these machines are all the same now, unlike the bad old days of IA64. In 12 months or so most OEM machines you buy will be 64bit Windows as well I bet...

        No, that wouldn't help. You have to cut'n'paste the command you typed (presumably nmake) and everything that follows (up to and including the error) so others can understand what's going on.

        What you need to focus on is patching Makefile so that all the special flags amd64 requirs get added. Something like this (as far as I got before I without the libraries)

        # PodMaster - UNLESS YOU INSTALL THEM (i don't have oldnames, but so w +hat) LIBBASEFILES = $(LIBBASEFILES) odbc32.lib odbccp32.lib # PodMaster !IF "$(CCTYPE)" == "MSVC60" OPTIMIZE = $(OPTIMIZE) -Op !ELSE OPTIMIZE = $(OPTIMIZE) -Wp64 -Op !ENDIF # PodMaster !IF "$(PROCESSOR_ARCHITECTURE)" == "x86" !IF "$(CPU)" == "AMD64" WIN64 = define PROCESSOR_ARCHITECTURE = AMD64 !ENDIF !ENDIF #PodMaster !IF "$(CPU)" == "AMD64" LINK_FLAGS = -nologo -nodefaultlib $(LINK_DBG) \ -libpath:"$(INST_COREDIR)" \ -machine:IX86 !ELSE LINK_FLAGS = -nologo -nodefaultlib $(LINK_DBG) \ -libpath:"$(INST_COREDIR)" \ -machine:$(PROCESSOR_ARCHITECTURE) !ENDIF
        Sorry its not in patch format, but you should be able to figure out where to inject these statements. From my notes apparently I used this article to help in sorting out this stuff, but like I said earlier, MS doesn't provide the libs for WinXPHome so I didn't get far.

        MJD says "you can't just make shit up and expect the computer to know what you mean, retardo!"
        I run a Win32 PPM repository for perl 5.6.x and 5.8.x -- I take requests (README).
        ** The third rule of perl club is a statement of fact: pod is sexy.

Re: Building 64bit Perl for Windows
by PodMaster (Abbot) on Aug 10, 2005 at 17:37 UTC
    No one has yet compiled perl for amd64 (as evident from smoke testers reports), mostly because obtaining the neccessary libraries has been problematic (for winxp home at least). So, you're going to have to do some patching (probably only to a Makefile).

    MJD says "you can't just make shit up and expect the computer to know what you mean, retardo!"
    I run a Win32 PPM repository for perl 5.6.x and 5.8.x -- I take requests (README).
    ** The third rule of perl club is a statement of fact: pod is sexy.

Re: Building 64bit Perl for Windows
by wilsonch (Novice) on May 07, 2008 at 02:08 UTC
    Hi puploki,

    I have the exact same error message you have, and I am able to go on by changing the LIBBASEFIELS section of MakeFile to the following

    LIBBASEFILES = $(CRYPT_LIB) \ oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib \ comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib \ netapi32.lib uuid.lib ws2_32.lib mpr.lib winmm.lib \ version.lib bufferoverflowU.lib

    Note I have just added the bufferoverflowU.lib to it.