Opened 8 years ago

Closed 8 years ago

Last modified 7 years ago

#51196 closed defect (fixed)

nss 3.23 does not build on Mac Os X 10.6.8, Snow Leopard, because of "unrecognized command line option "-std=c++0x""

Reported by: ballapete (Peter "Pete" Dyballa) Owned by: macports-tickets@…
Priority: Normal Milestone:
Component: ports Version: 2.3.4
Keywords: Cc: mojca (Mojca Miklavec), dbevans (David B. Evans)
Port: nss

Description

This is the failure:

cd google_test; /usr/bin/make libs
make[2]: Entering directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_nue.de.rsync.macports.org_macports_release_tarballs_ports_net_nss/nss/work/nss-3.23/nss/external_tests/google_test'
if test ! -d Output.OBJD/gtest/src; then rm -rf Output.OBJD/gtest/src; ../../coreconf/nsinstall/Output.OBJD/nsinstall -D Output.OBJD/gtest/src; fi
/usr/bin/llvm-g++-4.2 -arch x86_64 -o Output.OBJD/gtest/src/gtest-all.o -c -Os -fPIC  -fno-common -pipe -DDARWIN -DHAVE_STRERROR -DHAVE_BSD_FLOCK  -Wall -DNSS_NO_GCC48 -DXP_UNIX -UDEBUG -DNDEBUG -DUSE_UTIL_DIRECTLY -DNO_NSPR_10_SUPPORT -DSSL_DISABLE_DEPRECATED_CIPHER_SUITE_NAMES -Igtest/include/ -Igtest -I/opt/local/include/nspr -I../../../dist/Output.OBJD/include -I../../../dist/public/gtest -I../../../dist/private/gtest  -std=c++0x gtest/src/gtest-all.cc
cc1plus: error: unrecognized command line option "-std=c++0x"
make[2]: *** [Output.OBJD/gtest/src/gtest-all.o] Error 1

The error is obviously contained in ../common/gtest.mk, which is /opt/local/var/macports/build/_opt_local_var_macports_sources_nue.de.rsync.macports.org_macports_release_tarballs_ports_net_nss/nss/work/nss-3.23/nss/external_tests/common/gtest.mk

   34	else
   35	    CXXFLAGS += -std=c++0x
   36	endif

because /opt/local/var/macports/build/_opt_local_var_macports_sources_nue.de.rsync.macports.org_macports_release_tarballs_ports_net_nss/nss/work/nss-3.23/nss/external_tests/google_test\Makefile has:

   24	#######################################################################
   25	# (4) Include "local" platform-dependent assignments (OPTIONAL).      #
   26	#######################################################################
   27	
   28	include ../common/gtest.mk

Attachments (5)

main.log (431.4 KB) - added by ballapete (Peter "Pete" Dyballa) 8 years ago.
std=.patch (374 bytes) - added by ballapete (Peter "Pete" Dyballa) 8 years ago.
Patch against -std= option for GCC < 4.8
main.2.log (477.1 KB) - added by ballapete (Peter "Pete" Dyballa) 8 years ago.
main.log from build on PPC Tiger
main.3.log (138.9 KB) - added by ballapete (Peter "Pete" Dyballa) 8 years ago.
main.log from build on PPC Tiger with pqg.c:339:16: error
Portfile (6.1 KB) - added by ballapete (Peter "Pete" Dyballa) 7 years ago.
simplified Portfile

Download all attachments as: .zip

Change History (20)

Changed 8 years ago by ballapete (Peter "Pete" Dyballa)

Attachment: main.log added

comment:1 Changed 8 years ago by ballapete (Peter "Pete" Dyballa)

http://gcc.gnu.org/projects/cxx-status.html#cxx11 seems to explain the case, and the report

coreconf/Werror.mk:77: Unable to find gcc 4.8 or greater, disabling -Werror

Presumingly this additional compiler option should not be used in this case or GCC4.8 or newer should be use to compile nss.

Changed 8 years ago by ballapete (Peter "Pete" Dyballa)

Attachment: std=.patch added

Patch against -std= option for GCC < 4.8

comment:2 Changed 8 years ago by ballapete (Peter "Pete" Dyballa)

Trying the patch std=.patch allows compilation of gtest-all.c. But now a new error arrises:

