Skip to content

Commit

Permalink
Bug 732124 - Fix for crt link errors with VC11 - build glue using bot…
Browse files Browse the repository at this point in the history
…h the static and the dynamic runtime lib, and link accordingly for various components. r=ted
  • Loading branch information
jmathies committed May 21, 2012
1 parent b45c6f9 commit 025f496
Show file tree
Hide file tree
Showing 17 changed files with 206 additions and 62 deletions.
4 changes: 1 addition & 3 deletions browser/components/about/Makefile.in
Expand Up @@ -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


EXPORTS_NAMESPACES = mozilla/browser

Expand Down
6 changes: 1 addition & 5 deletions browser/components/build/Makefile.in
Expand Up @@ -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

Expand Down Expand Up @@ -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)

Expand Down
7 changes: 1 addition & 6 deletions browser/components/dirprovider/Makefile.in
Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions browser/components/feeds/src/Makefile.in
Expand Up @@ -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) \
Expand Down
3 changes: 1 addition & 2 deletions browser/components/migration/src/Makefile.in
Expand Up @@ -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 \
Expand Down
4 changes: 1 addition & 3 deletions browser/components/privatebrowsing/src/Makefile.in
Expand Up @@ -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


CPPSRCS = \
nsPrivateBrowsingServiceWrapper.cpp \
Expand Down
4 changes: 1 addition & 3 deletions browser/components/shell/src/Makefile.in
Expand Up @@ -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


ifeq ($(OS_ARCH),WINNT)
CPPSRCS = nsWindowsShellService.cpp
Expand Down
6 changes: 4 additions & 2 deletions config/autoconf.mk.in
Expand Up @@ -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@

Expand Down
14 changes: 14 additions & 0 deletions configure.in
Expand Up @@ -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)'
Expand Down Expand Up @@ -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)

Expand Down
11 changes: 6 additions & 5 deletions intl/unicharutil/tests/Makefile.in
Expand Up @@ -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 \
Expand All @@ -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

Expand Down
2 changes: 1 addition & 1 deletion webapprt/win/Makefile.in
Expand Up @@ -34,7 +34,7 @@ DEFINES += -DXPCOM_GLUE
STL_FLAGS=

LIBS = \
$(XPCOM_STANDALONE_GLUE_LDOPTS) \
$(XPCOM_STANDALONE_STATICRUNTIME_GLUE_LDOPTS) \
$(NULL)

ifndef MOZ_WINCONSOLE
Expand Down
14 changes: 6 additions & 8 deletions xpcom/glue/Makefile.in
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions xpcom/glue/nomozalloc/Makefile.in
Expand Up @@ -17,7 +17,6 @@ MODULE = xpcom
LIBRARY_NAME = xpcomglue_s_nomozalloc
DIST_INSTALL = 1


LOCAL_INCLUDES = \
-I$(srcdir)/../../build \
$(NULL)
Expand All @@ -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.
Expand Down
37 changes: 18 additions & 19 deletions xpcom/glue/standalone/Makefile.in
Expand Up @@ -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))
Expand All @@ -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 =

Expand All @@ -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
Expand Down
89 changes: 89 additions & 0 deletions xpcom/glue/standalone/staticruntime/Makefile.in
@@ -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

0 comments on commit 025f496

Please sign in to comment.