Bug 732124 - Fix for crt link errors with VC11 - build glue using both the static and the dynamic runtime lib, and link accordingly for various components. r=ted

This commit is contained in:
Jim Mathies 2012-05-21 16:31:03 -05:00
parent 8fdf9ac6a9
commit f4bf6429ef
17 changed files with 209 additions and 65 deletions

View File

@ -11,11 +11,9 @@ include $(DEPTH)/config/autoconf.mk
MODULE = browserabout
LIBRARY_NAME = browserabout_s
FORCE_STATIC_LIB = 1
ifndef MOZ_MEMORY
USE_STATIC_LIBS = 1
endif
FORCE_STATIC_LIB = 1
USE_STATIC_LIBS = 1
EXPORTS_NAMESPACES = mozilla/browser

View File

@ -16,11 +16,7 @@ IS_COMPONENT = 1
MODULE_NAME = nsBrowserCompsModule
FORCE_SHARED_LIB = 1
# Statically link the CRT on Windows if building against
# a XULRunner SDK.
ifdef LIBXUL_SDK
USE_STATIC_LIBS = 1
endif
EXPORTS = nsBrowserCompsCID.h
@ -56,7 +52,7 @@ endif
EXTRA_DSO_LDOPTS += \
$(call EXPAND_LIBNAME_PATH,unicharutil_external_s,$(LIBXUL_DIST)/lib) \
$(XPCOM_GLUE_LDOPTS) \
$(XPCOM_STATICRUNTIME_GLUE_LDOPTS) \
$(MOZ_COMPONENT_LIBS) \
$(NULL)

View File

@ -15,12 +15,7 @@ LIBRARY_NAME = browserdir_s
TEST_DIRS += tests
FORCE_STATIC_LIB = 1
# Because we are an application component, link against the CRT statically
# (on Windows, but only if we're not building our own CRT for jemalloc)
ifndef MOZ_MEMORY
USE_STATIC_LIBS = 1
endif
USE_STATIC_LIBS = 1
EXPORTS_NAMESPACES = mozilla/browser
EXPORTS_mozilla/browser = DirectoryProvider.h

View File

@ -11,10 +11,9 @@ include $(DEPTH)/config/autoconf.mk
MODULE = browser_feeds
LIBRARY_NAME = browser_feeds_s
FORCE_STATIC_LIB = 1
ifndef MOZ_MEMORY
USE_STATIC_LIBS = 1
endif
DEFINES += \
-DMOZ_APP_NAME=$(MOZ_APP_NAME) \

View File

@ -11,10 +11,9 @@ include $(DEPTH)/config/autoconf.mk
MODULE = migration
LIBRARY_NAME = migration_s
FORCE_STATIC_LIB = 1
ifndef MOZ_MEMORY
USE_STATIC_LIBS = 1
endif
EXTRA_PP_COMPONENTS = \
ProfileMigrator.js \

View File

@ -11,11 +11,9 @@ include $(DEPTH)/config/autoconf.mk
MODULE = privatebrowsing
LIBRARY_NAME = privatebrowsing_s
FORCE_STATIC_LIB = 1
ifndef MOZ_MEMORY
USE_STATIC_LIBS = 1
endif
FORCE_STATIC_LIB = 1
USE_STATIC_LIBS = 1
CPPSRCS = \
nsPrivateBrowsingServiceWrapper.cpp \

View File

@ -11,11 +11,9 @@ VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
MODULE = shellservice
FORCE_STATIC_LIB = 1
ifndef MOZ_MEMORY
USE_STATIC_LIBS = 1
endif
FORCE_STATIC_LIB = 1
USE_STATIC_LIBS = 1
ifeq ($(OS_ARCH),WINNT)
CPPSRCS = nsWindowsShellService.cpp

View File

@ -477,8 +477,10 @@ NSS_LIBS = @NSS_LIBS@
NSS_DEP_LIBS = @NSS_DEP_LIBS@
NSS_DISABLE_DBM = @NSS_DISABLE_DBM@
XPCOM_GLUE_LDOPTS = @XPCOM_GLUE_LDOPTS@
XPCOM_STANDALONE_GLUE_LDOPTS = @XPCOM_STANDALONE_GLUE_LDOPTS@
XPCOM_GLUE_LDOPTS = @XPCOM_GLUE_LDOPTS@
XPCOM_STANDALONE_GLUE_LDOPTS = @XPCOM_STANDALONE_GLUE_LDOPTS@
XPCOM_STATICRUNTIME_GLUE_LDOPTS = @XPCOM_STATICRUNTIME_GLUE_LDOPTS@
XPCOM_STANDALONE_STATICRUNTIME_GLUE_LDOPTS = @XPCOM_STANDALONE_STATICRUNTIME_GLUE_LDOPTS@
USE_DEPENDENT_LIBS = @USE_DEPENDENT_LIBS@

View File

@ -1308,6 +1308,18 @@ LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS) -lxul'
XPCOM_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue_s.$(LIB_SUFFIX) $(XPCOM_FROZEN_LDOPTS)'
XPCOM_STANDALONE_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue.$(LIB_SUFFIX)'
# These are specially defined on Windows only
case "$target" in
*-mingw*)
XPCOM_STATICRUNTIME_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue_staticruntime_s.$(LIB_SUFFIX) $(XPCOM_FROZEN_LDOPTS)'
XPCOM_STANDALONE_STATICRUNTIME_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue_staticruntime.$(LIB_SUFFIX)'
;;
*)
XPCOM_STATICRUNTIME_GLUE_LDOPTS=$XPCOM_GLUE_LDOPTS
XPCOM_STANDALONE_STATICRUNTIME_GLUE_LDOPTS=$XPCOM_STANDALONE_GLUE_LDOPTS
;;
esac
MOZ_FS_LAYOUT=unix
MOZ_COMPONENT_NSPR_LIBS='-L$(LIBXUL_DIST)/bin $(NSPR_LIBS)'
@ -8423,6 +8435,8 @@ AC_SUBST(XPCOM_LIBS)
AC_SUBST(XPCOM_FROZEN_LDOPTS)
AC_SUBST(XPCOM_GLUE_LDOPTS)
AC_SUBST(XPCOM_STANDALONE_GLUE_LDOPTS)
AC_SUBST(XPCOM_STATICRUNTIME_GLUE_LDOPTS)
AC_SUBST(XPCOM_STANDALONE_STATICRUNTIME_GLUE_LDOPTS)
AC_SUBST(USE_DEPENDENT_LIBS)

View File

@ -14,6 +14,7 @@ include $(DEPTH)/config/autoconf.mk
MODULE = test_intl_unicharutil
XPCSHELL_TESTS = unit
USE_STATIC_LIBS = 1
CPPSRCS = UnicharSelfTest.cpp \
NormalizationTest.cpp \
@ -22,11 +23,11 @@ CPPSRCS = UnicharSelfTest.cpp \
SIMPLE_PROGRAMS = $(CPPSRCS:.cpp=$(BIN_SUFFIX))
LIBS = \
$(DIST)/lib/$(LIB_PREFIX)xpcomglue_s.$(LIB_SUFFIX) \
$(DIST)/lib/$(LIB_PREFIX)unicharutil_external_s.$(LIB_SUFFIX) \
$(XPCOM_LIBS) \
$(NSPR_LIBS) \
$(NULL)
$(XPCOM_STATICRUNTIME_GLUE_LDOPTS) \
$(DIST)/lib/$(LIB_PREFIX)unicharutil_external_s.$(LIB_SUFFIX) \
$(XPCOM_LIBS) \
$(NSPR_LIBS) \
$(NULL)
include $(topsrcdir)/config/rules.mk

View File

@ -34,7 +34,7 @@ DEFINES += -DXPCOM_GLUE
STL_FLAGS=
LIBS = \
$(XPCOM_STANDALONE_GLUE_LDOPTS) \
$(XPCOM_STANDALONE_STATICRUNTIME_GLUE_LDOPTS) \
$(NULL)
ifndef MOZ_WINCONSOLE

View File

@ -15,6 +15,12 @@ EXTRA_DEPS += $(srcdir)/objs.mk
DIRS = standalone nomozalloc
# On win we build two glue libs - glue linked to crt dlls here and in staticruntime we build
# a statically linked glue lib.
ifeq ($(OS_ARCH),WINNT)
DIRS += staticruntime
endif
MODULE = xpcom
LIBRARY_NAME = xpcomglue_s
DIST_INSTALL = 1
@ -109,16 +115,8 @@ SDK_LIBRARY = \
$(LIB_PREFIX)xpcomglue_s.$(LIB_SUFFIX) \
$(NULL)
# we don't want the shared lib, but we want to force the creation of a static lib.
FORCE_STATIC_LIB = 1
# Pretend we're statically linking the CRT, even though we might not be: this
# avoids "msvcrp" and assembly dependencies from creeping into the directives
# for this library on Windows.
USE_STATIC_LIBS = 1
include $(topsrcdir)/config/rules.mk
ifdef _MSC_VER

