rishiroy1984 / graphlabapi

Automatically exported from code.google.com/p/graphlabapi
0 stars 0 forks source link

metric_eval doesn't compile on OS X #46

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. hg clone the source
2. make
3. cd toolkits/collaborative_filtering
4. make

When trying to build metric_eval.cpp you'll see:
g++ -O3  -I/usr/local/include/ -I../../src/ -I. -DEIGEN_NDEBUG -fopenmp -Wall 
-Wno-strict-aliasing metric_eval.cpp  -o metric_eval -lz
metric_eval.cpp: In function ‘void get_one_line(FILE*, int&, vec&, int&)’:
metric_eval.cpp:52: error: no matching function for call to ‘getline(char**, 
size_t*, FILE*&)’
make: *** [metric_eval] Error 1

The getline problem is already solved in getline.hpp and typically included in 
common.hpp.  metric_eval.cpp doesn't include common.hpp (and can't because 
common.hpp defines a conflicting variable K).  However it's easy enough to 
patch:

--- a/toolkits/collaborative_filtering/metric_eval.cpp  Wed Apr 17 15:16:06 
2013 -0400
+++ b/toolkits/collaborative_filtering/metric_eval.cpp  Thu Apr 18 12:05:29 
2013 -0400
@@ -30,6 +30,9 @@
 #include "util.hpp"
 #include "eigen_wrapper.hpp"
 #include "metrics.hpp"
+#ifdef __APPLE__
+#include "getline.hpp" //fix for missing getline() function on MAC OS
+#endif 

 using namespace std;
 using namespace graphchi;

Original issue reported on code.google.com by aharb...@gmail.com on 18 Apr 2013 at 4:10