samedi 11 avril 2015

Compile and build gicp on windows

I'm trying to compile and build the following sources (github link) on a windows 8 - 64 bit machine.


The Project needs the following libraries:



  • gsl

  • boost

  • ANN


So as a simple make command didn't work out, I tried to compile and build the sources with netbeans. I installed boost and gsl with the cygwin-installer and downloaded a precompiled version of ANN_1.1.1.


So I started to build with netbeans and was able to build the first target, scan2ascii.exe. The build process fails while building the second target test_gicp.exe with the following error:



CLEAN SUCCESSFUL (total time: 101ms)
g++ `pkg-config --cflags gsl` -o3 -I./ann_1.1.1/include/ANN -fpermissive -c gicp.cpp -o gicp.o
gicp.cpp: In member function 'int dgc::gicp::GICPPointSet::AlignScan(dgc::gicp::GICPPointSet*, double (*)[4], double (*)[4], double, bool)':
gicp.cpp:397:79: warning: taking address of temporary [-fpermissive]
gsl_linalg_cholesky_svx(gsl_temp, &gsl_matrix_row(&M.matrix, k).vector);
g++ `pkg-config --cflags gsl` -o3 -I./ann_1.1.1/include/ANN -fpermissive -c optimize.cpp -o optimize.o
g++ `pkg-config --cflags gsl` -o3 -I./ann_1.1.1/include/ANN -fpermissive -c bfgs_funcs.cpp -o bfgs_funcs.o
g++ `pkg-config --cflags gsl` -o3 -I./ann_1.1.1/include/ANN -fpermissive -c transform.cpp -o transform.o
g++ `pkg-config --cflags gsl` -o3 -I./ann_1.1.1/include/ANN -fpermissive -c scan.cpp -o scan.o
ar rvs libgicp.a gicp.o optimize.o bfgs_funcs.o transform.o scan.o
ar: creating libgicp.a
a - gicp.o
a - optimize.o
a - bfgs_funcs.o
a - transform.o
a - scan.o
g++ `pkg-config --cflags gsl` -o3 -I./ann_1.1.1/include/ANN -fpermissive -c scan2ascii.cpp -o scan2ascii.o
g++ -o scan2ascii scan.o scan2ascii.o transform.o `pkg-config --libs gsl` -L. -lgicp -Lann_1.1.1/lib -lANN -lgsl -lgslcblas -lboost_program_options -lboost_system -lstdc++
g++ `pkg-config --cflags gsl` -o3 -I./ann_1.1.1/include/ANN -fpermissive -c test_gicp.cpp -o test_gicp.o
g++ -o test_gicp test_gicp.o gicp.o optimize.o bfgs_funcs.o transform.o `pkg-config --libs gsl` -L. -lgicp -Lann_1.1.1/lib -lANN -lgsl -lgslcblas -lboost_program_options -lboost_system -lstdc++
collect2: error: ld terminated with signal 11 [Segmentation fault], core dumped
/usr/lib/gcc/x86_64-pc-cygwin/4.9.2/../../../../x86_64-pc-cygwin/bin/ld: BFD (GNU Binutils) 2.25 assertion fail /cygdrive/i/szsz/tmpp/cygwin64/binutils/binutils-2.25-1.x86_64/src/binutils-gdb/bfd/cofflink.c:264
Makefile:35: recipe for target 'test_gicp' failed
make: *** [test_gicp] Error 1

BUILD FAILED (exit value 2, total time: 10s)


Any idea on how I could get this work? Would it be a good idea to create a CMakelists.txt and compile and build with cmake and VisualStudio 10?


EDIT:


Here is the Makefile i use:



LFLAGS += `pkg-config --libs gsl`
CXXFLAGS += `pkg-config --cflags gsl`

LFLAGS += -L. -lgicp -Lann_1.1.1/lib -lANN -lgsl -lgslcblas \
-lboost_program_options -lboost_system -lstdc++
CXXFLAGS += -o3 -I./ann_1.1.1/include/ANN -fpermissive


LINK = g++
CXX = g++

SOURCES = optimize.cpp gicp.cpp bfgs_funcs.cpp scan.cpp transform.c scan2ascii.cpp

BINARIES = scan2ascii test_gicp

TARGETS = libgicp.a scan2ascii test_gicp

.SUFFIXES:
.SUFFIXES: .o .c .cpp .a

# rules
all: $(TARGETS)

libgicp.a: gicp.o optimize.o bfgs_funcs.o transform.o scan.o
ar rvs $@ $^

test_gicp: test_gicp.o gicp.o optimize.o bfgs_funcs.o transform.o

scan2ascii: scan.o scan2ascii.o transform.o

clean:
rm -f *.o $(TARGETS) *~ t_*.tfm *.dat mahalanobis.txt correspondence.txt iterations.txt

$(BINARIES):
$(LINK) -o $@ $^ $(LFLAGS)

.cpp.o:
$(CXX) $(CXXFLAGS) -c $< -o $@

Aucun commentaire:

Enregistrer un commentaire