Opened 5 months ago
Closed 5 months ago
#70267 closed defect (fixed)
libgpg-error @1.50 does not build: Undefined symbols: "_environ"
Reported by: | barracuda156 | Owned by: | ryandesign (Ryan Carsten Schmidt) |
---|---|---|---|
Priority: | Normal | Milestone: | |
Component: | ports | Version: | 2.9.3 |
Keywords: | legacy-os tiger leopard snowleopard lion haspatch | Cc: | Schamschula (Marius Schamschula) |
Port: | libgpg-error |
Description (last modified by ryandesign (Ryan Carsten Schmidt))
The patch used in [72a1a9efe3711c6dcfeb8bedc96fe837ef0fe7dd/macports-ports] fails to work:
Undefined symbols: "_environ", referenced from: _environ$non_lazy_ptr in libgpg_error_la-spawn-posix.o ld: symbol(s) not found
Unfortunately, replacing it with what is usually correct:
#ifdef __APPLE__ # include <crt_externs.h> # define environ (*_NSGetEnviron()) #else extern char **environ; #endif
does not work here:
libtool: compile: /usr/bin/gcc-4.2 -std=gnu99 -DHAVE_CONFIG_H -I. -I.. -DLOCALEDIR=\"/opt/local/share/locale\" -I/opt/local/include -pipe -Os -arch ppc -Wall -Wpointer-arith -MT libgpg_error_la-version.lo -MD -MP -MF .deps/libgpg_error_la-version.Tpo -c version.c -fno-common -DPIC -o .libs/libgpg_error_la-version.o spawn-posix.c:72: error: field '_NSGetEnviron' declared as a function spawn-posix.c: In function 'my_exec': spawn-posix.c:350: error: expected identifier before '(' token spawn-posix.c:351: error: expected identifier before '(' token spawn-posix.c: In function '_gpgrt_spawn_actions_set_environ': spawn-posix.c:456: error: expected identifier before '(' token libtool: compile: /usr/bin/gcc-4.2 -std=gnu99 -DHAVE_CONFIG_H -I. -I.. -DLOCALEDIR=\"/opt/local/share/locale\" -I/opt/local/include -pipe -Os -arch ppc -Wall -Wpointer-arith -MT libgpg_error_la-init.lo -MD -MP -MF .deps/libgpg_error_la-init.Tpo -c init.c -fno-common -DPIC -o .libs/libgpg_error_la-init.o make[3]: *** [libgpg_error_la-spawn-posix.lo] Error 1 make[3]: *** Waiting for unfinished jobs....
Change History (4)
comment:1 Changed 5 months ago by barracuda156
comment:2 Changed 5 months ago by ryandesign (Ryan Carsten Schmidt)
Cc: | Schamschula added |
---|---|
Description: | modified (diff) |
Keywords: | legacy-os tiger leopard snowleopard lion added |
Owner: | changed from Schamschula to ryandesign |
Status: | assigned → accepted |
You are building with gcc for ppc so I assume this is on Mac OS X 10.6. The patch works fine on OS X 10.8 and later per buildbot results. You cannot expect everyone to write code compatible with ancient systems. For 10.7 and earlier, _NSGetEnviron()
needs to be called. There are patches in the sudo, hugs98, newlisp, and other ports that show how to do this.
comment:3 Changed 5 months ago by ryandesign (Ryan Carsten Schmidt)
Keywords: | haspatch added |
---|
The usual fix:
#ifdef __APPLE__ # include <crt_externs.h> # define environ (*_NSGetEnviron()) #else extern char **environ; #endif
does not work here because this code also defines struct gpgrt_spawn_actions
which contains an environ
member, so I've submitted a slightly different fix in https://github.com/macports/macports-ports/pull/24601
Marius, since you already have an account on their bug tracker, maybe you can update https://dev.gnupg.org/T7169 with the solution.
comment:4 Changed 5 months ago by ryandesign (Ryan Carsten Schmidt)
Resolution: | → fixed |
---|---|
Status: | accepted → closed |
I cannot open a ticket with their bug tracking system, since registration is disabled -_-