Wednesday, 16 January 2013

Compiling Clarkson's Hull on Fedora


A note on compiling Ken Clarkson's hull program for efficiently computing convex and concave hulls (alpha shapes) of point clouds, on newer Fedora

First, follow the fix described here which fixes the pasting errors given if using gcc compiler.

Then, go into hullmain.c and replace the line which says:

FILE *INFILE, *OUTFILE, *DFILE = stderr, *TFILE;
//to read:
FILE *INFILE, *OUTFILE, *TFILE, *DFILE;
//and in main() add the following lines
FILE *DFILE;
DFILE = stderr;
view raw hullcompile.c hosted with ❤ by GitHub


at the end of the function declarations (before the first while loop)

Finally, rewrite the makefile so it reads as below It differs significantly from the one provided.

CC = gcc
AR = ar
OBJS = hull.o ch.o io.o rand.o pointops.o fg.o
HDRS = hull.h points.h pointsites.h stormacs.h
SRC = hull.c ch.c io.c rand.c pointops.c fg.c
PROG = hull
BINDIR = /usr/bin
LIBDIR = /usr/lib64 # or just /usr/lib on a 32 bit machine?
LIB = $(LIBDIR)/lib$(PROG).a
all : $(PROG) rsites
cp $(PROG) $(BINDIR)/.
cp rsites $(BINDIR)/.
$(OBJS) : $(HDRS)
hullmain.o : $(HDRS)
$(PROG) : $(OBJS) hullmain.o
$(CC) $(OBJS) hullmain.o -o $(PROG) -lm
$(AR) rcv $(LIB) $(OBJS)
rsites : rsites.c
$(CC) -o rsites rsites.c -lm
clean :
-rm -f $(OBJS) hullmain.o core a.out $(PROG)
view raw makefile hosted with ❤ by GitHub


Notice how the CFLAGS have been removed. Compile as root (sudo make)

No comments: