[plt-scheme] extensions that use libraries with libc (cygwin)

From: Ron Stanonik (stanonik at Cogsci.ucsd.edu)
Date: Wed Dec 31 12:17:36 EST 2003

On Wed, 31 Dec 2003, Matthew Flatt wrote:

>   For list-related administrative tasks:
>   http://list.cs.brown.edu/mailman/listinfo/plt-scheme
> 
> At Sat, 20 Dec 2003 05:30:32 -0500 (EST), "David A. Herman" wrote:
> > I'm trying to compile an extension with mzc under cygwin that requires an
> > external library and haven't had much luck.
> 
> Unfortunately, neither have I. Back in October, I couldn't get an
> extension to run with Cygwin's C library. I think I got something to
> link, but I crashed.
> 
> Here's the old thread, but I doubt that it has anything useful:
> 
>  http://list.cs.brown.edu/pipermail/plt-scheme/2003-October/003714.html

That was me.  Our extension is running in cygwin again.  I now explicitly
link with libmzsch205_00N.lib, where N is the current revision.  Wish I
understood why.  I tried compiling and linking with mzc --cc and --ld,
figuring that would be the most portable method, but I failed.  So,
I just use g++.  I'm appending the makefile.  Wish I had a simpler example
for you.  Our C/C++ code creates libpad.a, which we link with several
external libraries.  (Now that we're using libMagick to load images,
we should be able to drop the libjpeg, libtiff, and libpnm.)

Ron
stanonik at cogsci.ucsd.edu

ARCH = bin-i686-CYGWIN
OS = CYGWIN
LIBPAD = pad/$(ARCH)/libpad.a
X11LIB = -L/usr/local/lib -L/usr/X11R6/lib
X11INCLUDE = -I/usr/local/include -I/usr/X11R6/include
FT2INCLUDE = -I/usr/include/freetype2
CC = gcc
PLT=/home/plt
ifeq "$(OS)" "CYGWIN"
    CPPFLAGS=-g -I$(PLT)/include -Ipad/generic $(X11INCLUDE) $(FT2INCLUDE)  -DCYGWIN
    LDFLAGS=$(PLT)/lib/gcc/mzdyn.o $(PLT)/lib/gcc/libmzsch205_007.lib 
else
    CPPFLAGS=-g -I$(PLT)/include -Ipad/generic $(X11INCLUDE) $(FT2INCLUDE) 
    LDFLAGS=$(PLT)/lib/mzdyn.o 
endif
SHARED=-shared -Wl,-Bsymbolic,--warn-once
PNM=
TIFF=-ltiff

dynapad.so: dynapad.o tclSchemeNotify.o builtin.o $(LIBPAD)
	g++ -g $(SHARED) -o dynapad.so dynapad.o \
		tclSchemeNotify.o \
		builtin.o \
		$(LDFLAGS) \
		$(LIBPAD) -ljpeg \
		$(PNM) \
		$(TIFF) \
		$(X11LIB) -lXext -lX11 -lXft -lfontconfig\
		-ltcl -lm -lstdc++ -ldb -lMagick

dynapad.o::$(LIBPAD)

clean:
	rm -f *.so *.o *~

distclean:
	make clean
	rm -f makefile config.status config.cache config.log

all:
	(cd pad/unix; make)
	make dynapad.so

cleanall:
	(cd pad/unix; make clean)
	make clean

distcleanall:
	(cd pad/unix; make distclean)
	make distclean




Posted on the users mailing list.