--- a/src/fslsurface/fslsurface_structs.h
+++ b/src/fslsurface/fslsurface_structs.h
@@ -64,7 +64,7 @@
 #ifndef fslsurface_STRUCTS_H
 #define fslsurface_STRUCTS_H
 
-#ifdef __linux
+#if defined(__linux) || defined(__FreeBSD_kernel__)
 #define GL_GLEXT_PROTOTYPES
 #include <GL/gl.h>
 #include <GL/glext.h>
--- a/src/fslsurface/fslsurfacegl.h
+++ b/src/fslsurface/fslsurfacegl.h
@@ -67,7 +67,7 @@
 #include <fslsurface.h>
 
 
-#ifdef __linux
+#if defined(__linux) || defined(__FreeBSD_kernel__)
 
 #define GL_GLEXT_PROTOTYPES 
 #include <GL/glut.h>
--- a/src/fslsurface/fslsurfacemaths.cpp
+++ b/src/fslsurface/fslsurfacemaths.cpp
@@ -76,7 +76,7 @@
 #include <fslsurfacefns.h>
 #include <fslsurfaceio.h>
 #include <fslsurface_first.h>
-#ifdef __linux
+#if defined(__linux) || defined(__FreeBSD_kernel__)
 #else
 #include <AGL/agl.h>
 #endif
--- a/src/fslsurface/fslsurfacegl.cc
+++ b/src/fslsurface/fslsurfacegl.cc
@@ -288,7 +288,7 @@
 		glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, vbo_ele_array );
 		
 		//cout<<"render2 "<<endl;
-#ifdef __linux
+#if defined(__linux) || defined(__FreeBSD_kernel__)
 		glEnableVertexAttribArrayARB(vertexLoc);
 		glEnableVertexAttribArrayARB(normalLoc);
 		glEnableVertexAttribArrayARB(scalarLoc);
@@ -299,7 +299,7 @@
 #endif
 		
 		//cout<<"render3 "<<endl;
-#ifdef __linux
+#if defined(__linux) || defined(__FreeBSD_kernel__)
 		
 		glVertexAttribPointerARB(vertexLoc, 3, GL_FLOAT, GL_FALSE, sizeof(vertex<T>), 0);
 		glVertexAttribPointerARB(normalLoc, 3, GL_FLOAT, GL_FALSE, sizeof(vertex<T>), BUFFER_OFFSET(3*sizeof(float)));
@@ -317,7 +317,7 @@
 		glDrawElements(GL_TRIANGLES,surf.N_triangles*3,GL_UNSIGNED_INT,0);
 		//cout<<"render5 "<<surf->N_triangles<<endl;
 		
-#ifdef __linux
+#if defined(__linux) || defined(__FreeBSD_kernel__)
 		glDisableVertexAttribArrayARB(vertexLoc);
 		glDisableVertexAttribArrayARB(normalLoc);
 		glDisableVertexAttribArrayARB(scalarLoc);
--- a/src/eddy/eddy.cpp
+++ b/src/eddy/eddy.cpp
@@ -11,7 +11,9 @@
 #include "newmat.h"
 #include "newimage/newimageall.h"
 #include "miscmaths/miscmaths.h"
-#include "utils/stack_dump.h"
+// Disable stack_dump that upstream labels as "highly non-portable"
+// one can still use gdb to get the same information
+//#include "utils/stack_dump.h"
 #include "EddyHelperClasses.h"
 #include "ECScanClasses.h"
 #include "DiffusionGP.h"
@@ -58,7 +60,7 @@
 /// The entry point of eddy.
 int main(int argc, char *argv[])
 {
-  StackDump::Install(); // Gives us informative stack dump if/when program crashes
+  //StackDump::Install(); // Gives us informative stack dump if/when program crashes
 
   // Parse comand line input
   EddyCommandLineOptions clo(argc,argv); // Command Line Options
--- a/src/topup/topup.cpp
+++ b/src/topup/topup.cpp
@@ -83,7 +83,9 @@
 #include "newimage/newimageall.h"
 #include "miscmaths/miscmaths.h"
 #include "miscmaths/nonlin.h"
-#include "utils/stack_dump.h"
+// Disable stack_dump that upstream labels as "highly non-portable"
+// one can still use gdb to get the same information
+//#include "utils/stack_dump.h"
 #include "warpfns/warpfns.h"
 #include "basisfield/basisfield.h"
 #include "basisfield/splinefield.h"
@@ -100,7 +102,7 @@
 int main(int   argc,
          char  *argv[])
 {
-  StackDump::Install(); // Gives us informative stack dump if/when program crashes
+  //StackDump::Install(); // Gives us informative stack dump if/when program crashes
 
   // Read command line input
   boost::shared_ptr<topup_clp> clp;