make[2]: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_nue.de.rsync.macports.org_macports_release_tarballs_ports_net_nss/nss/work/nss-3.23/nss/external_tests/google_test'
cd der_gtest; /usr/bin/make libs
make[2]: Entering directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_nue.de.rsync.macports.org_macports_release_tarballs_ports_net_nss/nss/work/nss-3.23/nss/external_tests/der_gtest'
if test ! -d Output.OBJD; then rm -rf Output.OBJD; ../../coreconf/nsinstall/Output.OBJD/nsinstall -D Output.OBJD; fi
/usr/bin/llvm-g++-4.2 -arch x86_64 -o Output.OBJD/der_getint_unittest.o -c -Os -fPIC  -fno-common -pipe -DDARWIN -DHAVE_STRERROR -DHAVE_BSD_FLOCK  -Wall -DNSS_NO_GCC48 -DXP_UNIX -UDEBUG -DNDEBUG -DUSE_UTIL_DIRECTLY -DNO_NSPR_10_SUPPORT -DSSL_DISABLE_DEPRECATED_CIPHER_SUITE_NAMES -I../../external_tests/google_test/gtest/include -I../../external_tests/common -I/opt/local/include/nspr -I../../../dist/Output.OBJD/include -I../../../dist/public/nss -I../../../dist/private/nss -I../../../dist/public/nspr -I../../../dist/public/nss -I../../../dist/public/libdbm -I../../../dist/public/gtest   der_getint_unittest.cc
In file included from der_getint_unittest.cc:14:
../../external_tests/common/scoped_ptrs.h:33: error: expected initializer before ‘<’ token
../../external_tests/common/scoped_ptrs.h:34: error: expected initializer before ‘<’ token
../../external_tests/common/scoped_ptrs.h:35: error: expected initializer before ‘<’ token
../../external_tests/common/scoped_ptrs.h:36: error: expected initializer before ‘<’ token
../../external_tests/common/scoped_ptrs.h:37: error: expected initializer before ‘<’ token
../../external_tests/common/scoped_ptrs.h:38: error: expected initializer before ‘<’ token
../../external_tests/common/scoped_ptrs.h:39: error: expected initializer before ‘<’ token
make[2]: *** [Output.OBJD/der_getint_unittest.o] Error 1

So it's this block of C++ statements that the used Apple GCC 4.2 does not understand:

   31	#define SCOPED(x) typedef std::unique_ptr<x, ScopedMaybeDelete<x> > Scoped ## x
   32	
   33	SCOPED(PK11SlotInfo);
   34	SCOPED(SECItem);
   35	SCOPED(PK11SymKey);
   36	SCOPED(SECKEYPublicKey);
   37	SCOPED(SECKEYPrivateKey);
   38	SCOPED(SECAlgorithmID);
   39	SCOPED(CERTSubjectPublicKeyInfo);
   40	
   41	#undef SCOPED

I think this means that at least GCC 4.8 has to be used, taking into account also the warning from coreconf/Werror.mk… (but I am no C++ expert)

comment:3 Changed 8 years ago by ryandesign (Ryan Carsten Schmidt)

Note that apple gcc 4.2 is not being used here; llvm-gcc 4.2 is being used. We could try blacklisting llvm-gcc 4.2, if other compilers can compile this.

What version of Xcode is being used? llvm-gcc 4.2 would only be used by default on Xcode 4.

comment:4 in reply to:  3 Changed 8 years ago by ballapete (Peter "Pete" Dyballa)

Replying to ryandesign@…:

Note that apple gcc 4.2 is not being used here; llvm-gcc 4.2 is being used. We could try blacklisting llvm-gcc 4.2, if other compilers can compile this.

Learned a bit, thought it was part of GCC 4.2 that came with Xcode.

What version of Xcode is being used? llvm-gcc 4.2 would only be used by default on Xcode 4.

I have Xcode 4.2 installed, according System Profiler.

comment:5 Changed 8 years ago by ballapete (Peter "Pete" Dyballa)

The same happens on PPC Mac OS X 10.4.11, Tiger:

