[OpendTect_Developers] Compile OD with Mac OSX 10.9 (clang/llvm)

David d'Angelo david.d-angelo at iais.fraunhofer.de
Tue Oct 29 14:17:29 CET 2013


Hi folks,

I attached a patch for the boost.iostreams issue. I haven't tested it 
though.
I am working on some more compilation issues with clang/llvm...

Best regards,
David

On 29/10/13 13:22, David d'Angelo wrote:
> Hi folks,
>
> I tried to compile OpendTect with Mac OSX 10.9 (Mavericks) and found 
> the following minor issues:
>
>  1. The autogenerated file *include/basic/svnversion.h* should define
>     some int as version number. If it is empty, the clang compiler
>     will complain at *src/basic/genc.c:407* that the function must
>     return an int.
>  2. Missing include of <cstdlib> in*src/Basic/cubesampling.cc*.
>  3. Missing include of <unistd.h> in *src/Basic/file.cc*
>  4. Missing include of <unistd.h> in *src/Basic/odinst.cc*
>
> The file *src/Basic/strmprov.cc *uses gcc dependent *template 
> __gnu_cxx::stdio_filebuf<char>*, which obviously does not exist in the 
> clang/llvm framework. Are there any plans to exchange this to a 
> platform independent implementation like *Boost.Iostreams*?
>
> Any patch for this would be highly appreciated.
>
> Best regards,
> David
>
> -- 
> David d'Angelo, M. Sc.
> Adaptive Reflective Teams
> Fraunhofer IAIS
> Schloss Birlinghoven
> 53757 Sankt Augustin
> Germany
> Fon: +49 (0) 2241 14 3444
> Fax: +49 (0) 2241 14 2040
>
>
> _____________________________________________________________
> OpendTect Developers mailing list Developers at opendtect.org
> http://lists.opendtect.org/mailman/listinfo/developers
>
> You receive this mail because you are listed on developers at opendtect.org To unsubscribe please go to http://lists.opendtect.org/mailman/options/developers . If you encounter any problems, please contact support at opendtect.org .


-- 
David d'Angelo, M. Sc.
Adaptive Reflective Teams
Fraunhofer IAIS
Schloss Birlinghoven
53757 Sankt Augustin
Germany
Fon: +49 (0) 2241 14 3444
Fax: +49 (0) 2241 14 2040

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opendtect.org/pipermail/developers/attachments/20131029/a0f5180e/attachment.html>
-------------- next part --------------
--- strmprov.cc	2013-10-29 14:11:32.000000000 +0100
+++ strmprov.cc.new	2013-10-29 14:11:22.000000000 +0100
@@ -53,8 +53,18 @@
 #endif
 
 #ifndef __msvc__
-# include <ext/stdio_filebuf.h>
-# define mStdIOFileBuf __gnu_cxx::stdio_filebuf<char>
+#if defined(__GNUC__) && !defined(__clang__)
+ #include <ext/stdio_filebuf.h>
+ # define mStdIOFileBuf __gnu_cxx::stdio_filebuf<char>
+#else
+#include <fstream>
+//# define mStdIOFileBuf __gnu_cxx::stdio_filebuf<char>
+#include <boost/iostreams/device/file_descriptor.hpp>
+#include <boost/iostreams/stream.hpp>
+namespace io = boost::iostreams;
+#endif
+
+
 #endif
 
 #include "file.h"
@@ -806,10 +816,13 @@
 #else
 # if __GNUC__ > 2
 	//TODO change StreamData to include filebuf?
-	mStdIOFileBuf* stdiofb = new mStdIOFileBuf( sd.fp_, std::ios_base::in );
-	sd.istrm = new std::istream( stdiofb );
+	//mStdIOFileBuf* stdiofb = new mStdIOFileBuf( sd.fp_, std::ios_base::in );
+	//sd.istrm = new std::istream( stdiofb );
+	io::stream<io::file_descriptor_source> fds(
+	    io::file_descriptor_source( fileno(sd.fp_), io::never_close_handle ) );
+	sd.istrm = (&fds);
 # else
-	sd.istrm = new std::ifstream( fileno(sd.fp) );  
+	sd.istrm = new std::ifstream( fileno(sd.fp) );
 # endif
 #endif
     }
@@ -863,8 +876,11 @@
 	sd.ostrm = new std::ostream( fb );
 #else
 # if __GNUC__ > 2
-	mStdIOFileBuf* stdiofb = new mStdIOFileBuf( sd.fp_,std::ios_base::out );
-	sd.ostrm = new std::ostream( stdiofb );
+//	mStdIOFileBuf* stdiofb = new mStdIOFileBuf( sd.fp_,std::ios_base::out );
+//	sd.ostrm = new std::ostream( stdiofb );
+	io::stream<io::file_descriptor_source> fds(
+		io::file_descriptor_source( fileno(sd.fp_), io::never_close_handle ) );
+	sd.istrm = (&fds);
 # else
 	sd.ostrm = new std::ofstream( fileno(sd.fp) );
 # endif


More information about the Developers mailing list