[Mesa-dev] Mesa (master): st/xorg: fix build without LLVM

Patrick Baggett baggett.patrick at gmail.com
Thu Oct 13 13:11:49 PDT 2011


Well, trivial answer is that Win32 uses some C/C++ runtime provided by
Microsoft, usually something like MSVCR90.DLL (v9.0) etc. Solaris uses
libC.so, for example. As far as I know, only systems where the GNU C/C++
compiler is main system compiler (and generally therefore the GNU C++
runtime) uses anything named "libstdc++". So I'd expect Free/Net/OpenBSD +
Linux use that naming and probably not much else. On other commercial
UNIXes, if it does exist, it is just for compatibility with C++ programs
compiled using g++.

Patrick

2011/10/13 Marcin Slusarz <marcin.slusarz at gmail.com>

> On Thu, Oct 13, 2011 at 07:54:32PM +0200, Michel Dänzer wrote:
> > On Don, 2011-10-13 at 10:03 -0700, Marcin XXlusarz wrote:
> > > Module: Mesa
> > > Branch: master
> > > Commit: 349e4db99e938f8ee8826b0d27e490c66a1e8356
> > > URL:
> http://cgit.freedesktop.org/mesa/mesa/commit/?id=349e4db99e938f8ee8826b0d27e490c66a1e8356
> > >
> > > Author: Marcin Slusarz <marcin.slusarz at gmail.com>
> > > Date:   Thu Oct 13 18:44:40 2011 +0200
> > >
> > > st/xorg: fix build without LLVM
> > >
> > > ---
> > >
> > >  src/gallium/targets/Makefile.xorg |    2 ++
> > >  1 files changed, 2 insertions(+), 0 deletions(-)
> > >
> > > diff --git a/src/gallium/targets/Makefile.xorg
> b/src/gallium/targets/Makefile.xorg
> > > index 9269375..c96eded 100644
> > > --- a/src/gallium/targets/Makefile.xorg
> > > +++ b/src/gallium/targets/Makefile.xorg
> > > @@ -33,6 +33,8 @@ LD = $(CXX)
> > >  LDFLAGS += $(LLVM_LDFLAGS)
> > >  USE_CXX=1
> > >  DRIVER_LINKS += $(LLVM_LIBS) -lm -ldl
> > > +else
> > > +LDFLAGS += -lstdc++
> > >  endif
> >
> > This is wrong. Use g++ for linking libstdc++, gcc [...] -lstdc++ doesn't
> > work everywhere.
>
> It wasn't my invention - I mimicked other targets (with partial exception
> of dri).
> Why gcc -lstdc++ doesn't work everywhere?
>
> ---
> From: Marcin Slusarz <marcin.slusarz at gmail.com>
> Subject: [PATCH] gallium/targets: use g++ for linking
>
> As pointed by Michel Dänzer, gcc -lstdc++ "doesn't work everywhere",
> because ...
> Use g++ for linking and remove redundant LDFLAGS += -lstdc++.
> ---
>  src/gallium/targets/Makefile.dri   |    2 --
>  src/gallium/targets/Makefile.va    |    4 +---
>  src/gallium/targets/Makefile.vdpau |    4 +---
>  src/gallium/targets/Makefile.xorg  |    5 +----
>  src/gallium/targets/Makefile.xvmc  |    4 +---
>  5 files changed, 4 insertions(+), 15 deletions(-)
>
> diff --git a/src/gallium/targets/Makefile.dri
> b/src/gallium/targets/Makefile.dri
> index 857ebfe..a26b3ee 100644
> --- a/src/gallium/targets/Makefile.dri
> +++ b/src/gallium/targets/Makefile.dri
> @@ -4,8 +4,6 @@
>  ifeq ($(MESA_LLVM),1)
>  LDFLAGS += $(LLVM_LDFLAGS)
>  DRIVER_EXTRAS = $(LLVM_LIBS)
> -else
> -LDFLAGS += -lstdc++
>  endif
>
>  MESA_MODULES = \
> diff --git a/src/gallium/targets/Makefile.va
> b/src/gallium/targets/Makefile.va
> index 7ced430..b6ee595 100644
> --- a/src/gallium/targets/Makefile.va
> +++ b/src/gallium/targets/Makefile.va
> @@ -17,8 +17,6 @@ STATE_TRACKER_LIB =
> $(TOP)/src/gallium/state_trackers/va/libvatracker.a
>  ifeq ($(MESA_LLVM),1)
>  LDFLAGS += $(LLVM_LDFLAGS)
>  DRIVER_EXTRAS = $(LLVM_LIBS)
> -else
> -LDFLAGS += -lstdc++
>  endif
>
>  # XXX: Hack, VA public funcs aren't exported
> @@ -39,7 +37,7 @@ OBJECTS = $(C_SOURCES:.c=.o) \
>  default: depend symlinks $(TOP)/$(LIB_DIR)/gallium/$(LIBNAME)
>
>  $(TOP)/$(LIB_DIR)/gallium/$(LIBNAME): $(OBJECTS) $(PIPE_DRIVERS)
> $(STATE_TRACKER_LIB) $(TOP)/$(LIB_DIR)/gallium Makefile
> -       $(MKLIB) -o $(LIBBASENAME) -linker '$(CC)' -ldflags '$(LDFLAGS)' \
> +       $(MKLIB) -o $(LIBBASENAME) -linker '$(CXX)' -ldflags '$(LDFLAGS)' \
>                -major $(VA_MAJOR) -minor $(VA_MINOR) $(MKLIB_OPTIONS) \
>                -install $(TOP)/$(LIB_DIR)/gallium \
>                $(OBJECTS) $(STATE_TRACKER_LIB) $(PIPE_DRIVERS) $(LIBS)
> $(DRIVER_EXTRAS)
> diff --git a/src/gallium/targets/Makefile.vdpau
> b/src/gallium/targets/Makefile.vdpau
> index c634915..f6b89ad 100644
> --- a/src/gallium/targets/Makefile.vdpau
> +++ b/src/gallium/targets/Makefile.vdpau
> @@ -17,8 +17,6 @@ STATE_TRACKER_LIB =
> $(TOP)/src/gallium/state_trackers/vdpau/libvdpautracker.a
>  ifeq ($(MESA_LLVM),1)
>  LDFLAGS += $(LLVM_LDFLAGS)
>  DRIVER_EXTRAS = $(LLVM_LIBS)
> -else
> -LDFLAGS += -lstdc++
>  endif
>
>  # XXX: Hack, VDPAU public funcs aren't exported if we link to
> libvdpautracker.a :(
> @@ -39,7 +37,7 @@ OBJECTS = $(C_SOURCES:.c=.o) \
>  default: depend symlinks $(TOP)/$(LIB_DIR)/gallium/$(LIBNAME)
>
>  $(TOP)/$(LIB_DIR)/gallium/$(LIBNAME): $(OBJECTS) $(PIPE_DRIVERS)
> $(STATE_TRACKER_LIB) $(TOP)/$(LIB_DIR)/gallium Makefile
> -       $(MKLIB) -o $(LIBBASENAME) -linker '$(CC)' -ldflags '$(LDFLAGS)' \
> +       $(MKLIB) -o $(LIBBASENAME) -linker '$(CXX)' -ldflags '$(LDFLAGS)' \
>                -major $(VDPAU_MAJOR) -minor $(VDPAU_MINOR) $(MKLIB_OPTIONS)
> \
>                -install $(TOP)/$(LIB_DIR)/gallium \
>                $(OBJECTS) $(STATE_TRACKER_LIB) $(PIPE_DRIVERS) $(LIBS)
> $(DRIVER_EXTRAS)
> diff --git a/src/gallium/targets/Makefile.xorg
> b/src/gallium/targets/Makefile.xorg
> index c96eded..0538b2b 100644
> --- a/src/gallium/targets/Makefile.xorg
> +++ b/src/gallium/targets/Makefile.xorg
> @@ -31,10 +31,7 @@ LIBNAME_STAGING = $(TOP)/$(LIB_DIR)/gallium/$(TARGET)
>  ifeq ($(MESA_LLVM),1)
>  LD = $(CXX)
>  LDFLAGS += $(LLVM_LDFLAGS)
> -USE_CXX=1
>  DRIVER_LINKS += $(LLVM_LIBS) -lm -ldl
> -else
> -LDFLAGS += -lstdc++
>  endif
>
>
> @@ -43,7 +40,7 @@ endif
>  default: depend $(TOP)/$(LIB_DIR)/gallium $(LIBNAME) $(LIBNAME_STAGING)
>
>  $(LIBNAME): $(OBJECTS) Makefile ../Makefile.xorg $(LIBS) $(DRIVER_PIPES)
> $(GALLIUM_AUXILIARIES)
> -       $(MKLIB) -linker '$(CC)' -noprefix -o $@ $(LDFLAGS) $(OBJECTS)
> $(DRIVER_PIPES) $(GALLIUM_AUXILIARIES) $(DRIVER_LINKS)
> +       $(MKLIB) -linker '$(CXX)' -noprefix -o $@ $(LDFLAGS) $(OBJECTS)
> $(DRIVER_PIPES) $(GALLIUM_AUXILIARIES) $(DRIVER_LINKS)
>
>  depend: $(C_SOURCES) $(CPP_SOURCES) $(ASM_SOURCES) $(SYMLINKS)
> $(GENERATED_SOURCES)
>        rm -f depend
> diff --git a/src/gallium/targets/Makefile.xvmc
> b/src/gallium/targets/Makefile.xvmc
> index 7182356..f0c4779 100644
> --- a/src/gallium/targets/Makefile.xvmc
> +++ b/src/gallium/targets/Makefile.xvmc
> @@ -17,8 +17,6 @@ STATE_TRACKER_LIB =
> $(TOP)/src/gallium/state_trackers/xorg/xvmc/libxvmctracker.a
>  ifeq ($(MESA_LLVM),1)
>  LDFLAGS += $(LLVM_LDFLAGS)
>  DRIVER_EXTRAS = $(LLVM_LIBS)
> -else
> -LDFLAGS += -lstdc++
>  endif
>
>
> @@ -40,7 +38,7 @@ OBJECTS = $(C_SOURCES:.c=.o) \
>  default: depend symlinks $(TOP)/$(LIB_DIR)/gallium/$(LIBNAME)
>
>  $(TOP)/$(LIB_DIR)/gallium/$(LIBNAME): $(OBJECTS) $(PIPE_DRIVERS)
> $(STATE_TRACKER_LIB) $(TOP)/$(LIB_DIR)/gallium Makefile
> -       $(MKLIB) -o $(LIBBASENAME) -linker '$(CC)' -ldflags '$(LDFLAGS)' \
> +       $(MKLIB) -o $(LIBBASENAME) -linker '$(CXX)' -ldflags '$(LDFLAGS)' \
>                -major $(XVMC_MAJOR) -minor $(XVMC_MINOR) $(MKLIB_OPTIONS) \
>                -install $(TOP)/$(LIB_DIR)/gallium \
>                $(OBJECTS) $(STATE_TRACKER_LIB) $(PIPE_DRIVERS) $(LIBS)
> $(DRIVER_EXTRAS)
> --
> 1.7.7
>
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20111013/1953050b/attachment.htm>


More information about the mesa-dev mailing list