Closed Bug 1546440 Opened 5 years ago Closed 5 years ago

gfx/angle/checkout/src/common/system_utils_posix.cpp:175:65: error: 'environ' was not declared in this scope

Categories

(Core :: Graphics, defect, P1)

Unspecified
FreeBSD
defect

Tracking

()

RESOLVED FIXED
Tracking Status
firefox-esr60 --- unaffected
firefox67 --- unaffected
firefox68 --- fixed

People

(Reporter: jbeich, Assigned: jgilbert)

References

(Regression)

Details

(Keywords: regression)

Attachments

(1 file)

On non-GNU systems extern char **environ may not defined in any standard header. POSIX is unclear if this is a requirement and seems to allude to historical implementations.

http://pubs.opengroup.org/onlinepubs/9699919799/functions/exec.html
https://docs.oracle.com/cd/E36784_01/html/E36872/exec-2.html
https://man.freebsd.org/exec/3

$ c++ -v
FreeBSD clang version 8.0.0 (tags/RELEASE_800/final 356365) (based on LLVM 8.0.0)
Target: x86_64-unknown-freebsd13.0
Thread model: posix
InstalledDir: /usr/bin

$ ./mach bootstrap
$ ./mach build
[...]
gfx/angle/checkout/src/common/system_utils_posix.cpp:175:65: error: use of undeclared identifier 'environ'
execve(args[0], const_cast<char *const *>(args.data()), environ);
^
1 error generated.

Attached patch fixSplinter Review

https://treeherder.mozilla.org/#/jobs?repo=try&revision=acd8305b6e2b384b16ccc5cdaec4b113ff0acf30

The patch is in the public domain, so feel free to pretend you've written it. I can't submit or even report upstream due to Google Account requirement, and signing up for one via Tor doesn't work.

Shahbaz, are you the author https://chromium.googlesource.com/angle/angle/+/a9f89313bcfe%5E%21/ ? Could you help upstreaming the fix? It doesn't need to be the same but if you use ANGLE_PLATFORM_* blacklist beware GNU/kFreeBSD (matches GLIBC) does have "environ" in <unistd.h>.

Flags: needinfo?(shabbyX2)
Priority: -- → P3
Assignee: nobody → jgilbert
Priority: P3 → P1
Flags: needinfo?(shabbyX2)
Depends on: angle-68-2

Builds fine bug 1546558 has landed.

Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED

On Solaris there is still an issue during linking:

/usr/bin/g++ -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fstack-protector-strong -Wall -Wempty-body -Wignored-qualifiers -Woverloaded-virtual -Wpointer-arith -Wsign-compare -Wtype-limits -Wunreachable-code -Wwrite-strings -Wno-invalid-offsetof -Wc++1z-compat -Wduplicated-cond -Wimplicit-fallthrough -Wno-error=maybe-uninitialized -Wno-error=deprecated-declarations -Wno-error=array-bounds -Wno-error=coverage-mismatch -Wno-error=free-nonheap-object -Wformat -Wformat-overflow=2 -fno-sized-deallocation -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fstack-protector-strong -fno-exceptions -fno-strict-aliasing -fno-rtti -ffunction-sections -fdata-sections -fno-exceptions -fno-math-errno -pthread -pipe -g -O -fno-omit-frame-pointer -funwind-tables -fPIC -shared -Wl,-h,libxul.so -o libxul.so @/builds/psumbera/FIREFOX/obj-sparc64-sun-solaris2.11/toolkit/library/libxul_so.list -lpthread -fstack-protector-strong -Wl,-z,text -L/builds/psumbera/FIREFOX/obj-sparc64-sun-solaris2.11/dist/bin ../../security/nss/lib/crmf/crmf_crmf/libcrmf.a ../../js/src/build/libjs_static.a /builds/psumbera/FIREFOX/obj-sparc64-sun-solaris2.11/sparcv9-sun-solaris/debug/libgkrust.a ../../config/external/nspr/pr/libnspr4.so ../../config/external/nspr/libc/libplc4.so ../../config/external/nspr/ds/libplds4.so ../../config/external/lgpllibs/liblgpllibs.so ../../security/nss/lib/nss/nss_nss3/libnss3.so ../../security/nss/lib/util/util_nssutil3/libnssutil3.so ../../security/nss/lib/smime/smime_smime3/libsmime3.so ../../config/external/sqlite/libmozsqlite3.so ../../security/nss/lib/ssl/ssl_ssl3/libssl3.so ../../widget/gtk/mozgtk/stub/libmozgtk_stub.so -lsocket -L/usr/lib/sparcv9 -licui18n -licuuc -licudata -lpthread -lffi -lz -lm -lposix4 -ldl -lnsl -lsocket -lfreetype -lfontconfig -lXrender -levent -ldbus-glib-1 -ldbus-1 -lgobject-2.0 -lglib-2.0 -lpangocairo-1.0 -lpango-1.0 -latk-1.0 -lcairo-gobject -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lX11-xcb -lxcb-shm -lxcb -lX11 -lXext -lpangoft2-1.0 -lXt -lgthread-2.0 -lelf -ldemangle
Undefined first referenced
symbol in file
_environ ../../gfx/angle/targets/angle_common/system_utils_posix.o (symbol scope specifies local binding)
ld: fatal: symbol referencing errors


I wonder why execv() cannot be used instead of execve() (to avoid usage of environ at all)?

From Solaris man page exec(2):

   int execve(const char *path, char *const argv[],
        char *const envp[]);

..

   The envp argument is an array of character pointers to  null-terminated
   strings.  These  strings constitute the environment for the new process
   image. The envp array is terminated by a  null  pointer.  For  execl(),
   execv(), execvp(), and execlp(), the C-language run-time start-off rou-
   tine places a pointer to the environment of the calling process in  the
   global  object  extern char **environ, and it is used to pass the envi-
   ronment of the calling process to the new process image.

..

  The environ array should not be accessed directly by the application.

--

Ok! Can you file a follow-up bug for that?

Flags: needinfo?(petr.sumbera)

I have filed Bug 1547193.

Flags: needinfo?(petr.sumbera)
Regressions: 1547193
Blocks: 1547193
No longer regressions: 1547193
Has Regression Range: --- → yes
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: