Building LLVM under Cygwin32 fails

I am updating our out-of-tree copy of LLVM to track the head (revision #272991 specifically).

I have it building successfully with VC++ 2013 and CMake v3.5.2 on Windows, and with GCC v4.8.5 and CMake v3.5.2 on CentOS; but when I try building on Windows using Cygwin32 I get the following build failures:

[ 4%] Building CXX object lib/Support/CMakeFiles/LLVMSupport.dir/Signals.cpp.o

In file included from /src/Compilers/llvmHead/llvm/lib/Support/Signals.cpp:180:0:

/src/Compilers/llvmHead/llvm/lib/Support/Unix/Signals.inc: In function ‘void llvm::sys::PrintStackTrace(llvm::raw_ostream&)’:

/src/Compilers/llvmHead/llvm/lib/Support/Unix/Signals.inc:418:5: error: ‘Dl_info’ was not declared in this scope

Dl_info dlinfo;

^

/src/Compilers/llvmHead/llvm/lib/Support/Unix/Signals.inc:419:28: error: ‘dlinfo’ was not declared in this scope

dladdr(StackTrace[i], &dlinfo);

^

/src/Compilers/llvmHead/llvm/lib/Support/Unix/Signals.inc:419:34: error: ‘dladdr’ was not declared in this scope

dladdr(StackTrace[i], &dlinfo);

^

/src/Compilers/llvmHead/llvm/lib/Support/Unix/Signals.inc:430:5: error: ‘Dl_info’ was not declared in this scope

Dl_info dlinfo;

^

/src/Compilers/llvmHead/llvm/lib/Support/Unix/Signals.inc:431:28: error: ‘dlinfo’ was not declared in this scope

dladdr(StackTrace[i], &dlinfo);

^

/src/Compilers/llvmHead/llvm/lib/Support/Unix/Signals.inc:431:34: error: ‘dladdr’ was not declared in this scope

dladdr(StackTrace[i], &dlinfo);

^

make[4]: *** [lib/Support/CMakeFiles/LLVMSupport.dir/build.make:2223: lib/Support/CMakeFiles/LLVMSupport.dir/Signals.cpp.o] Error 1

I am using CMake v3.5.2 built from source on Cygwin32 because v3.5.2 is not yet available from for download, and GCC v5.4.0. Other than CMake, all of my Cygwin32 installation is from the distribution.

Is there a quick-fix known for this, or has it been fixed in a later revision, or is this a new problem?

Thanks,

MartinO

Googling indicates that cygwin doesn’t have that functionality. Or, at least, didn’t in 2010, when someone asked about the same problem:

https://cygwin.com/ml/cygwin/2010-01/msg00596.html

"cygwin has only dlsym() not the SGI DL_info + dladdr() yet.
clang just needs it to get the path for the CIndex dll.
This should be possible with the code in the LLVM_ON_WIN32 section,
and convert then the path from win to posix with cygwin_conv_path()."

Nakamura runs a bot labelled “cygwin” here, but it’s apparently down:
http://bb.pgr.jp/builders

I’m not sure it’s still a supported configuration, but we could probably accept non-invasive patches to make it work.

Okay, thanks Bruce.

The only thing I have changed is to move to CMake v3.5.2 (required upgrade) and synched with LLVM #272991 (from #262824) and it was building perfectly before.

The header ‘Unix/Signals.inc’ is included conditionally by ‘lib/Support/Signals.cpp’ at the very end of the file using:

// Include the platform-specific parts of this class.

#ifdef LLVM_ON_UNIX

#include “Unix/Signals.inc”

#endif

#ifdef LLVM_ON_WIN32

#include “Windows/Signals.inc”

#endif

Nothing relevant appears to have changed in the ‘lib/Support’ directory or in the file ‘lib/Support/Signals.cpp’, so I think it might be a CMake issue. One variable is that I had to build CMake v3.5.2 for Cygwin from source because the newest available from cygwin.org is v3.3.2-1 which does not meet the minimum bar for LLVM anymore. The Windows and CentOS versions are official releases, but usually the ‘configure/build/install’ sequence works out of the box for CMake.

The following condition (‘lib/Support/Unix/Signals.inc’ line #415):

#if HAVE_DLFCN_H && GNUG

is evaluating TRUE, so I’m guessing that CMake is taking a wrong turn somewhere. I changed this locally to:

#if !defined(CYGWIN) && HAVE_DLFCN_H && GNUG

and it compiles fine now. I’m guessing that CMake is not correctly setting something, but I’ll have to dig deeper to find out exactly what though.

Thanks,

MartinO