Date: Wed, 5 Sep 2012 12:03:42 GMT From: yamayan <yamayan@kbh.biglobe.ne.jp> To: freebsd-gnats-submit@FreeBSD.org Subject: ports/171343: [patch] build www/firefox and mail/thunderbird with clang Message-ID: <201209051203.q85C3gUZ032299@red.freebsd.org> Resent-Message-ID: <201209051210.q85CA2Hg064443@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 171343 >Category: ports >Synopsis: [patch] build www/firefox and mail/thunderbird with clang >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Wed Sep 05 12:10:02 UTC 2012 >Closed-Date: >Last-Modified: >Originator: yamayan >Release: 10-CURRENT >Organization: >Environment: FreeBSD genius 10.0-CURRENT FreeBSD 10.0-CURRENT #0 r240071M: Mon Sep 3 23:05:03 JST 2012 root@genius:/usr/obj/usr/src/sys/NYANCO amd64 >Description: www/firefox and mail/thunderbird cannot build with clang. REASON: 1.visibility conflict(maybe clang bug?) 2.narrowing check(-Wc++11-narrowing) 3.literal check(-Wreserved-user-defined-literal) >How-To-Repeat: >Fix: 1: always use -fvisibility. force use -fvisibility and remove visibility bug check from configure.in IF CXX is clang (include CLANG_IS_CC) 2&3: add -Wno-c++11-narrowing -Wno-reserved-user-defined-literal to CXXFLAGS misc: add -stdlib=libc++ to CXXFLAGS if not exist Patch attached with submission follows: Index: www/firefox/Makefile =================================================================== --- www/firefox/Makefile (revision 303700) +++ www/firefox/Makefile (working copy) @@ -84,6 +84,14 @@ BUILD_DEPENDS+= yasm:${PORTSDIR}/devel/yasm .endif +CXX_NAME!= ${CXX} --version | ${AWK} 'NR == 1 { gsub(/[()]/, "", $$2); print $$2 }' +.if ${CXX_NAME} == "clang" +.if empty(CXXFLAGS:M-stdlib=libc++) +CXXFLAGS+= -stdlib=libc++ +.endif +CXXFLAGS+= -Wno-c++11-narrowing -Wno-reserved-user-defined-literal +.endif + pre-extract: .if ${PORT_OPTIONS:MPGO} @${ECHO} "*****************************************************************" Index: www/firefox/files/patch-js-src-configure.in =================================================================== --- www/firefox/files/patch-js-src-configure.in (revision 303700) +++ www/firefox/files/patch-js-src-configure.in (working copy) @@ -1,6 +1,67 @@ ---- js/src/configure.in.orig 2012-02-22 17:06:28.000000000 +0100 -+++ js/src/configure.in 2012-03-07 21:03:11.000000000 +0100 -@@ -5946,6 +5946,7 @@ _EGREP_PATTERN="${_EGREP_PATTERN}dummy_n +--- js/src/configure.in.orig 2012-08-31 01:09:30.026090542 +0900 ++++ js/src/configure.in 2012-09-03 23:52:29.575100085 +0900 +@@ -2828,60 +2828,7 @@ + rm -f conftest.[cs] + ]) + if test "$ac_cv_visibility_pragma" = "yes"; then +- AC_CACHE_CHECK(For gcc visibility bug with class-level attributes (GCC bug 26905), +- ac_cv_have_visibility_class_bug, +- [cat > conftest.c <<EOF +-#pragma GCC visibility push(hidden) +-struct __attribute__ ((visibility ("default"))) TestStruct { +- static void Init(); +-}; +-__attribute__ ((visibility ("default"))) void TestFunc() { +- TestStruct::Init(); +-} +-EOF +- ac_cv_have_visibility_class_bug=no +- if ! ${CXX-g++} ${CXXFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -S -o conftest.S conftest.c > /dev/null 2>&1 ; then +- ac_cv_have_visibility_class_bug=yes +- else +- if test `egrep -c '@PLT|\\$stub' conftest.S` = 0; then +- ac_cv_have_visibility_class_bug=yes +- fi +- fi +- rm -rf conftest.{c,S} +- ]) +- +- AC_CACHE_CHECK(For x86_64 gcc visibility bug with builtins (GCC bug 20297), +- ac_cv_have_visibility_builtin_bug, +- [cat > conftest.c <<EOF +-#pragma GCC visibility push(hidden) +-#pragma GCC visibility push(default) +-#include <string.h> +-#pragma GCC visibility pop +- +-__attribute__ ((visibility ("default"))) void Func() { +- char c[[100]]; +- memset(c, 0, sizeof(c)); +-} +-EOF +- ac_cv_have_visibility_builtin_bug=no +- if ! ${CC-cc} ${CFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -O2 -S -o conftest.S conftest.c > /dev/null 2>&1 ; then +- ac_cv_have_visibility_builtin_bug=yes +- else +- if test `grep -c "@PLT" conftest.S` = 0; then +- ac_cv_visibility_builtin_bug=yes +- fi +- fi +- rm -f conftest.{c,S} +- ]) +- if test "$ac_cv_have_visibility_builtin_bug" = "no" -a \ +- "$ac_cv_have_visibility_class_bug" = "no"; then +- VISIBILITY_FLAGS='-I$(DIST)/system_wrappers_js -include $(topsrcdir)/config/gcc_hidden.h' +- WRAP_SYSTEM_INCLUDES=1 +- STL_FLAGS='-I$(DIST)/stl_wrappers' +- WRAP_STL_INCLUDES=1 +- else + VISIBILITY_FLAGS='-fvisibility=hidden' +- fi # have visibility pragma bug + fi # have visibility pragma + fi # have visibility(default) attribute + fi # have visibility(hidden) attribute +@@ -5002,6 +4949,7 @@ * C++ implementations should define these macros only when __STDC_LIMIT_MACROS * is defined before <stdint.h> is included. */ #define __STDC_LIMIT_MACROS Index: www/firefox/files/patch-configure.in =================================================================== --- www/firefox/files/patch-configure.in (revision 303700) +++ www/firefox/files/patch-configure.in (working copy) @@ -1,6 +1,67 @@ ---- configure.in.orig 2012-05-23 20:56:34.000000000 +0200 -+++ configure.in 2012-05-27 18:18:25.000000000 +0200 -@@ -4230,6 +4233,9 @@ +--- configure.in.orig 2012-08-31 01:09:30.037089565 +0900 ++++ configure.in 2012-09-03 23:50:37.248102799 +0900 +@@ -3162,60 +3162,7 @@ + rm -f conftest.[cs] + ]) + if test "$ac_cv_visibility_pragma" = "yes"; then +- AC_CACHE_CHECK(For gcc visibility bug with class-level attributes (GCC bug 26905), +- ac_cv_have_visibility_class_bug, +- [cat > conftest.c <<EOF +-#pragma GCC visibility push(hidden) +-struct __attribute__ ((visibility ("default"))) TestStruct { +- static void Init(); +-}; +-__attribute__ ((visibility ("default"))) void TestFunc() { +- TestStruct::Init(); +-} +-EOF +- ac_cv_have_visibility_class_bug=no +- if ! ${CXX-g++} ${CXXFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -S -o conftest.S conftest.c > /dev/null 2>&1 ; then +- ac_cv_have_visibility_class_bug=yes +- else +- if test `egrep -c '@PLT|\\$stub' conftest.S` = 0; then +- ac_cv_have_visibility_class_bug=yes +- fi +- fi +- rm -rf conftest.{c,S} +- ]) +- +- AC_CACHE_CHECK(For x86_64 gcc visibility bug with builtins (GCC bug 20297), +- ac_cv_have_visibility_builtin_bug, +- [cat > conftest.c <<EOF +-#pragma GCC visibility push(hidden) +-#pragma GCC visibility push(default) +-#include <string.h> +-#pragma GCC visibility pop +- +-__attribute__ ((visibility ("default"))) void Func() { +- char c[[100]]; +- memset(c, 0, sizeof(c)); +-} +-EOF +- ac_cv_have_visibility_builtin_bug=no +- if ! ${CC-cc} ${CFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -O2 -S -o conftest.S conftest.c > /dev/null 2>&1 ; then +- ac_cv_have_visibility_builtin_bug=yes +- else +- if test `grep -c "@PLT" conftest.S` = 0; then +- ac_cv_visibility_builtin_bug=yes +- fi +- fi +- rm -f conftest.{c,S} +- ]) +- if test "$ac_cv_have_visibility_builtin_bug" = "no" -a \ +- "$ac_cv_have_visibility_class_bug" = "no"; then +- VISIBILITY_FLAGS='-I$(DIST)/system_wrappers -include $(topsrcdir)/config/gcc_hidden.h' +- WRAP_SYSTEM_INCLUDES=1 +- STL_FLAGS='-I$(DIST)/stl_wrappers' +- WRAP_STL_INCLUDES=1 +- else + VISIBILITY_FLAGS='-fvisibility=hidden' +- fi # have visibility pragma bug + fi # have visibility pragma + fi # have visibility(default) attribute + fi # have visibility(hidden) attribute +@@ -4228,6 +4175,9 @@ if test -z "$LIBEVENT_DIR" -o "$LIBEVENT_DIR" = no; then MOZ_NATIVE_LIBEVENT= else @@ -10,7 +71,7 @@ if test "${LIBEVENT_DIR}" = "yes"; then LIBEVENT_DIR=/usr fi -@@ -4242,10 +4248,11 @@ else +@@ -4240,10 +4190,11 @@ AC_MSG_ERROR([--with-system-libevent requested but event.h not found])) AC_CHECK_LIB(event, event_init, [MOZ_NATIVE_LIBEVENT=1 Index: mail/thunderbird/Makefile =================================================================== --- mail/thunderbird/Makefile (revision 303700) +++ mail/thunderbird/Makefile (working copy) @@ -87,6 +87,14 @@ MOZ_OPTIONS+= --disable-calendar .endif +CXX_NAME!= ${CXX} --version | ${AWK} 'NR == 1 { gsub(/[()]/, "", $$2); print $$2 }' +.if ${CXX_NAME} == "clang" +.if empty(CXXFLAGS:M-stdlib=libc++) +CXXFLAGS+= -stdlib=libc++ +.endif +CXXFLAGS+= -Wno-c++11-narrowing -Wno-reserved-user-defined-literal +.endif + post-extract: @${SED} -e 's|@PORTNAME_ICON@|${PORTNAME_ICON}|;s|@MOZILLA@|${MOZILLA}|' \ <${FILESDIR}/thunderbird.desktop.in >${WRKDIR}/${MOZILLA_EXEC_NAME}.desktop Index: mail/thunderbird/files/patch-mozilla-configure.in =================================================================== --- mail/thunderbird/files/patch-mozilla-configure.in (revision 303700) +++ mail/thunderbird/files/patch-mozilla-configure.in (working copy) @@ -1,6 +1,67 @@ ---- mozilla/configure.in.orig 2012-05-23 20:56:34.000000000 +0200 -+++ mozilla/configure.in 2012-05-27 18:18:25.000000000 +0200 -@@ -4230,6 +4233,9 @@ +--- mozilla/configure.in.orig 2012-09-04 00:06:04.516101036 +0900 ++++ mozilla/configure.in 2012-09-04 00:09:58.814098477 +0900 +@@ -3162,60 +3162,7 @@ + rm -f conftest.[cs] + ]) + if test "$ac_cv_visibility_pragma" = "yes"; then +- AC_CACHE_CHECK(For gcc visibility bug with class-level attributes (GCC bug 26905), +- ac_cv_have_visibility_class_bug, +- [cat > conftest.c <<EOF +-#pragma GCC visibility push(hidden) +-struct __attribute__ ((visibility ("default"))) TestStruct { +- static void Init(); +-}; +-__attribute__ ((visibility ("default"))) void TestFunc() { +- TestStruct::Init(); +-} +-EOF +- ac_cv_have_visibility_class_bug=no +- if ! ${CXX-g++} ${CXXFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -S -o conftest.S conftest.c > /dev/null 2>&1 ; then +- ac_cv_have_visibility_class_bug=yes +- else +- if test `egrep -c '@PLT|\\$stub' conftest.S` = 0; then +- ac_cv_have_visibility_class_bug=yes +- fi +- fi +- rm -rf conftest.{c,S} +- ]) +- +- AC_CACHE_CHECK(For x86_64 gcc visibility bug with builtins (GCC bug 20297), +- ac_cv_have_visibility_builtin_bug, +- [cat > conftest.c <<EOF +-#pragma GCC visibility push(hidden) +-#pragma GCC visibility push(default) +-#include <string.h> +-#pragma GCC visibility pop +- +-__attribute__ ((visibility ("default"))) void Func() { +- char c[[100]]; +- memset(c, 0, sizeof(c)); +-} +-EOF +- ac_cv_have_visibility_builtin_bug=no +- if ! ${CC-cc} ${CFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -O2 -S -o conftest.S conftest.c > /dev/null 2>&1 ; then +- ac_cv_have_visibility_builtin_bug=yes +- else +- if test `grep -c "@PLT" conftest.S` = 0; then +- ac_cv_visibility_builtin_bug=yes +- fi +- fi +- rm -f conftest.{c,S} +- ]) +- if test "$ac_cv_have_visibility_builtin_bug" = "no" -a \ +- "$ac_cv_have_visibility_class_bug" = "no"; then +- VISIBILITY_FLAGS='-I$(DIST)/system_wrappers -include $(topsrcdir)/config/gcc_hidden.h' +- WRAP_SYSTEM_INCLUDES=1 +- STL_FLAGS='-I$(DIST)/stl_wrappers' +- WRAP_STL_INCLUDES=1 +- else + VISIBILITY_FLAGS='-fvisibility=hidden' +- fi # have visibility pragma bug + fi # have visibility pragma + fi # have visibility(default) attribute + fi # have visibility(hidden) attribute +@@ -4228,6 +4175,9 @@ if test -z "$LIBEVENT_DIR" -o "$LIBEVENT_DIR" = no; then MOZ_NATIVE_LIBEVENT= else @@ -10,7 +71,7 @@ if test "${LIBEVENT_DIR}" = "yes"; then LIBEVENT_DIR=/usr fi -@@ -4242,10 +4248,11 @@ else +@@ -4240,10 +4190,11 @@ AC_MSG_ERROR([--with-system-libevent requested but event.h not found])) AC_CHECK_LIB(event, event_init, [MOZ_NATIVE_LIBEVENT=1 Index: mail/thunderbird/files/patch-configure.in =================================================================== --- mail/thunderbird/files/patch-configure.in (revision 303700) +++ mail/thunderbird/files/patch-configure.in (working copy) @@ -1,49 +1,61 @@ ---- configure.in.orig 2012-07-14 00:40:08.000000000 +0200 -+++ configure.in 2012-08-18 18:16:06.000000000 +0200 -@@ -3101,6 +3118,8 @@ - - AC_SUBST(VISIBILITY_FLAGS) - -+MOZ_COMPILER_OPTS -+ - dnl Checks for header files. - dnl ======================================================== - AC_HEADER_DIRENT -@@ -4067,29 +4086,29 @@ - - AC_CACHE_CHECK(for __attribute__((always_inline)), - ac_cv_attribute_always_inline, -- [AC_TRY_COMPILE([], -- [inline void f(void) __attribute__((always_inline));], -+ [AC_TRY_COMPILE([inline void f(void) __attribute__((always_inline));], -+ [], - ac_cv_attribute_always_inline=yes, - ac_cv_attribute_always_inline=no)]) - - AC_CACHE_CHECK(for __attribute__((malloc)), - ac_cv_attribute_malloc, -- [AC_TRY_COMPILE([], -- [void* f(int) __attribute__((malloc));], -+ [AC_TRY_COMPILE([void* f(int) __attribute__((malloc));], -+ [], - ac_cv_attribute_malloc=yes, - ac_cv_attribute_malloc=no)]) - - AC_CACHE_CHECK(for __attribute__((warn_unused_result)), - ac_cv_attribute_warn_unused, -- [AC_TRY_COMPILE([], -- [int f(void) __attribute__((warn_unused_result));], -+ [AC_TRY_COMPILE([int f(void) __attribute__((warn_unused_result));], -+ [], - ac_cv_attribute_warn_unused=yes, - ac_cv_attribute_warn_unused=no)]) - - AC_CACHE_CHECK(for __attribute__((noreturn)), - ac_cv_attribute_noreturn, -- [AC_TRY_COMPILE([], -- [void f(void) __attribute__((noreturn));], -+ [AC_TRY_COMPILE([void f(void) __attribute__((noreturn));], -+ [], - ac_cv_attribute_noreturn=yes, - ac_cv_attribute_noreturn=no)]) - +--- configure.in.orig 2012-09-03 23:57:30.597100577 +0900 ++++ configure.in 2012-09-03 23:58:33.004101257 +0900 +@@ -3037,58 +3037,7 @@ + rm -f conftest.[cs] + ]) + if test "$ac_cv_visibility_pragma" = "yes"; then +- AC_CACHE_CHECK(For gcc visibility bug with class-level attributes (GCC bug 26905), +- ac_cv_have_visibility_class_bug, +- [cat > conftest.c <<EOF +-#pragma GCC visibility push(hidden) +-struct __attribute__ ((visibility ("default"))) TestStruct { +- static void Init(); +-}; +-__attribute__ ((visibility ("default"))) void TestFunc() { +- TestStruct::Init(); +-} +-EOF +- ac_cv_have_visibility_class_bug=no +- if ! ${CXX-g++} ${CXXFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -S -o conftest.S conftest.c > /dev/null 2>&1 ; then +- ac_cv_have_visibility_class_bug=yes +- else +- if test `egrep -c '@PLT|\\$stub' conftest.S` = 0; then +- ac_cv_have_visibility_class_bug=yes +- fi +- fi +- rm -rf conftest.{c,S} +- ]) +- +- AC_CACHE_CHECK(For x86_64 gcc visibility bug with builtins (GCC bug 20297), +- ac_cv_have_visibility_builtin_bug, +- [cat > conftest.c <<EOF +-#pragma GCC visibility push(hidden) +-#pragma GCC visibility push(default) +-#include <string.h> +-#pragma GCC visibility pop +- +-__attribute__ ((visibility ("default"))) void Func() { +- char c[[100]]; +- memset(c, 0, sizeof(c)); +-} +-EOF +- ac_cv_have_visibility_builtin_bug=no +- if ! ${CC-cc} ${CFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -O2 -S -o conftest.S conftest.c > /dev/null 2>&1 ; then +- ac_cv_have_visibility_builtin_bug=yes +- else +- if test `grep -c "@PLT" conftest.S` = 0; then +- ac_cv_visibility_builtin_bug=yes +- fi +- fi +- rm -f conftest.{c,S} +- ]) +- if test "$ac_cv_have_visibility_builtin_bug" = "no" -a \ +- "$ac_cv_have_visibility_class_bug" = "no"; then +- VISIBILITY_FLAGS='-I$(DIST)/system_wrappers -include $(MOZILLA_SRCDIR)/config/gcc_hidden.h' +- STL_FLAGS='-I$(DIST)/stl_wrappers' +- else + VISIBILITY_FLAGS='-fvisibility=hidden' +- fi # have visibility pragma bug + fi # have visibility pragma + fi # have visibility(default) attribute + fi # have visibility(hidden) attribute Index: mail/thunderbird/files/patch-mozilla-js-src-configure.in =================================================================== --- mail/thunderbird/files/patch-mozilla-js-src-configure.in (revision 303700) +++ mail/thunderbird/files/patch-mozilla-js-src-configure.in (working copy) @@ -1,6 +1,67 @@ ---- mozilla/js/src/configure.in.orig 2012-02-22 17:06:28.000000000 +0100 -+++ mozilla/js/src/configure.in 2012-03-07 21:03:11.000000000 +0100 -@@ -5946,6 +5946,7 @@ _EGREP_PATTERN="${_EGREP_PATTERN}dummy_n +--- mozilla/js/src/configure.in.orig 2012-09-04 00:06:04.501102901 +0900 ++++ mozilla/js/src/configure.in 2012-09-04 00:11:00.124099818 +0900 +@@ -2828,60 +2828,7 @@ + rm -f conftest.[cs] + ]) + if test "$ac_cv_visibility_pragma" = "yes"; then +- AC_CACHE_CHECK(For gcc visibility bug with class-level attributes (GCC bug 26905), +- ac_cv_have_visibility_class_bug, +- [cat > conftest.c <<EOF +-#pragma GCC visibility push(hidden) +-struct __attribute__ ((visibility ("default"))) TestStruct { +- static void Init(); +-}; +-__attribute__ ((visibility ("default"))) void TestFunc() { +- TestStruct::Init(); +-} +-EOF +- ac_cv_have_visibility_class_bug=no +- if ! ${CXX-g++} ${CXXFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -S -o conftest.S conftest.c > /dev/null 2>&1 ; then +- ac_cv_have_visibility_class_bug=yes +- else +- if test `egrep -c '@PLT|\\$stub' conftest.S` = 0; then +- ac_cv_have_visibility_class_bug=yes +- fi +- fi +- rm -rf conftest.{c,S} +- ]) +- +- AC_CACHE_CHECK(For x86_64 gcc visibility bug with builtins (GCC bug 20297), +- ac_cv_have_visibility_builtin_bug, +- [cat > conftest.c <<EOF +-#pragma GCC visibility push(hidden) +-#pragma GCC visibility push(default) +-#include <string.h> +-#pragma GCC visibility pop +- +-__attribute__ ((visibility ("default"))) void Func() { +- char c[[100]]; +- memset(c, 0, sizeof(c)); +-} +-EOF +- ac_cv_have_visibility_builtin_bug=no +- if ! ${CC-cc} ${CFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -O2 -S -o conftest.S conftest.c > /dev/null 2>&1 ; then +- ac_cv_have_visibility_builtin_bug=yes +- else +- if test `grep -c "@PLT" conftest.S` = 0; then +- ac_cv_visibility_builtin_bug=yes +- fi +- fi +- rm -f conftest.{c,S} +- ]) +- if test "$ac_cv_have_visibility_builtin_bug" = "no" -a \ +- "$ac_cv_have_visibility_class_bug" = "no"; then +- VISIBILITY_FLAGS='-I$(DIST)/system_wrappers_js -include $(topsrcdir)/config/gcc_hidden.h' +- WRAP_SYSTEM_INCLUDES=1 +- STL_FLAGS='-I$(DIST)/stl_wrappers' +- WRAP_STL_INCLUDES=1 +- else + VISIBILITY_FLAGS='-fvisibility=hidden' +- fi # have visibility pragma bug + fi # have visibility pragma + fi # have visibility(default) attribute + fi # have visibility(hidden) attribute +@@ -5002,6 +4949,7 @@ * C++ implementations should define these macros only when __STDC_LIMIT_MACROS * is defined before <stdint.h> is included. */ #define __STDC_LIMIT_MACROS >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201209051203.q85C3gUZ032299>