Building from source fails on Solaris due to missing locale.h
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
pcb |
Fix Released
|
Low
|
Bert Timmerman |
Bug Description
I have been using pcb (along with gschem and gerbv) on Oracle Solaris
for a while (since Solaris is my primary OSat home as well as at work)
and the tools work pretty well for me.
Deploying those tools on Solaris is straightforward, I just need to deal
with a small issue when building pcb - compilation fails on Oracle Solaris 11.3
(building with Solaris Studio 12.4) complaining about undefined LC_MESSAGES symbol:
$ git clone git://git.
$ cd pcb-git
$ export PATH=/usr/
$ ./autogen.sh
$ CC=/opt/
$ make
...
/opt/SUNWspro/
"./global.h", line 253: warning: syntax error: empty member declaration
"./global.h", line 269: warning: syntax error: empty member declaration
"./global.h", line 277: warning: syntax error: empty member declaration
"./global.h", line 283: warning: syntax error: empty member declaration
"./global.h", line 297: warning: syntax error: empty member declaration
"./global.h", line 315: warning: syntax error: empty member declaration
"./global.h", line 362: warning: syntax error: empty member declaration
"./global.h", line 372: warning: syntax error: empty member declaration
"./global.h", line 384: warning: syntax error: empty member declaration
"./global.h", line 408: warning: syntax error: empty member declaration
"hid/gtk/
"hid/gtk/
cc: acomp failed for hid/gtk/
make[4]: *** [hid/gtk/
make[4]: Leaving directory `/data/
make[3]: *** [all-recursive] Error 1
make[3]: Leaving directory `/data/
make[2]: *** [all] Error 2
make[2]: Leaving directory `/data/
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/data/
make: *** [all] Error 2
$
To workaround this problem, I enriched hid/gtk/
$ git status -s
M src/hid/
M src/hid/
M src/hid/
M src/main.c
M src/print.c
M src/report.c
After that, build succeed. I call it a workaround only, since it needs to be investigated if better solution to this problem exists.
Changed in pcb: | |
status: | Triaged → In Progress |
assignee: | nobody → Bert Timmerman (bert-timmerman) |
milestone: | none → next-bug-release |
Changed in pcb: | |
milestone: | next-bug-release → future-bug-release |
Changed in pcb: | |
status: | In Progress → Fix Released |
milestone: | pcb-4.0.1 → none |
Changed in pcb: | |
status: | Fix Released → In Progress |
milestone: | none → pcb-4.1.0 |
Changed in pcb: | |
status: | In Progress → Fix Committed |
Changed in pcb: | |
status: | Fix Committed → Fix Released |
I have inspected how those files interact with locale.h - there seem to be two scenarios.
[1] main.c, print.c
Those two files call setlocale() API if ENABLE_NFS is defined. So it seems to me that those two files should include locale.h in that case, since this is how setlocale() API is made available to the consumers.
[2] gui-config.c, gui-misc.c, gui-netlist- window. c, report.c
Those files do not seem to consume any locale.h API directly, but they all call C_() macro which is defined in global.h:
# define C_(C, S) pgettext(C, S)
pgettext() macro is in turn defined in gettext.h as
#ifdef DEFAULT_TEXT_DOMAIN TEXT_DOMAIN, Msgctxt GETTEXT_ CONTEXT_ GLUE Msgid, Msgid, LC_MESSAGES) CONTEXT_ GLUE Msgid, Msgid, LC_MESSAGES)
# define pgettext(Msgctxt, Msgid) \
pgettext_aux (DEFAULT_
#else
# define pgettext(Msgctxt, Msgid) \
pgettext_aux (NULL, Msgctxt GETTEXT_
#endif
pgettext_aux () takes LC_MESSAGES as an argument. Since LC_MESSAGES is provided by locale.h, gettext.h should include it.
Based on that, it seems that following three files should include locale.h:
src/main.c
src/print.c
src/gettext.h
Patch with proposed fix is attached. I have tested these changes on Oracle Solaris 11.3 and Ubunutu 14.04. In both cases, tried to build with both NLS support enabled and disabled.