Link to home
Start Free TrialLog in
Avatar of Bvm 18
Bvm 18

asked on

how to compile 64 bit version of libperl.a from perl 5.28 source code on solaris.

how to compile 64 bit version of libperl.a from perl 5.28 source code on solaris.

Tried with -fPIC while configuring. But, no luck.
Avatar of arnold
arnold
Flag of United States of America image

If memory serves, -m 64
Is the option.

Are you using Suns/oracle compiler, or gcc ?

Are you preconfiguring. Guess you have done requirement to use an older version?
What arnold is asking for is specific details about your build process.

Generally, as I recall from building PERL on AIX each time a new version came out, you'll run your configure + link/ld steps with 64 bit flags for your specific compiler + you'll be good.

Keep in mind though, libperl.a is the static version of the PERL library + rarely used by anything, unless you're building some custom code requiring inclusion of an embedded PERL interpreter.

Normally, you'll build a shared PERL library/object, so all instances of PERL use a shared object loaded/cached in memory.

It's been many years since I built PERL + looking at the COPTS section of an old PERL build script... getting all the correct options set for your specific Sun hardware/compiler can be tricky. I'll include my COPTS settings, which might be helpful.

Tip: If you have access to a recent version of gcc on your machine, might be best to use gcc. Also likely you'll still require using Sun's loader rather than gcc ld. Try searching PERL forums for help with this, as likely asking someone who already has this working will be far easier than figuring out all the correct build conjurations.

    $copts  = "-des -Dusedevel -Dprefix=$prefix ";
    $copts .= "-Dusethreads -Duseshrplib ";
    #$copts .= "-Dloclibpth='$install/lib /usr/local/lib' ";
    #$copts .= "-Dlocincpth='$install/include /usr/local/include' ";
    # add -Wl,-rpath,$install/lib
    $copts .= "-Duse64bitint -Duselargefiles ";
    $copts .= "-DDEBUGGING=-g -Doptimize=-O2 ";
    $copts .= "-Dccflags='-pipe -DDEBIAN -D_FORTIFY_SOURCE=2 -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security' ";
    $copts .= "-Dldflags='-Wl,-Bsymbolic-functions -Wl,-z,relro' " if ($ostype eq 'linux');
    $copts .= "-Dlddlflags='-shared -Wl,-Bsymbolic-functions -Wl,-z,relro' ";
    $copts .= "-Dcccdlflags=-fPIC -Darchname=x86_64-linux-gnu ";
    #$copts .= "-Dpager=/usr/bin/sensible-pager ";
    $copts .= "-Dpager=/usr/bin/less ";
    $copts .= "-Uafs -Ud_csh -Ud_ualarm -Uusesfio -Uusenm -Ui_libutil";

Open in new window

Avatar of Bvm 18
Bvm 18

ASKER

with -m64, built libperl.so successfully. But, looking for libperl.a.

perl source: perl5.28 and using gcc 4.9.2 compiler on solaris.

How to generate libperl.a?
Wow... gcc 4.9.2... That's a blast from the past, since gcc is now at version gcc8...

Thinking back to my days with AIX, as I recall I use to also build latest gcc, so I had a good starting point...

So I'd use my gcc latest source build for compiling + the AIX loader for linking.

Likely Solaris will be similar.

Again, best place to get the real answer is post to the PERL users forum.

Likely someone will be able to give you a correct + definitive answer off the top of their head.
@Bvm 18
Need to know your comment?
Performed the following using Ubuntu and CYGWIN_NT:

$ #Initially downloaded perl-5.28.0.tar.gz
$ /usr/bin/wget https://www.cpan.org/src/5.0/perl-5.28.0.tar.gz --no-check-certificate
$ /usr/bin/tar -xzf perl-5.28.0.tar.gz
$ cd perl-5.28.0
$ ./Configure -des -Dprefix=/home/murugesandins/localperl
$ /usr/bin/make test
$ /usr/bin/make install
$ /usr/bin/find ./ -type f | /bin/grep -E "libperl\.a$|libperl\.so$"
./libperl.a
$ /bin/rm -i  libperl.a
/bin/rm: remove regular file 'libperl.a'? y
$ /bin/ls libperl.a
/bin/ls: cannot access 'libperl.a': No such file or directory
$ /usr/bin/make libperl.a >/dev/null 2>&1
$ /bin/ls libperl.a
libperl.a

Open in new window

@Bvm 18
Attaching related Makefile from Ubuntu and CYGWIN_NT
Comment from Makefile:
# Static targets are ordinarily built without CCCDLFLAGS.  However,
# if building a shared libperl.so that might later be linked into
# another application, then it might be appropriate to also build static
# extensions (usually just DynaLoader) with relocatable code (e.g. -fPIC
# for GNU cc).
STATIC_LDFLAGS = CCCDLFLAGS=

Open in new window

Makefile_CYGWIN_NT.txt
Makefile_Linux_Ubuntu.txt
ASKER CERTIFIED SOLUTION
Avatar of Bvm 18
Bvm 18

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial