Closed Bug 1259537 Opened 8 years ago Closed 8 years ago

gfx/graphite2/src/Bidi.cpp: error: visibility does not match previous declaration __throw_bad_alloc

Categories

(Firefox Build System :: General, defect)

Unspecified
FreeBSD
defect
Not set
normal

Tracking

(firefox47 unaffected, firefox48 fixed, firefox49 fixed)

RESOLVED FIXED
mozilla49
Tracking Status
firefox47 --- unaffected
firefox48 --- fixed
firefox49 --- fixed

People

(Reporter: jbeich, Unassigned)

References

Details

(Keywords: regression)

Attachments

(2 files)

FreeBSD uses libc++ and config/gcc_hidden.h which build, recently, regressed. Aurora isn't affected yet. Workarounds are either to use -fvisibility=hidden instead (like OS X) or go with system graphite2 (bug 847568). Any pointers?

  c++ -o Unified_cpp_gfx_graphite2_src0.o -c -I/obj/dist/stl_wrappers -I/obj/dist/system_wrappers -include /m-c/config/gcc_hidden.h -DNDEBUG=1 -DTRIMMED=1 -DGRAPHITE2_STATIC '-DPACKAGE_VERSION="moz"' '-DPACKAGE_BUGREPORT="http://bugzilla.mozilla.org/"' -DGRAPHITE2_NFILEFACE -DGRAPHITE2_NTRACING -DGRAPHITE2_NSEGCACHE '-DGRAPHITE2_CUSTOM_HEADER="MozGrMalloc.h"' -I/m-c/gfx/graphite2/src -I/obj/gfx/graphite2/src  -I/obj/dist/include  -I/obj/dist/include/nspr -I/obj/dist/include/nss       -fPIC  -DMOZILLA_CLIENT -include /obj/mozilla-config.h -MD -MP -MF .deps/Unified_cpp_gfx_graphite2_src0.o.pp -Qunused-arguments   -I/usr/local/include -Qunused-arguments -Wall -Wc++11-compat -Wempty-body -Wignored-qualifiers -Woverloaded-virtual -Wpointer-arith -Wsign-compare -Wtype-limits -Wunreachable-code -Wwrite-strings -Wc++11-compat-pedantic -Wc++14-compat -Wc++14-compat-pedantic -Wc++1z-compat -Wclass-varargs -Wimplicit-fallthrough -Wloop-analysis -Wthread-safety -Wno-invalid-offsetof -Wno-inline-new-delete -Wno-error=deprecated-declarations -Wno-error=array-bounds -Wno-unknown-warning-option -Wno-return-type-c-linkage -fno-exceptions -fno-strict-aliasing -fno-rtti -fno-exceptions -fno-math-errno -std=gnu++0x -pipe  -O -fomit-frame-pointer    /obj/gfx/graphite2/src/Unified_cpp_gfx_graphite2_src0.cpp
  In file included from /obj/gfx/graphite2/src/Unified_cpp_gfx_graphite2_src0.cpp:2:
  In file included from /m-c/gfx/graphite2/src/Bidi.cpp:27:
  In file included from /m-c/gfx/graphite2/src/inc/Main.h:33:
  In file included from /m-c/gfx/graphite2/src/MozGrMalloc.h:13:
  In file included from /obj/dist/include/mozilla/mozalloc.h:18:
  In file included from /obj/dist/stl_wrappers/new:33:
  In file included from /obj/dist/system_wrappers/new:3:
  /usr/include/c++/v1/new:115:1: error: visibility does not match previous declaration
  _LIBCPP_FUNC_VIS void __throw_bad_alloc();  // not in C++ spec
  ^
  /usr/include/c++/v1/__config:197:42: note: expanded from macro '_LIBCPP_FUNC_VIS'
  #define _LIBCPP_FUNC_VIS __attribute__ ((__visibility__("default")))
					   ^
  /m-c/config/gcc_hidden.h:6:13: note: previous attribute is here
  #pragma GCC visibility push(hidden)
	      ^
  1 error generated.

http://buildbot.rhaalovely.net/builders/mozilla-central-freebsd-amd64/builds/789/steps/build/logs/stdio
Builds fine with bug 1245076 reverted.
Blocks: 1245076
Removing -DGRAPHITE2_CUSTOM_HEADER= from CXXFLAGS doesn't help.

  In file included from /obj/gfx/graphite2/src/Unified_cpp_gfx_graphite2_src0.cpp:2:
  In file included from /m-c/gfx/graphite2/src/Bidi.cpp:28:
  In file included from /m-c/gfx/graphite2/src/inc/Slot.h:32:
  In file included from /m-c/gfx/graphite2/src/inc/Font.h:28:
  In file included from /obj/dist/stl_wrappers/cassert:33:
  In file included from /obj/dist/system_wrappers/new:3:
  /usr/include/c++/v1/new:115:1: error: visibility does not match previous declaration
  _LIBCPP_FUNC_VIS void __throw_bad_alloc();  // not in C++ spec
  ^
  /usr/include/c++/v1/__config:197:42: note: expanded from macro '_LIBCPP_FUNC_VIS'
  #define _LIBCPP_FUNC_VIS __attribute__ ((__visibility__("default")))
					   ^
  /m-c/config/gcc_hidden.h:6:13: note: previous attribute is here
  #pragma GCC visibility push(hidden)
	      ^
  1 error generated.
g++5 with libc++ builds fine that code. Downgrading clang to 3.4-3.7 or libc++ to version shipped with FreeBSD 10.1 doesn't help.

  $ c++ -v
  FreeBSD clang version 3.8.0 (tags/RELEASE_380/final 262564) (based on LLVM 3.8.0)
  Target: x86_64-unknown-freebsd11.0
  Thread model: posix
  InstalledDir: /usr/bin
