Software Archive
Read-only legacy content
17061 Discussions

Compiling the runtime on Cygwin

kmilos
Beginner
372 Views

Hi,

I tried compiling the runtime on latest Cygwin w/ GCC 5.3, but ran into some errors which are solved with the patch below.

A few of the code samples do work well under Cygwin (e.g. Fibonacci), but some don't (cilk-reducers-demo never finishes). Unfortunately I'm at the limit of my debugging skills and time to figure out why.
 

diff -Naur cilkplus-rtl-src-004420/runtime/os-unix.c
cilkplus-rtl-src-004420_cygwin/runtime/os-unix.c
--- cilkplus-rtl-src-004420/runtime/os-unix.c      2015-11-09
22:27:52.000000000 +0100
+++ cilkplus-rtl-src-004420_cygwin/runtime/os-unix.c  2016-02-11
11:54:05.473915000 +0100
@@ -432,7 +432,8 @@
 #elif defined(__MIC__)
     _mm_delay_32(1024);
 #elif defined(__linux__) || \
-      defined(__APPLE__)
+      defined(__APPLE__) || \
+      defined(__CYGWIN__)
     usleep(10000);
 #else
 # error "Unsupported architecture"
@@ -452,6 +453,7 @@
 {
 #if defined(__ANDROID__)  || \
     defined(__APPLE__)    || \
+    defined(__CYGWIN__)   || \
     defined(__FreeBSD__)  || \
     defined(__VXWORKS__)  || \
     (defined(__sun__) && defined(__svr4__))
diff -Naur /cygdrive/d/Downloads/cilk/cilkplus-rtl-src-004420/runtime/sysdep-unix.c
cilkplus-rtl-src-004420/runtime/sysdep-unix.c
--- cilkplus-rtl-src-004420/runtime/sysdep-unix.c
2015-11-09 22:27:54.000000000 +0100
+++ cilkplus-rtl-src-004420_cygwin/runtime/sysdep-unix.c
2016-02-10 18:08:51.610235700 +0100
@@ -568,7 +568,7 @@
 {
     // dladdr is a glibc extension. If it's available, use it to find the path
     // for libcilkrts.so
-#ifdef _GNU_SOURCE
+#if defined(_GNU_SOURCE) && !defined(__CYGWIN__)
     Dl_info info;
     if (0 != dladdr(dummy_function, &info))
         return info.dli_fname;

 

0 Kudos
3 Replies
TimP
Honored Contributor III
372 Views

I had no clue it might be as simple as this to take a step forward.  I assumed the cilkplus project had no intention of supporting cygwin.

0 Kudos
Barry_T_Intel
Employee
372 Views

Correct. We did get the runtime building for Cygwin at one point, with GCC 4.8 or so, but that was more to demonstrate that it could be done. We had no plans to support Cygwin as a target platform. But we did leave the #ifdef's in the code. :o)

    - Barry

0 Kudos
TimP
Honored Contributor III
372 Views

When I try to build gcc trunk on cygwin with --enable-libcilkrts, I still get the configure not supported message.

I tried to test the recent release of gcc 5.3 including cilkplus, but there are still previously reported failures associated with apparent non-support of reducers etc and additional difficult to diagnose run-time segfaults which vary with compile flags.  Few cases are running successfully.

0 Kudos
Reply