pkgsrc-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Oh, but to compile clang

On Fri, 4 May 2012 21:51:55 +0200
Jonathan Schleifer <> wrote:

> I have been having the exact same problem for quite a while now. I
> tried adding an #undef NetBSD there which fixed it, but
> unfortunately, there is more broken with the headers so it completely
> failed later on with a completely different problem. 

$ svn info
Path: .
Repository Root:
Repository UUID: 91177308-0d34-0410-b5e6-96231b3b80d8
Revision: 155632

I have this version of clang compiled and working with gcc 4.6.  I used
the latest Subversion repository from about a week ago.  I had to
modify one gcc header file per below.   

In ctype_base.h, after 

        #include <sys/param.h>

I added 

        #if DNU_SYS_PARAMS_H
        # undef NetBSD
        # undef FSCALE

For simplicity, I added this guard to Clang's header file:

$ svn diff
Index: include/llvm/ADT/SmallVector.h
--- include/llvm/ADT/SmallVector.h      (revision 155441)
+++ include/llvm/ADT/SmallVector.h      (working copy)
@@ -23,6 +23,12 @@
 #include <iterator>
 #include <memory>
+#ifdef NetBSD
+# if NetBSD == 199905
+#  error "NetBSD has been defined by sys/param.h"
+# endif
 namespace llvm {

That way, if the "NetBSD" value leaks out of param.h, compilation fails
early with a clear message.  

That gets clang itslef compiled and working.  To actually use it to
compile C++ programs requires more support from NetBSD, notably
locale functions.  


Home | Main Index | Thread Index | Old Index