Component: Graphics: Text → Build Config
After bug 1245076 mozalloc/throw_gcc.h can screw up __throw_bad_alloc() visibility if included *before* any C++ header that pulls <new>. As only libstdc++ needs <cstdlib> workaround it should be hidden behind #if defined(__GLIBCXX__).

Mike, any plan to switch OS X to config/gcc_hidden.h after 10.6-10.8 are deprecated? It'd help with damage control from libstdc++ hacks
Comment on attachment 8739971 [details]
MozReview Request: Bug 1259537 - Unbreak libc++ build after bug 1245076. r?glandium

Review request updated; see interdiff: https://reviewboard.mozilla.org/r/45471/diff/1-2/
Comment on attachment 8739971 [details]
MozReview Request: Bug 1259537 - Unbreak libc++ build after bug 1245076. r?glandium

Breaks build with GCC 6.x. Also, memory thrashing from GCC builds makes me want to give up.
Attachment #8739971 - Attachment is obsolete: true
Attachment #8739971 - Flags: review?(mh+mozilla)
Comment on attachment 8739971 [details]
MozReview Request: Bug 1259537 - Unbreak libc++ build after bug 1245076. r?glandium

Review request updated; see interdiff: https://reviewboard.mozilla.org/r/45471/diff/2-3/
Attachment #8739971 - Attachment description: MozReview Request: Bug 1259537 - Unbreak build with libc++ and config/gcc_hidden.h after bug 1245076. r?glandium → MozReview Request: Bug 1259537 - Unbreak libc++ build after bug 1245076. r?glandium
Attachment #8739971 - Attachment is obsolete: false
Attachment #8739971 - Flags: review?(mh+mozilla)
Please attach the preprocessor output for the file that fails to build. The error on its own doesn't make any sense.
Generated by |c++ -E|. To reproduce run:

  $ clang++ -m64 -std=gnu++11 -fPIC -Qunused-arguments -Wall -Wc++11-compat -Wempty-body -Wignored-qualifiers -Woverloaded-virtual -Wpointer-arith -Wsign-compare -Wtype-limits -Wunreachable-code -Wwrite-strings -Wc++11-compat-pedantic -Wc++14-compat -Wc++14-compat-pedantic -Wc++1z-compat -Wclass-varargs -Wimplicit-fallthrough -Wloop-analysis -Wthread-safety -Wno-invalid-offsetof -Wno-inline-new-delete -Wno-error=deprecated-declarations -Wno-error=array-bounds -Wno-unknown-warning-option -Wno-return-type-c-linkage -fno-exceptions -fno-strict-aliasing -fno-rtti -ffunction-sections -fdata-sections -fno-exceptions -fno-math-errno -pipe -O -fomit-frame-pointer -c Unified_cpp_gfx_graphite2_src0.cpp
  In file included from /obj/gfx/graphite2/src/Unified_cpp_gfx_graphite2_src0.cpp:2:
  In file included from /m-c/gfx/graphite2/src/Bidi.cpp:27:
  In file included from /m-c/gfx/graphite2/src/inc/Main.h:33:
  In file included from /m-c/gfx/graphite2/src/MozGrMalloc.h:13:
  In file included from /obj/dist/include/mozilla/mozalloc.h:18:
  In file included from /obj/dist/stl_wrappers/new:33:
  In file included from /obj/dist/system_wrappers/new:4:
  /usr/include/c++/v1/new:115:17: error: visibility does not match previous declaration
  __attribute__ ((__visibility__("default"))) void __throw_bad_alloc();
		  ^
  /m-c/config/gcc_hidden.h:6:13: note: previous attribute is here
  #pragma GCC visibility push(hidden)
	      ^
  1 error generated.
Attachment #8748073 - Flags: feedback?(mh+mozilla)
Try adding throw_gcc.h to config/system-headers.
Attachment #8748073 - Flags: feedback?(mh+mozilla)
Confirm. It builds fine with mozilla/throw_gcc.h in config/system-headers.
Attachment #8739971 - Flags: review?(mh+mozilla)
Comment on attachment 8739971 [details]
MozReview Request: Bug 1259537 - Unbreak libc++ build after bug 1245076. r?glandium

Review request updated; see interdiff: https://reviewboard.mozilla.org/r/45471/diff/3-4/
Attachment #8739971 - Flags: review?(mh+mozilla)
Keywords: regression
Attachment #8739971 - Flags: review?(mh+mozilla) → review+
Comment on attachment 8739971 [details]
MozReview Request: Bug 1259537 - Unbreak libc++ build after bug 1245076. r?glandium

https://reviewboard.mozilla.org/r/45471/#review47477
Keywords: checkin-needed
Comment on attachment 8739971 [details]
MozReview Request: Bug 1259537 - Unbreak libc++ build after bug 1245076. r?glandium

Approval Request Comment
[Feature/regressing bug #]: bug 1245076 regression
[User impact if declined]: broken build on Bitrig and FreeBSD
[Describe test coverage new/current, TreeHerder]: m-i, m-c soon
[Risks and why]: Low, can only break build.
[String/UUID change made/needed]: None
Attachment #8739971 - Flags: approval-mozilla-aurora?
https://hg.mozilla.org/mozilla-central/rev/116d55d2af93
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla49
Comment on attachment 8739971 [details]
MozReview Request: Bug 1259537 - Unbreak libc++ build after bug 1245076. r?glandium

Fix for build issue, please uplift to aurora
Attachment #8739971 - Flags: approval-mozilla-aurora? → approval-mozilla-aurora+
Product: Core → Firefox Build System
You need to log in before you can comment on or make changes to this bug.