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

Hi,
When I first built perl on a powerpc64 box (running Debian Wheezy) it built perl in 32-bit mode - ivtype of int, ivsize of 4, ptrsize of 4.
But I wanted a 64-bit perl, and I discovered I could achieve that by simply adding -Dcc="gcc -m64" to the configure args I had used.
That worked fine - perl then had ivtype of long, ivsize of 8 and ptrsize of 8.

However, did I choose the correct way of forcing 64-bit mode ? I've always been a bit concerned that the "-m64" should be in cflags, not part of the name of the compiler.
And, although that approach has worked fine for me for the last couple of years, I'm striking a problem compiling the (optional) gfortran elements in the PDL (perl) module ... and I'm beginning to think that problem might be due to the presence of "-m64" in $Config{cc}.

If I have chosen the wrong means to the end, then what's the correct/recommended means ?

Cheers,
Rob

Replies are listed 'Best First'.
Re: [Linux] Controlling 32-bit mode vs 64-bit mode
by Tux (Canon) on Oct 09, 2015 at 06:52 UTC
    $ ./Configure -Duse64bitall -Duselongdouble -Dusethreads -des

    Should select all the right 64bit options


    Enjoy, Have FUN! H.Merijn
      ./Configure -Duse64bitall -Duselongdouble -Dusethreads -des

      No, that didn't deliver what I was after.
      That's still a 32-bit mode build - with ivtype of 'long long', ivsize of 8, and ptrsize of 4.
      Correction: The preceding statement is true only if -Duse64bitall is replaced by -Duse64bitint. On checking, I find that the Configure process refuses to accept the "-Duse64bitall" because pointer size is only 4 bytes.

      With a 64-bit mode build I get ivtype of long, ivsize of 8, and ptrsize of 8.
      And I get that without having to specify either -Duse64bitint or -Duse64bitall.

      Cheers,
      Rob
        Just to update on some off-forum activity re this thread:
        Tux expressed the view that hints/linux.sh should be amended so that -Duse64bitall would create the build I was looking for (ivtype of long, ivsize of 8, ptrsize of 8 and -m64 in ccflags).
        But we couldn't get that set correctly. He didn't have access to a powerpc64 system, and my capability with shell scripting is very limited. (More accurately, any such capability is yet non-existent.)

        In the midst of this hackery, I found that -m64 needs *also* to be included in cppflags, ldflags and lddlflags.
        Eventually I was able to get the build I was after by leaving hints/linux.sh in its original state and running:
        sh Configure -des -Dccflags=-m64 -Dldflags=-m64 -Dlddlflags="-m64 -sha +red -O1" -Dcc=gcc
        That is essentially the same perl as I had been getting with:
        sh Configure -des -Dcc="gcc -m64"
        The only difference being that "-m64" was removed from cc, and was inserted into the various flags, as needed - exactly as I was seeking !!
        Other than that, the perl -V outputs were identical (with ivtype=long, ivsize=8 and ptrsize=8).

        However, it didn't help with the problem that had triggered this investigation.
        And, when I think about it again, it's probably not surprising that it did make no difference.
        AFAICT, operating in 64-bit mode requires that whenever "gcc" is called, "-m64" must also be called, and having a compiler named "gcc -m64" therefore looks to be a very sane way of ensuring that happens.

        Anyway, it sure is good to have the alternative that I was seeking and I'll keep such a build of perl handy for reference.
        (But I'm currently planning on staying with the -Dcc="gcc -m64" builds for as long as they don't prove to be deficient.)

        Cheers,
        Rob