Bug 14396

Summary: Solaris build fails: main.c: non-constant initializer: op "U&"
Product: pkg-config Reporter: Daniel Richard G. <skunk>
Component: srcAssignee: Tollef Fog Heen <tfheen>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: medium    
Version: unspecified   
Hardware: SPARC   
OS: Solaris   
Whiteboard:
i915 platform: i915 features:
Attachments: Patch againt main.c

Description Daniel Richard G. 2008-02-05 21:43:27 UTC
Created attachment 14168 [details] [review]
Patch againt main.c

Building pkg-config-0.23 on Solaris 8 using the vendor compiler fails with the following error:

----begin----
source='main.c' object='main.o' libtool=no \
depfile='.deps/main.Po' tmpdepfile='.deps/main.TPo' \
depmode=none /bin/ksh ./depcomp \
cc -DHAVE_CONFIG_H -I. -I. -I. -DPKG_CONFIG_PC_PATH="\"/usr/local/lib/pkgconfig:/usr/local/share/pkgconfig\"" -I./glib-1.2.10   -D__EXTENSIONS__ -D_REENTRANT -Dsparc  -Xa -misalign -mt -v -xarch=v9 -xcrossfile -xO5 -c `test -f 'main.c' || echo './'`main.c
"main.c", line 212: warning: initialization type mismatch
"main.c", line 213: non-constant initializer: op "U&"
"main.c", line 215: non-constant initializer: op "U&"
"main.c", line 217: non-constant initializer: op "U&"
"main.c", line 219: non-constant initializer: op "U&"
"main.c", line 221: non-constant initializer: op "U&"
"main.c", line 223: non-constant initializer: op "U&"
"main.c", line 225: non-constant initializer: op "U&"
"main.c", line 227: non-constant initializer: op "U&"
"main.c", line 229: non-constant initializer: op "U&"
"main.c", line 231: non-constant initializer: op "U&"
"main.c", line 233: non-constant initializer: op "U&"
"main.c", line 235: non-constant initializer: op "U&"
"main.c", line 237: non-constant initializer: op "U&"
"main.c", line 241: non-constant initializer: op "U&"
"main.c", line 243: non-constant initializer: op "U&"
"main.c", line 245: non-constant initializer: op "U&"
"main.c", line 247: non-constant initializer: op "U&"
"main.c", line 249: non-constant initializer: op "U&"
"main.c", line 251: non-constant initializer: op "U&"
"main.c", line 257: non-constant initializer: op "U&"
"main.c", line 667: cannot recover from previous errors
cc: acomp failed for main.c
*** Error code 2
make: Fatal error: Command failed for target `main.o'
----end----

I resolved this by adding the "static" keyword to all the local variables in main() that are referenced in the options_table array. (I'm assuming that main() is not called more than once in any invocation of the program.)

A patch is attached.
Comment 1 Dan Nicholson 2012-05-21 21:27:05 UTC
I think this was fixed back in commit 9e5bcc26. Please reopen if this is still an issue.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.