Closed Bug 1625133 Opened 2 years ago Closed 2 years ago

error: implicit declaration of function 'getopt' in coreconf/nsinstall/nsinstall.c

Categories

(NSS :: Build, defect, P1)

3.51
defect

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: tropikhajma, Assigned: tropikhajma)

Details

Attachments

(1 file)

Attached patch 06-getopt.patchSplinter Review

User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Firefox/68.0

Steps to reproduce:

This is on Oracle Solaris 11.4, building with gcc 9.2.0, both i386 and sparc.
Tried to build nss as usual (it worked with 3.45)

Actual results:

it failed with
...
cd nsinstall; /usr/gnu/bin/make libs
make[3]: Entering directory '/builds/pheimlic/nssuprev/components/nss/build/i86/coreconf/nsinstall'
gcc -o SunOS5.11_i86pc_gcc_OPT.OBJ/nsinstall.o -c -std=c99 -O2 -Wall -Wno-format -Werror-implicit-function-declaration -Wno-switch -fPIC -DSVR4 -DSYSV -D__svr4 -D__svr4__ -DSOLARIS -D_REENTRANT -Di386 -m32 -Wall -Wshadow -DNSS_NO_GCC48 -DXP_UNIX -UDEBUG -DNDEBUG -DNSS_NO_INIT_SUPPORT -DUSE_UTIL_DIRECTLY -DNO_NSPR_10_SUPPORT -DSSL_DISABLE_DEPRECATED_CIPHER_SUITE_NAMES -I../../../dist/SunOS5.11_i86pc_gcc_OPT.OBJ/include -I../../../dist/public/coreconf -I../../../dist/private/coreconf -I/usr/include/mps nsinstall.c
nsinstall.c: In function 'main':
nsinstall.c:201:19: error: implicit declaration of function 'getopt'; did you mean 'gettxt'? [-Werror=implicit-function-declaration]
201 | while ((opt = getopt(argc, argv, "C:DdlL:Rm:o:g:t")) != EOF) {
| ^~~~~~
| gettxt
nsinstall.c:203:20: error: 'optarg' undeclared (first use in this function)
203 | case 'C': cwd = optarg; break;
| ^~~~~~
nsinstall.c:203:20: note: each undeclared identifier is reported only once for each function it appears in
nsinstall.c:225:13: error: 'optind' undeclared (first use in this function)
225 | argc -= optind;
| ^~~~~~
cc1: some warnings being treated as errors
make[3]: *** [../../coreconf/rules.mk:393: SunOS5.11_i86pc_gcc_OPT.OBJ/nsinstall.o] Error 1
make[3]: Leaving directory '/builds/pheimlic/nssuprev/components/nss/build/i86/coreconf/nsinstall'

I had to use the attached patch to workaround it.

Expected results:

It should've built completely

Comment on attachment 9135950 [details] [diff] [review]
06-getopt.patch

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

Thanks!
Attachment #9135950 - Flags: review+
Assignee: nobody → tropikhajma
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Priority: -- → P1
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 3.52
You need to log in before you can comment on or make changes to this bug.