pcb

Building from source fails on Solaris due to missing locale.h

Bug #1529233 reported by Jan Damborsky on 2015-12-25
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
gEDA project
Undecided
Unassigned
pcb
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.geda-project.org/pcb.git pcb-git
$ cd pcb-git
$ export PATH=/usr/local/texlive/2015/bin/i386-solaris:/usr/gnu/bin:$PATH
$ ./autogen.sh
$ CC=/opt/SUNWspro/bin/cc CXX=/opt/SUNWspro/bin/CC CFLAGS="-m64" LDFLAGS="-L/usr/lib/amd64" ./configure --disable-gl --disable-toporouter
$ make
...
/opt/SUNWspro/bin/cc -DLOCALEDIR=\"/usr/local/share/locale\" -DHAVE_CONFIG_H -I. -I.. -I.. -I./hid/gtk -I/usr/include/gd2 -I/usr/include/dbus-1.0 -I/usr/lib/dbus-1.0/include -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS -D_PTHREADS -I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/gio-unix-2.0/ -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng12 -I/usr/include/gd2 -DPREFIXDIR=\"/usr/local\" -DBINDIR=\"/usr/local/bin\" -DHOST=\"i386-pc-solaris2.11\" -DPCBLIBDIR=\"/usr/local/share/pcb\" -DPCBTREEDIR=\"/usr/local/share/pcb/newlib\" -DPCBTREEPATH=\"/usr/local/share/pcb/newlib:/usr/local/share/pcb/pcblib-newlib\" -DNDEBUG -m64 -c -o hid/gtk/libgtk_a-gui-config.o `test -f 'hid/gtk/gui-config.c' || echo './'`hid/gtk/gui-config.c
"./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/gui-config.c", line 673: warning: statement not reached
"hid/gtk/gui-config.c", line 1753: undefined symbol: LC_MESSAGES
cc: acomp failed for hid/gtk/gui-config.c
make[4]: *** [hid/gtk/libgtk_a-gui-config.o] Error 2
make[4]: Leaving directory `/data/smb/public/Downloads/gEDA/pcb-git-test/src'
make[3]: *** [all-recursive] Error 1
make[3]: Leaving directory `/data/smb/public/Downloads/gEDA/pcb-git-test/src'
make[2]: *** [all] Error 2
make[2]: Leaving directory `/data/smb/public/Downloads/gEDA/pcb-git-test/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/data/smb/public/Downloads/gEDA/pcb-git-test'
make: *** [all] Error 2
$

To workaround this problem, I enriched hid/gtk/gui-config.c as well as following files with '#include <locale.h>'.

$ git status -s
M src/hid/gtk/gui-config.c
M src/hid/gtk/gui-misc.c
M src/hid/gtk/gui-netlist-window.c
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.

Jan Damborsky (dambi) wrote :

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
# define pgettext(Msgctxt, Msgid) \
   pgettext_aux (DEFAULT_TEXT_DOMAIN, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, LC_MESSAGES)
#else
# define pgettext(Msgctxt, Msgid) \
   pgettext_aux (NULL, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, LC_MESSAGES)
#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.

Bert Timmerman (bert-timmerman) wrote :

Hi,

Builds OK on a laptop with locale.h installed.

Pushed to topic branch "home/bert/LP1529233".

Kind regards,

Bert Timmerman.

Changed in pcb:
status: New → Triaged
importance: Undecided → Low
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
Jan Damborsky (dambi) wrote :

I have recently tried to build pcb-4.0.0 on Oracle Solaris 11 and it now builds fine, since all affected C files include (either directly or indirectly) global.h header which in turn includes locale.h as a result of changes delivered by

commit 29cca760bb7e0177470f98285480b4b378d80d34
Author: Britton Leo Kerin <email address hidden>
Date: Mon Mar 7 11:54:46 2016 -0900

    Included missing locale.h header

    Signed-off-by: bert <email address hidden>

Thus, as far as I can tell, this bug could be closed as fixed.

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
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers