Hi Jose,
On 30/11/10 07:36, Jose Gonzalez wrote:
> I'm a new user trying to compile standalone version 0.5. I had a
> couple of problems so far:
> * The eigen 3 dependency is not listed on the wiki (I'll try to use
> eigen3.0-beta2)
Eigen 3.0-beta2 is what we have been using.
> * I got a compilation error related to the ANN library. The code uses
> different float and integer parameters instead of ANNcoord, ANNDist,
> etc. in different function calls.. I know this dependency is a
> candidate to be removed but I'd like to know which version could I use
> to make pcl 0.5 to work (I'm trying the latest version I found, ANN
> 1.1.2)
For ANN, we use 1.1.2, but we apply a few patches to it first. I've
attached these patches. You need to apply them in this order, or they
won't apply correctly:
1. gcc43_shared.patch
2. fPIC.patch
3. distance.patch
FLANN is making rapid improvements so hopefully we will be able to
remove ANN by the next minor release.
Geoff
--- ./Makefile.orig 2009-01-06 11:03:59.000000000 -0800
+++ ./Makefile 2009-01-06 11:04:29.000000000 -0800
@@ -42,6 +42,7 @@
default:
@echo "Enter one of the following:"
@echo " make linux-g++ for Linux and g++"
+ @echo " make linux-shared-g++ for Linux and g++ (shared)"
@echo " make macosx-g++ for Mac OS X and g++"
@echo " make sunos5 for Sun with SunOS 5.x"
@echo " make sunos5-sl for Sun with SunOS 5.x, make shared libs"
@@ -56,7 +57,7 @@
#-----------------------------------------------------------------------------
# main make entry point
#-----------------------------------------------------------------------------
-alpha-g++ macosx-g++ linux-g++ sgi sunos4 sunos4-g++ sunos5 sunos5-g++ sunos5-g++-sl authors-debug authors-perf:
+alpha-g++ macosx-g++ linux-g++ linux-shared-g++ sgi sunos4 sunos4-g++ sunos5 sunos5-g++ sunos5-g++-sl authors-debug authors-perf:
cd src ; $(MAKE) $@
cd test ; $(MAKE) $@
cd sample ; $(MAKE) $@
--- ./Make-config.orig 2009-01-06 11:02:38.000000000 -0800
+++ ./Make-config 2009-01-06 11:04:36.000000000 -0800
@@ -76,6 +76,15 @@
"MAKELIB = ar ruv" \
"RANLIB = true"
+# Linux using g++ shared
+linux-shared-g++:
+ $(MAKE) targets \
+ "ANNLIB = libANN.so" \
+ "C++ = g++" \
+ "CFLAGS = -O3" \
+ "MAKELIB = g++ -shared -o" \
+ "RANLIB = true"
+
# Mac OS X using g++
macosx-g++:
$(MAKE) targets \
--- Make-config 2009-02-05 15:12:09.000000000 -0800
+++ Make-config.new 2009-02-05 15:22:58.000000000 -0800
@@ -72,7 +72,7 @@
$(MAKE) targets \
"ANNLIB = libANN.a" \
"C++ = g++" \
- "CFLAGS = -O3" \
+ "CFLAGS = -O3 -fPIC" \
"MAKELIB = ar ruv" \
"RANLIB = true"
@@ -81,7 +81,7 @@
$(MAKE) targets \
"ANNLIB = libANN.so" \
"C++ = g++" \
- "CFLAGS = -O3" \
+ "CFLAGS = -O3 -fPIC" \
"MAKELIB = g++ -shared -o" \
"RANLIB = true"
--- include/ANN/ANN.h.orig 2010-06-08 13:24:11.000000000 -0700
+++ include/ANN/ANN.h 2010-06-08 13:25:12.000000000 -0700
@@ -111,11 +111,11 @@
//----------------------------------------------------------------------
#ifdef ANN_NO_LIMITS_H // limits.h unavailable
#include <cvalues> // replacement for limits.h
- const double ANN_DBL_MAX = MAXDOUBLE; // insert maximum double
+ const double ANN_DBL_MAX = MAXFLOAT; // insert maximum double
#else
#include <climits>
#include <cfloat>
- const double ANN_DBL_MAX = DBL_MAX;
+ const float ANN_DBL_MAX = FLT_MAX;
#endif
#define ANNversion "1.1.2" // ANN version and information
@@ -155,8 +155,8 @@
// not occur in distance calculation.
//----------------------------------------------------------------------
-typedef double ANNcoord; // coordinate data type
-typedef double ANNdist; // distance data type
+typedef float ANNcoord; // coordinate data type
+typedef float ANNdist; // distance data type
//----------------------------------------------------------------------
// ANNidx
@@ -217,9 +217,9 @@
//----------------------------------------------------------------------
#ifdef DBL_DIG // number of sig. bits in ANNcoord
- const int ANNcoordPrec = DBL_DIG;
+ const int ANNcoordPrec = FLT_DIG;
#else
- const int ANNcoordPrec = 15; // default precision
+ const int ANNcoordPrec = 6; // default precision
#endif
//----------------------------------------------------------------------
--- test/rand.cpp.orig 2010-06-08 13:25:48.000000000 -0700
+++ test/rand.cpp 2010-06-08 13:27:02.000000000 -0700
@@ -392,7 +392,7 @@
ANNpointArray pa, // point array
int n, // number of points
int dim, // dimension
- double *control, // control vector
+ ANNcoord *control, // control vector
double std_dev) // standard deviation
{
for (int i = 0; i < n; i++) { // generate each point
@@ -490,8 +490,8 @@
ANNpointArray pa, // point array
int n, // number of points
int dim, // dimension
- double *center, // center vector
- double *std_dev) // standard deviation vector
+ ANNcoord *center, // center vector
+ ANNcoord *std_dev) // standard deviation vector
{
for (int i = 0; i < n; i++) {
for (int d = 0; d < dim; d++) {