Subject: pkg/36301: Can't build devel/pcre-7.1: CXXFLAGS incorrectly filtered
To: None <pkg-manager@netbsd.org, gnats-admin@netbsd.org,>
From: None <srcshelton@gmail.com>
List: pkgsrc-bugs
Date: 05/09/2007 13:05:01
>Number:         36301
>Category:       pkg
>Synopsis:       Can't build devel/pcre-7.1: CXXFLAGS incorrectly filtered
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed May 09 13:05:00 +0000 2007
>Originator:     Stuart Shelton
>Release:        n/a
>Organization:
>Environment:
IRIX64 octane 6.5 07202013 IP30
>Description:

On IRIX, certain C library functions are omitted from C++ headers unless a particular flag is passed to the C++ compiler.

Despite having CXXFLAGS+=-LANG:exceptions=OFF:libc_in_namespace_std=OFF in the devel/pcre Makefile and added to my CXXFLAGS environment variable (which has propagated through to pcre's top-level Makefile), I get the error:

(cd .libs && rm -f libpcreposix.la && ln -s ../libpcreposix.la libpcreposix.la)
source='pcrecpp.cc' object='pcrecpp.lo' libtool=yes  DEPDIR=.deps depmode=none /bin/ksh ./depcomp  /bin/ksh ./libtool --tag=CXX    --mode=compile CC -DHAVE_CONFIG_H -I.    -I/usr/bsd/include  -O2 -n32 -mips4 -r14000 -apo -float_const -use_readonly_const -TARG:isa=mips4:platform=ip30:processor=r14000 -TENV:zeroinit_in_bss=ON -OPT:fast_io=ON:Olimit=8192:reorg_common=ON:swp=ON -LNO:auto_dist=ON:fusion_peeling_limit=8:gather_scatter=2 -woff 1174,1183,1185,1552,3970,3968 -FE:eliminate_duplicate_inline_copies:template_in_elf_section -LANG:exceptions=OFF -LANG:libc_in_namespace_std=OFF -c -o pcrecpp.lo pcrecpp.cc
 CC -DHAVE_CONFIG_H -I. -I/usr/bsd/var/tmp/devel/pcre/work/.buildlink/include -O2 -n32 -mips4 -r14000 -apo -float_const -use_readonly_const -TARG:isa=mips4:platform=ip30:processor=r14000 -TENV:zeroinit_in_bss=ON -OPT:fast_io=ON:Olimit=8192:reorg_common=ON:swp=ON -woff 1174,1183,1185,1552,3970,3968 -FE:eliminate_duplicate_inline_copies:template_in_elf_section -c pcrecpp.cc  -DPIC -o .libs/pcrecpp.o
cc-1020 CC: ERROR File = pcrecpp.cc, Line = 773
  The identifier "strtoll" is undefined.

    long long r = strtoll(str, &end, radix);
                  ^

cc-1020 CC: ERROR File = pcrecpp.cc, Line = 800
  The identifier "strtoull" is undefined.

    unsigned long long r = strtoull(str, &end, radix);
                           ^

2 errors detected in the compilation of "pcrecpp.cc".

[wrapper.sh] note: The real command line, after the pkgsrc wrapper, was:
/usr/bsd/var/tmp/devel/pcre/work/.mipspro/bin/CC -DHAVE_CONFIG_H -I. -I/usr/bsd/var/tmp/devel/pcre/work/.buildlink/include -O2 -n32 -mips4 -r14000 -apo -float_const -use_readonly_const -TARG:isa=mips4:platform=ip30:processor=r14000 -TENV:zeroinit_in_bss=ON -OPT:fast_io=ON:Olimit=8192:reorg_common=ON:swp=ON -woff 1174,1183,1185,1552,3970,3968 -FE:eliminate_duplicate_inline_copies:template_in_elf_section -c pcrecpp.cc -DPIC -o .libs/pcrecpp.o 

[wrapper.sh] note: The real command line, after the pkgsrc wrapper, was:
/usr/bsd/bin/libtool --tag=CXX --mode=compile CC -DHAVE_CONFIG_H -I. -I/usr/bsd/var/tmp/devel/pcre/work/.buildlink/include -O2 -n32 -mips4 -r14000 -apo -float_const -use_readonly_const -TARG:isa=mips4:platform=ip30:processor=r14000 -TENV:zeroinit_in_bss=ON -OPT:fast_io=ON:Olimit=8192:reorg_common=ON:swp=ON -woff 1174,1183,1185,1552,3970,3968 -FE:eliminate_duplicate_inline_copies:template_in_elf_section -c -o pcrecpp.lo pcrecpp.cc 
*** Error code 1

... where you'll notice that something (libtool? wrapper.sh?) has stripped the additional CXXFLAGS - rendering the code un-buildable.
>How-To-Repeat:

'cd devel/pcre && bmake' on IRIX
>Fix:

If I manually run the command specified by wrapper.sh with the correct flags added, then the file if compiled successfully.  However, if I then return to the top-level and "bmake" again, the build system attempts to rebuild the code again without the additional flag, and again fails :(