:info:build /opt/local/bin/g++-apple-4.2 -arch ppc -o Output.OBJD/gtest/src/gtest-all.o -c -Os -fPIC -Dppc -fno-common -pipe -DDARWIN -DHAVE_STRERROR -DHAVE_BSD_FLOCK  -Wall -DNSS_NO_GCC48 -DXP_UNIX -UDEBUG -DNDEBUG -DUSE_UTIL_DIRECTLY -DNO_NSPR_10_SUPPORT -DSSL_DISABLE_DEPRECATED_CIPHER_SUITE_NAMES -Igtest/include/ -Igtest -I/opt/local/include/nspr -I../../../dist/Output.OBJD/include -I../../../dist/public/gtest -I../../../dist/private/gtest  -std=c++0x gtest/src/gtest-all.cc
:info:build cc1plus: error: unrecognized command line option "-std=c++0x"
:info:build make[2]: *** [Output.OBJD/gtest/src/gtest-all.o] Error 1

Changed 8 years ago by ballapete (Peter "Pete" Dyballa)

Attachment: main.2.log added

main.log from build on PPC Tiger

comment:6 Changed 8 years ago by ballapete (Peter "Pete" Dyballa)

On Tiger I have Xcode version 2.5 installed, Using compiler 'MacPorts Apple GCC 4.2', i.e. /opt/local/bin/g++-apple-4.2.

comment:7 Changed 8 years ago by GussyFinkNottle

Similar problem: Snow Leopard 10.6.8; Xcode 3.2.6; compiler that issues the std=c++0x error is /usr/bin/g++-4.2, which announces itself as i686-apple-darwin10-g++-4.2.1.

comment:8 Changed 8 years ago by mojca (Mojca Miklavec)

Cc: mojca@… added

Cc Me!

comment:9 Changed 8 years ago by mojca (Mojca Miklavec)

On 10.7 there is a related problem:

In file included from der_getint_unittest.cc:14:
../../external_tests/common/scoped_ptrs.h:33:1: error: no type named 'unique_ptr' in namespace 'std'
SCOPED(PK11SlotInfo);

An ugly workaround that worked for me was adding

build.args-append NSS_DISABLE_GTESTS=1

comment:10 Changed 8 years ago by josephsacco

Same problem building on a G4 PowerMac running OS X10.5.8. I managed to get nss to build using the latest versions of macports-gcc-4.8 and macports-gcc-5. In order to use GCC, I had to modify the Portfile, removing "-arch ${arch}" wherever I found it.

-Joseph

comment:11 Changed 8 years ago by dbevans (David B. Evans)

Cc: devans@… added
Resolution: fixed
Status: newclosed

Fixes committed

  • Blacklist old compilers that don't understand -std=c++0x, r148450
  • External tests require libc++, disable on platforms where stdlib is libstdc++, r148453

With these fixes, nss builds on 10.6+ as verified by buildbots. 10.5 and earlier not tested.

comment:12 in reply to:  2 Changed 8 years ago by ballapete (Peter "Pete" Dyballa)

Replying to Peter_Dyballa@…:

Trying the patch std=.patch allows compilation of gtest-all.c. But now a new error arrises:

make[2]: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_nue.de.rsync.macports.org_macports_release_tarballs_ports_net_nss/nss/work/nss-3.23/nss/external_tests/google_test'
cd der_gtest; /usr/bin/make libs
make[2]: Entering directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_nue.de.rsync.macports.org_macports_release_tarballs_ports_net_nss/nss/work/nss-3.23/nss/external_tests/der_gtest'
if test ! -d Output.OBJD; then rm -rf Output.OBJD; ../../coreconf/nsinstall/Output.OBJD/nsinstall -D Output.OBJD; fi
/usr/bin/llvm-g++-4.2 -arch x86_64 -o Output.OBJD/der_getint_unittest.o -c -Os -fPIC  -fno-common -pipe -DDARWIN -DHAVE_STRERROR -DHAVE_BSD_FLOCK  -Wall -DNSS_NO_GCC48 -DXP_UNIX -UDEBUG -DNDEBUG -DUSE_UTIL_DIRECTLY -DNO_NSPR_10_SUPPORT -DSSL_DISABLE_DEPRECATED_CIPHER_SUITE_NAMES -I../../external_tests/google_test/gtest/include -I../../external_tests/common -I/opt/local/include/nspr -I../../../dist/Output.OBJD/include -I../../../dist/public/nss -I../../../dist/private/nss -I../../../dist/public/nspr -I../../../dist/public/nss -I../../../dist/public/libdbm -I../../../dist/public/gtest   der_getint_unittest.cc
In file included from der_getint_unittest.cc:14:
../../external_tests/common/scoped_ptrs.h:33: error: expected initializer before ‘<’ token
../../external_tests/common/scoped_ptrs.h:34: error: expected initializer before ‘<’ token
../../external_tests/common/scoped_ptrs.h:35: error: expected initializer before ‘<’ token
../../external_tests/common/scoped_ptrs.h:36: error: expected initializer before ‘<’ token
../../external_tests/common/scoped_ptrs.h:37: error: expected initializer before ‘<’ token
../../external_tests/common/scoped_ptrs.h:38: error: expected initializer before ‘<’ token
../../external_tests/common/scoped_ptrs.h:39: error: expected initializer before ‘<’ token
make[2]: *** [Output.OBJD/der_getint_unittest.o] Error 1

