Opened 3 months ago

Last modified 3 months ago

#70267 closed defect

libgpg-error @1.50 does not build: Undefined symbols: "_environ" — at Version 2

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 (2)

comment:1 Changed 3 months ago by barracuda156

I cannot open a ticket with their bug tracking system, since registration is disabled -_-

comment:2 Changed 3 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: assignedaccepted

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.

Note: See TracTickets for help on using tickets.