[Coin-discuss] Shared Libraries and Mac OS X Tiger

kmartin kmartin at gsb.uchicago.edu
Fri Jun 10 02:17:23 EDT 2005


Hi All:

I recently switched to the Mac OS X Tiger operating system and decided
to build the COIN lib.  No problem with the static lib using makefiles
that are on the CVS server. However, the Darwin makefile on the CVS
server does not allow shared libraries. If you wish to build a COIN
shared library maybe the following will save you some time.

After some experimenting I found you can successfully generate a COIN
shared library from the object files by using:

gcc   -dynamiclib   -o libCoin-O1.dylib *.o  -lstdc++


OR

g++-4.0 -dynamiclib -o libCoin-O1.dylib *.o

If you want to use the Darwin makefile on the CVS server change the
following


###############################################################################

ifeq (${LibType},SHARED)
  $(warning "Shared libs are not (yet!) supported on Darwin.")
  LibType := STATIC
endif

SHARED_LIBEXT := .so
STATIC_LIBEXT := .a

ifeq (${LibType},SHARED)
  LD  := g++ -o
  LIBLDFLAGS := -shared
  LIBEXT := $(SHARED_LIBEXT)
  CXXFLAGS += -fPIC
else
  LD  := libtool -static -s -o
  LIBLDFLAGS :=
  LIBEXT := $(STATIC_LIBEXT)
  CXXFLAGS +=
endif

###############################################################################

to be:
###############################################################################

ifeq (${LibType},SHARED)
  $(warning "Shared libs are now supported on Darwin.")
  LibType := SHARED
endif

SHARED_LIBEXT := .dylib
STATIC_LIBEXT := .a

ifeq (${LibType},SHARED)
  LD  := g++ -o
  LIBLDFLAGS := -dynamiclib
  LIBEXT := $(SHARED_LIBEXT)
  CXXFLAGS += -fPIC
else
  LD  := libtool -static -s -o
  LIBLDFLAGS :=
  LIBEXT := $(STATIC_LIBEXT)
  CXXFLAGS +=
endif
###############################################################################

Finally, on the Mac, the library path environment variable is
DYLD_LIBRARY_PATH not the standard LD_LIBRARY_PATH.

Sorry if this information was already posted.

Regards,
-- 
Kipp Martin
Professor of Operations Research
	and Computing Technology
University of Chicago
Graduate School of Business
5807 South Woodlawn Avenue
Chicago IL 60637
773-702-7456




More information about the Coin-discuss mailing list