So it's this block of C++ statements that the used Apple GCC 4.2 does not understand:

   31	#define SCOPED(x) typedef std::unique_ptr<x, ScopedMaybeDelete<x> > Scoped ## x
   32	
   33	SCOPED(PK11SlotInfo);
   34	SCOPED(SECItem);
   35	SCOPED(PK11SymKey);
   36	SCOPED(SECKEYPublicKey);
   37	SCOPED(SECKEYPrivateKey);
   38	SCOPED(SECAlgorithmID);
   39	SCOPED(CERTSubjectPublicKeyInfo);
   40	
   41	#undef SCOPED

I think this means that at least GCC 4.8 has to be used, taking into account also the warning from coreconf/Werror.mk… (but I am no C++ expert)

comment:13 Changed 8 years ago by ballapete (Peter "Pete" Dyballa)

Having finally found a patch to make Clang-3.3 build on PPC Tiger, Mac OS X 10.4.11, the build of nss failes again:

/opt/local/bin/clang-mp-3.3 -arch ppc -o Output.OBJD/Darwin_SINGLE_SHLIB/pqg.o -c -Os -fPIC -Dppc -fno-common -pipe -DDARWIN -DHAVE_STRERROR -DHAVE_BSD_FLOCK  -Wall -Qunused-arguments -Wno-parentheses-equality -Wno-array-bounds  -Werror -DXP_UNIX -DSHLIB_SUFFIX=\"dylib\" -DSHLIB_PREFIX=\"lib\" -DSHLIB_VERSION=\"3\" -DSOFTOKEN_SHLIB_VERSION=\"3\" -DRIJNDAEL_INCLUDE_TABLES -UDEBUG -DNDEBUG -DUSE_UTIL_DIRECTLY -DNO_NSPR_10_SUPPORT -DSSL_DISABLE_DEPRECATED_CIPHER_SUITE_NAMES -DMP_API_COMPATIBLE -I/opt/local/include/nspr -I../../../dist/Output.OBJD/include -I../../../dist/public/nss -I../../../dist/private/nss -Impi -Iecl  pqg.c
pqg.c:339:16: error: comparison of constant 18446744073709551615 with expression of type 'unsigned long' is always true [-Werror,-Wtautological-constant-out-of-range-compare]
    if (addend < MP_DIGIT_MAX) {
        ~~~~~~ ^ ~~~~~~~~~~~~
1 error generated.
make[3]: *** [Output.OBJD/Darwin_SINGLE_SHLIB/pqg.o] Error 1
make[3]: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_lil.fr.rsync.macports.org_release_tarballs_ports_net_nss/nss/work/nss-3.23/nss/lib/freebl'

Changed 8 years ago by ballapete (Peter "Pete" Dyballa)

Attachment: main.3.log added

main.log from build on PPC Tiger with pqg.c:339:16: error

comment:14 in reply to:  10 Changed 7 years ago by ballapete (Peter "Pete" Dyballa)

Replying to drjesacco@…:

Same problem building on a G4 PowerMac running OS X10.5.8. I managed to get nss to build using the latest versions of macports-gcc-4.8 and macports-gcc-5. In order to use GCC, I had to modify the Portfile, removing "-arch ${arch}" wherever I found it.

Yes, this seems to be the cause for the inadequate assembler output, that cannot be compiled. I "simplified" Portfile – and nss built!

QED.

Changed 7 years ago by ballapete (Peter "Pete" Dyballa)

Attachment: Portfile added

simplified Portfile

comment:15 Changed 7 years ago by ballapete (Peter "Pete" Dyballa)

Meanwhile nss @3.27.1_0 is active. It again failed to build. Removing the -arch ${build_arch} additions to build.args allows nss to build.

Note: See TracTickets for help on using tickets.