clangupc / clang-upc

Clang UPC Front-End
https://clangupc.github.io/
Other
16 stars 5 forks source link

build failure on netbsd6/amd64 #35

Closed PHHargrove closed 10 years ago

PHHargrove commented 10 years ago

See below for the error I encounter building clang-upc on NetBSD6/amd64.

Looks like sys_siglist is not very portable, as you already have an #if for sgi.

I will see about a patch for this issue mysef, since I am able to test.

[ 91%] Building C object tools/clang/runtime/libupc/CMakeFiles/upc.dir/smp/upc_sysdep.c.o
/home/phargrov/upcnightly/llvm-upc/src/tools/clang/runtime/libupc/smp/upc_sysdep.c:46:29: error: redefinition of 'sys_siglist' with a different type: 'const char *const []' vs 'const char *const *'
  extern const char * const sys_siglist[];
                            ^
/usr/include/signal.h:52:27: note: previous definition is here
extern const char *const *sys_siglist __RENAME(__sys_siglist14);
                          ^
1 error generated.
PHHargrove commented 10 years ago

Sigh. The NetBSD manpage agrees with the decl in upc_sysdep.c. However, as you can see in the error they've declared a pointer rather than an array.

The following allowed my build to complete. Not sure if this is the best solution.

--- llvm-upc/src/tools/clang/runtime/libupc/smp/upc_sysdep.c~ 2014-02-26 16:09:20.000000000 -0800
+++ llvm-upc/src/tools/clang/runtime/libupc/smp/upc_sysdep.c  2014-02-26 16:12:49.000000000 -0800
@@ -43,9 +43,7 @@
   char **sys_siglist = _sys_siglist;
   const int nsig = _sys_nsig;
 #else
+ #ifndef __NetBSD__ // signal.h has pointer decl instead of array
   extern const char * const sys_siglist[];
+ #endif
   const int nsig = NSIG;
 #endif
   if (sig > 0 && sig < nsig)
gary-funck commented 10 years ago

Your suggested patch looks OK to me. Please commit.