View File

@ -17,7 +17,6 @@ MODULE = xpcom
LIBRARY_NAME = xpcomglue_s_nomozalloc
DIST_INSTALL = 1
LOCAL_INCLUDES = \
-I$(srcdir)/../../build \
$(NULL)
@ -38,7 +37,6 @@ GARBAGE += $(CPPSRCS) DeadlockDetector.h SSE.h arm.h
# we don't want the shared lib, but we want to force the creation of a static lib.
FORCE_STATIC_LIB = 1
# Pretend we're statically linking the CRT, even though we might not be: this
# avoids "msvcrp" and assembly dependencies from creeping into the directives
# for this library on Windows.

View File

@ -13,13 +13,19 @@ include $(srcdir)/../objs.mk
EXTRA_DEPS += $(srcdir)/../objs.mk
# On win we build two glue libs - glue linked to crt dlls here and in staticruntime we build
# a statically linked glue lib.
ifeq ($(OS_ARCH),WINNT)
DIRS += staticruntime
endif
MODULE = xpcom
LIBRARY_NAME = xpcomglue
DIST_INSTALL = 1
LOCAL_INCLUDES = \
-I$(srcdir)/../../build \
$(NULL)
-I$(srcdir)/../../build \
$(NULL)
ifeq (Darwin,$(OS_ARCH))
ifeq (uikit,$(MOZ_WIDGET_TOOLKIT))
@ -45,29 +51,22 @@ $(warning TinderboxPrint:<a href="https://bugzilla.mozilla.org/show_bug.cgi?id=2
endif
CPPSRCS = \
$(XPCOM_GLUE_SRC_LCPPSRCS) \
nsStringAPI.cpp \
nsXPCOMGlue.cpp \
$(LINKSRC) \
$(NULL)
$(XPCOM_GLUE_SRC_LCPPSRCS) \
nsStringAPI.cpp \
nsXPCOMGlue.cpp \
$(LINKSRC) \
$(NULL)
SDK_HEADERS = \
nsXPCOMGlue.h \
$(NULL)
nsXPCOMGlue.h \
$(NULL)
SDK_LIBRARY = \
$(LIB_PREFIX)xpcomglue.$(LIB_SUFFIX) \
$(NULL)
$(LIB_PREFIX)xpcomglue.$(LIB_SUFFIX) \
$(NULL)
# we don't want the shared lib, but we want to force the creation of a static lib.
FORCE_STATIC_LIB = 1
# Pretend we're statically linking the CRT, even though we might not be: this
# avoids "msvcrp" and assembly dependencies from creeping into the directives
# for this library on Windows.
USE_STATIC_LIBS = 1
# Don't use STL wrappers here (i.e. wrapped <new>); they require mozalloc
STL_FLAGS =
@ -78,7 +77,7 @@ SRCS_IN_OBJDIR = 1
include $(topsrcdir)/config/rules.mk
ifdef _MSC_VER
# Don't include directives about which CRT to use
# Don't include directives in obj files about which CRT to use
OS_COMPILE_CXXFLAGS += -Zl
OS_COMPILE_CFLAGS += -Zl
DEFINES += -D_USE_ANSI_CPP

View File

@ -0,0 +1,89 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.
DEPTH = ../../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
include $(srcdir)/../../objs.mk
EXTRA_DEPS += $(srcdir)/../../objs.mk
MODULE = xpcom
LIBRARY_NAME = xpcomglue_staticruntime
DIST_INSTALL = 1
LOCAL_INCLUDES = \
-I$(srcdir)/../../../build \
$(NULL)
ifeq (Darwin,$(OS_ARCH))
ifeq (uikit,$(MOZ_WIDGET_TOOLKIT))
LINKSRC = nsGlueLinkingDlopen.cpp
else
LINKSRC = nsGlueLinkingOSX.cpp
endif
endif
ifeq ($(OS_ARCH),WINNT)
LINKSRC = nsGlueLinkingWin.cpp
endif
ifneq (,$(filter AIX DragonFly FreeBSD GNU GNU_% Linux NetBSD OpenBSD SunOS,$(OS_ARCH)))
LINKSRC = nsGlueLinkingDlopen.cpp
endif
ifeq (OS2,$(OS_ARCH))
LINKSRC = nsGlueLinkingOS2.cpp
endif
ifndef LINKSRC
LINKSRC = nsGlueLinkingNull.cpp
$(warning TinderboxPrint:<a href="https://bugzilla.mozilla.org/show_bug.cgi?id=298044">Error: XPCOM Glue</a>)
endif
CPPSRCS = \
$(XPCOM_GLUE_SRC_LCPPSRCS) \
nsXPCOMGlue.cpp \
nsStringAPI.cpp \
$(LINKSRC) \
$(NULL)
SDK_LIBRARY = \
$(LIB_PREFIX)xpcomglue_staticruntime.$(LIB_SUFFIX) \
$(NULL)
# create a static lib
FORCE_STATIC_LIB = 1
# Statically link to the CRT on Windows
USE_STATIC_LIBS = 1
# Don't use STL wrappers here (i.e. wrapped <new>); they require mozalloc
STL_FLAGS =
GARBAGE += $(XPCOM_GLUE_SRC_LCPPSRCS) $(wildcard *.$(OBJ_SUFFIX))
SRCS_IN_OBJDIR = 1
include $(topsrcdir)/config/rules.mk
ifdef _MSC_VER
# Don't include directives in obj files about which CRT to use
OS_COMPILE_CXXFLAGS += -Zl
OS_COMPILE_CFLAGS += -Zl
DEFINES += -D_USE_ANSI_CPP
endif
export:: $(XPCOM_GLUE_SRC_CPPSRCS) $(topsrcdir)/xpcom/glue/nsStringAPI.cpp ../nsXPCOMGlue.cpp ../nsGlueLinking.h ../$(LINKSRC)
$(INSTALL) $^ .
GARBAGE += nsStringAPI.cpp nsXPCOMGlue.cpp nsGlueLinking.h $(LINKSRC)
DEFINES += -DXPCOM_GLUE
ifdef TARGET_XPCOM_ABI
DEFINES += -DTARGET_XPCOM_ABI=\"$(TARGET_XPCOM_ABI)\"
endif

View File

@ -0,0 +1,60 @@
# vim:set ts=8 sw=8 sts=8 noet:
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
DEPTH = ../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
include $(srcdir)/../objs.mk
EXTRA_DEPS += $(srcdir)/../objs.mk
MODULE = xpcom
LIBRARY_NAME = xpcomglue_staticruntime_s
DIST_INSTALL = 1
LOCAL_INCLUDES = \
-I$(srcdir)/../../build \
$(NULL)
CPPSRCS = \
$(XPCOM_GLUE_SRC_LCPPSRCS) \
$(XPCOM_GLUENS_SRC_LCPPSRCS) \
nsStringAPI.cpp \
GenericModule.cpp \
$(NULL)
SDK_LIBRARY = \
$(LIB_PREFIX)xpcomglue_staticruntime_s.$(LIB_SUFFIX) \
$(NULL)
GARBAGE += $(XPCOM_GLUE_SRC_LCPPSRCS) $(wildcard *.$(OBJ_SUFFIX))
FORCE_STATIC_LIB = 1
# Statically link to the CRT on Windows
USE_STATIC_LIBS = 1
# Don't use STL wrappers here (i.e. wrapped <new>); they require mozalloc
STL_FLAGS =
include $(topsrcdir)/config/rules.mk
ifdef _MSC_VER
# Don't include directives about which CRT to use
OS_COMPILE_CXXFLAGS += -Zl
OS_COMPILE_CFLAGS += -Zl
DEFINES += -D_USE_ANSI_CPP
endif
export:: $(XPCOM_GLUE_SRC_CPPSRCS) $(XPCOM_GLUENS_SRC_CPPSRCS) $(topsrcdir)/xpcom/glue/nsStringAPI.cpp $(topsrcdir)/xpcom/glue/GenericModule.cpp $(topsrcdir)/xpcom/glue/DeadlockDetector.h $(topsrcdir)/xpcom/glue/SSE.h $(topsrcdir)/xpcom/glue/arm.h
$(INSTALL) $^ .
ifdef TARGET_XPCOM_ABI
DEFINES += -DTARGET_XPCOM_ABI=\"$(TARGET_XPCOM_ABI)\"
endif

View File

@ -33,7 +33,7 @@ DEFINES += -DXPCOM_GLUE
STL_FLAGS=
LIBS = \
$(XPCOM_STANDALONE_GLUE_LDOPTS) \
$(XPCOM_STANDALONE_STATICRUNTIME_GLUE_LDOPTS) \
$(NULL)
# Need to link with CoreFoundation on Mac