Menu

#291 perldl.conf OPTIMIZE option doesn't work

closed-fixed
nobody
core (120)
3
2012-09-02
2011-12-26
No

I tried using that to override the default -O2 from $Config{ccflags}
to work around a gcc crash for the primitive.pd stuff but it had no
effect. There should be a better way to control the build process
for this case (which includes building for debugging).

This was for SPP:

Summary of my perl5 (revision 5 version 14 subversion 2) configuration:

Platform:
osname=MSWin32, osvers=4.0, archname=MSWin32-x86-multi-thread
uname='Win32 strawberryperl 5.14.2.1-portable #1 Tue Nov 22 18:24:29 2011 i386'
config_args='undef'
hint=recommended, useposix=true, d_sigaction=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 -DPERL_TEXTMODE_SCRIPTS -DUSE_SITECUSTOMIZE -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -fno-strict-aliasing -mms-bitfields', optimize='-s -O2', cppflags='-DWIN32' ccversion='', gccversion='4.4.7', 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', lseeksize=8 alignbytes=8, prototype=define
Linker and Libraries:
ld='g++.exe', ldflags ='-s -L"C:\chm\strawberry\514-pdl-249991\perl\lib\CORE" -L"C:\chm\strawberry\514-pdl-249991\c\lib"'
libpth=C:\chm\strawberry\514-pdl-249991\c\lib C:\chm\strawberry\514-pdl-249991\c\i686-w64-mingw32\lib
libs=-lmoldname -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshell32 -lole32 -loleaut32 -lnetapi32 -luuid -lws2_32 -lmpr -lwinmm -lversion -lodbc32 -lodbccp32 -lcomctl32
perllibs=-lmoldname -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshell32 -lole32 -loleaut32 -lnetapi32 -luuid -lws2_32 -lmpr -lwinmm -lversion -lodbc32 -lodbccp32 -lcomctl32
libc=, so=dll, useshrplib=true, libperl=libperl514.a
gnulibc_version=''
Dynamic Linking:
dlsrc=dl_win32.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' '
cccdlflags=' ', lddlflags='-mdll -s -L"C:\chm\strawberry\514-pdl-249991\perl\lib\CORE" -L"C:\chm\strawberry\514-pdl-249991\c\lib"'

Characteristics of this binary (from libperl):
Compile-time options: MULTIPLICITY PERL_DONT_CREATE_GVSV
PERL_IMPLICIT_CONTEXT PERL_IMPLICIT_SYS
PERL_MALLOC_WRAP PERL_PRESERVE_IVUV PL_OP_SLAB_ALLOC
USE_ITHREADS USE_LARGE_FILES USE_PERLIO USE_PERL_ATOF
USE_SITECUSTOMIZE
Built under MSWin32
Compiled at Nov 22 2011 18:32:55
%ENV:
PERL_JSON_BACKEND="JSON::XS"
PERL_YAML_BACKEND="YAML"
@INC:
C:/chm/strawberry/514-pdl-249991/perl/site/lib
C:/chm/strawberry/514-pdl-249991/perl/vendor/lib
C:/chm/strawberry/514-pdl-249991/perl/lib
.

Discussion

  • Chris Marshall

    Chris Marshall - 2011-12-26

    Warning:: ugly work-around follows!

    I started the build process and then monitored the Basic/Primitive
    folder for the appearance of the Makefile. Then I quickly edited
    out the -O2 options appearing therein before the build progressed to
    that directory. Yuck!

     
  • Derek Lamb

    Derek Lamb - 2012-06-27

    The optimization docs for gcc http://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html state that "If you use multiple -O options, with or without level numbers, the last such option is the one that is effective." And CCFLAGS comes before OPTIMIZE options when produced by EU::MM. When I put in '-O0 -g' for OPTIMIZE in perldl.conf (that's "dash Oh zero"), my compilation lines look like this:

    /usr/bin/gcc-4.2 -c -I/usr/include -pipe -O2 -fno-common -DPERL_DARWIN -I/opt/local/include -no-cpp-precomp -fno-strict-aliasing -fstack-protector -I/opt/local/include -O0 -g -DVERSION=\"2.4.11\" -DXS_VERSION=\"2.4.11\" "-I/opt/local/lib/perl5/5.14.2/darwin-multi-2level/CORE" -DPDL_PTHREAD Core.c

    So presumably the -O2 will be ignored in favor of the later -O0.

     
  • Derek Lamb

    Derek Lamb - 2012-07-08

    Added a note to the text above OPTIMIZE in perldl.conf advising the use of -O0 in addition to -g. I compiled PDL with this, installed, and produced a segfault, examined the dumped core and seemed to get full debugging info including line numbers from pdlcore.c.

    Marking this as pending to see if that solution works for others.

     
  • Derek Lamb

    Derek Lamb - 2012-07-08

    Bug fixed in Git.
    Thanks for reporting the problem!

     
  • Derek Lamb

    Derek Lamb - 2012-07-08
    • status: open --> pending-fixed
     
  • Chris Marshall

    Chris Marshall - 2012-09-02

    Documentation was added to perldl.conf regarding how to set OPTIMIZE appropriately. Thanks, Derek.

     
  • Chris Marshall

    Chris Marshall - 2012-09-02
    • status: pending-fixed --> closed-fixed
     
  • Chris Marshall

    Chris Marshall - 2012-09-02

    Bug fixed in Git.
    Thanks for reporting the problem!

     

Log in to post a comment.