Closed Bug 1226179 Opened 9 years ago Closed 9 years ago

3.21 build failure on OpenBSD with gcc 4.2.1

Categories

(NSS :: Libraries, defect)

3.21
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: gaston, Assigned: gaston)

References

Details

Attachments

(1 file, 2 obsolete files)

Build fails with

In file included from secoid.c:1915:
verref.h: In function 'SECOID_Init':
verref.h:22: error: #pragma GCC diagnostic not allowed inside functions
verref.h:23: error: #pragma GCC diagnostic not allowed inside functions
verref.h:31: warning: unused variable '_nss_version_c'
verref.h:39: error: #pragma GCC diagnostic not allowed inside functions

Probable fallout of the #pragma addition in #1182667
Blocks: 1182667
Another nasty one:

g++ -o OpenBSD5.8_64_OPT.OBJ/ssl_agent_unittest.o -c  -fPIC -DPIC  -ansi -Wall -Wno-switch -pipe -DOPENBSD -DXP_UNIX -UDEBUG -DNDEBUG -pthr
ead -DUSE_UTIL_DIRECTLY -DNO_NSPR_10_SUPPORT -DSSL_DISABLE_DEPRECATED_CIPHER_SUITE_NAMES -I../../external_tests/google_test/gtest/include -
I/usr/local/include/nspr -I../../../dist/OpenBSD5.8_64_OPT.OBJ/include -I../../../dist/public/nss -I../../../dist/private/nss -I../../../di
st/public/nspr -I../../../dist/public/nss -I../../../dist/public/libdbm -I../../../dist/public/gtest -I/usr/local/include -O2 -pipe   -I../
../lib/ssl -std=c++0x ssl_agent_unittest.cc
cc1plus: error: unrecognized command line option "-std=c++0x"


So nss decided to unsupported old compilers on purpose or it's an oversight ?
You probably want to disable gtests. Have a look at bug 1225377 comment 3. That should at least solve the problem from comment 1
Sorry, but only disabling gtests wont fix the #pragma error, i think there needs another check for the gcc version to enable those..
#pragma GCC diagnostic was added in gcc 4.6.

Testing this in the #ifdef

#if defined(__GNUC__) && !defined(NSS_NO_GCC48) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))
Assignee: nobody → landry
Attachment #8699168 - Flags: review?(martin.thomson)
Attached patch bug1226179.patch (obsolete) — Splinter Review
The test for the right compiler version is more difficult than you have in your patch.  This should work better.
Attachment #8699168 - Attachment is obsolete: true
Attachment #8699168 - Flags: review?(martin.thomson)
Attachment #8699348 - Flags: review?(landry)
Comment on attachment 8699348 [details] [diff] [review]
bug1226179.patch

That doesn't seem to work on 3.21, replacing my patch - which is *not* about -Werror but about #pragma diagnostic :

===>  Building for nss-3.21
coreconf/Werror.mk:55: Unable to find gcc 4.8 or greater, disabling -Werror

But the build still fails the same:

In file included from secoid.c:1915:
verref.h: In function 'SECOID_Init':
verref.h:22: error: #pragma GCC diagnostic not allowed inside functions
verref.h:23: error: #pragma GCC diagnostic not allowed inside functions
verref.h:31: warning: unused variable '_nss_version_c'
verref.h:39: error: #pragma GCC diagnostic not allowed inside functions
Attachment #8699348 - Flags: review?(landry) → review-
Comment 0 also affects FreeBSD 9.x and NetBSD 6.x [1].

[1] https://github.com/jsonn/pkgsrc/commit/86e9200dfb187688af35a55fb6a08580f30cae96
Attached patch bug1226179.patchSplinter Review
This should make the changes more thorough.

I still don't understand how -Werror was being set for platforms other than Linux, since none of the makefiles for those platforms was including the Werror.mk file, or referencing WARNING_CFLAGS anywhere.

And even if they did, NSS_NO_GCC48 is defined if -Werror isn't, which would mean that the pragma isn't hit.  Have you made changes to the build configuration?  Or have you set any environment variables that might alter it?
Attachment #8699348 - Attachment is obsolete: true
Attachment #8703500 - Flags: review?(landry)
(In reply to Martin Thomson [:mt:] from comment #9)
> Created attachment 8703500 [details] [diff] [review]
> bug1226179.patch
> 
> 
> And even if they did, NSS_NO_GCC48 is defined if -Werror isn't, which would
> mean that the pragma isn't hit.  Have you made changes to the build
> configuration?  Or have you set any environment variables that might alter
> it?

The changes to the build config are unrelated imo, see the few patches in http://cvsweb.openbsd.org/cgi-bin/cvsweb/ports/security/nss/patches/ - and the env vars set urelated too ,see http://cvsweb.openbsd.org/cgi-bin/cvsweb/ports/security/nss/Makefile?rev=1.56&content-type=text/x-cvsweb-markup
Comment on attachment 8703500 [details] [diff] [review]
bug1226179.patch

With your patch, using

gmake NSPR_INCLUDE_DIR=/usr/local/include/nspr NSPR_LIB_DIR=/usr/local/lib/ USE_64=1 NSS_DISABLE_GTESTS=1

in nss tip, the build goes past verref.h, only one warning remaining on it:
In file included from secoid.c:1987:
verref.h: In function 'SECOID_Init':
verref.h:31: warning: unused variable '_nss_version_c'

-DNSS_NO_GCC48 is present in the build commands - the build is successful.
(i still need NSS_DISABLE_GTESTS=1 otherwise it fails because those require stdc++11)

Note that i'm not an nspr peer, so i can only f+ this...
Attachment #8703500 - Flags: review?(ted)
Attachment #8703500 - Flags: review?(landry)
Attachment #8703500 - Flags: feedback+
Thanks for checking.  The warning is expected in these circumstances.
Comment on attachment 8703500 [details] [diff] [review]
bug1226179.patch

This fixes build on FreeBSD 9.3-RELEASE. Like OpenBSD we're going to pass NSS_DISABLE_GTESTS before switching to system gtest. 1.7.0 doesn't require C++11 (or C++0x) by itself.

https://www.freebsd.org/doc/en/books/porters-handbook/bundled-libs.html
https://svnweb.freebsd.org/ports/head/devel/googletest/files/patch-bsd-defines?revision=373421&view=co
Attachment #8703500 - Flags: feedback+
Thanks for checking.  We certainly intended for the C++ code to be disabled in builds like that.  Firefox builds disable it as well.
ted, ping ?
Flags: needinfo?(ted)
Er, this is an NSS patch, and I'm not an NSS peer.
Flags: needinfo?(ted)
Comment on attachment 8703500 [details] [diff] [review]
bug1226179.patch

Review of attachment 8703500 [details] [diff] [review]:
-----------------------------------------------------------------

Well, I'm fairly sure that I'm allowed to check this in, so I'm going to.  Sorry ted, not paying enough attention.
Attachment #8703500 - Flags: review?(ted)
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → 3.23
https://hg.mozilla.org/projects/nss/rev/7bbcda0719dc
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: