Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>If at first you don't succeed...</p> <p>I can now build LLVM 2.6 using MinGW GCC 4.4.0, and it isn't too hard once you know how. I still cannot run the DejaGNU tests, though at first sight that shouldn't be that hard - most likely I'll need the CygWin packages for dejagnu and expect. I also haven't built llvm-gcc yet.</p> <p>Before the step-by-step, here are the three problems... <HR> Problem 1...</p> <p>Attempting to build llvm using the standard build instructions fails with the following compiler error in Signals.cpp (win32/Program.inc)</p> <pre><code>llvm[1]: Compiling Signals.cpp for Release build In file included from Signals.cpp:33: Win32/Signals.inc: In function 'LONG LLVMUnhandledExceptionFilter(_EXCEPTION_POINTERS*)': Win32/Signals.inc:234: error: exception handling disabled, use -fexceptions to enable </code></pre> <p>The workaround is to use "make -k -fexceptions" - answer found in the pure language documentation. <HR> Problem 2...</p> <p>Even with the first workaround, the following compiler error occurs...</p> <pre><code>ExternalFunctions.cpp: In function 'bool ffiInvoke(void (*)(), llvm::Function*, const std::vector&lt;llvm::GenericValue, std::allocator&lt;llvm::GenericValue&gt; &gt;&amp;, const llvm::TargetData*, llvm::GenericValue&amp;)': ExternalFunctions.cpp:207: error: 'alloca' was not declared in this scope </code></pre> <p>It seems that an option is being specified which disables the "alloca" built-in.</p> <p>The workaround is to edit the problem file</p> <pre><code>C:\llvm-2.6\lib\ExecutionEngine\Interpreter\ExternalFunctions.cpp </code></pre> <p>Just after the "#include &lt;string&gt;" line, insert...</p> <pre><code>#define alloca __builtin_alloca </code></pre> <p><HR> Problem 3...</p> <p>Even with the compilation errors fixed, the example programs won't run. The run-time errors are...</p> <pre><code>Assertion failed: errorcode == 0, file RWMutex.cpp, line 87 </code></pre> <p>This relates to the use of the pthreads library, in the following lines of RWMutex.cpp</p> <pre><code>86: // Initialize the rwlock 87: errorcode = pthread_rwlock_init(rwlock, &amp;attr); 88: assert(errorcode == 0); </code></pre> <p>The basic issue is that pthreads support is included in MinGW GCC, and included in the builds of AFAICT all the GCC4 variants - including the unofficial TDM builds, as well as including MinGW GCC 4.4.0. This was <em>not</em> included with MinGW GCC 3.4.5, which is why LLVM builds fine with default options on that compiler. Using 4.4.0, the LLVM configure script detects the pthreads support and uses it - but the pthreads-w32 library used seems not to be fully compatible.</p> <p>One workaround is to delete the following files from mingw gcc 4.4.0 as suggested in <a href="http://markmail.org/message/d7zw2zjq7svevsci" rel="noreferrer">http://markmail.org/message/d7zw2zjq7svevsci</a> - yes, I know I previously said they weren't there, but I had my folder layout confused...</p> <ul> <li>mingw32\include\pthread.h</li> <li>mingw32\include\sched.h</li> <li>mingw32\include\semaphore.h</li> <li>mingw32\lib\libpthread.a</li> </ul> <p>It is better, though, to simply tell the configure script to disable threads...</p> <pre><code>./configure --disable-threads </code></pre> <p><HR> So, the steps are...</p> <p>First, install the following MinGW and MSYS packages...</p> <p><UL> <LI>binutils-2.20-1-mingw32-bin.tar.gz <LI>mingwrt-3.17-mingw32-dev.tar.gz <LI>mingwrt-3.17-mingw32-dll.tar.gz <LI>w32api-3.14-mingw32-dev.tar.gz <LI>gcc-full-4.4.0-mingw32-bin-2.tar.lzma <LI>make-3.81-20090914-mingw32-bin.tar.gz <LI>tcltk-8.4.1-1.exe <LI>MSYS-1.0.11.exe <LI>msysDTK-1.0.1.exe <LI>bash-3.1.17-2-msys-1.0.11-bin.tar.lzma <LI>bison-2.4.1-1-msys-1.0.11-bin.tar.lzma <LI>flex-2.5.35-1-msys-1.0.11-bin.tar.lzma <LI>libregex-0.12-1-msys-1.0.11-dll-0.tar.lzma </UL></p> <p>This package list may be more than needed - in particular tcl tk is only needed for the DejaGNU tests, which I haven't got working yet.</p> <p>Make sure that the \bin folder of your MinGW install is on the PATH (Control Panel, System, Advanced, Environment Variables).</p> <p>Extract llvm-2.6.tar.gz</p> <p>Edit the file C:\llvm-2.6\lib\ExecutionEngine\Interpreter\ExternalFunctions.cpp, and just after the line "#include &lt;string>", add the line</p> <pre><code>#define alloca __builtin_alloca </code></pre> <p>Start an MSYS command prompt, and run...</p> <pre><code>cd /c/llvm-2.6 ./configure --disable-threads make -k CXXFLAGS=-fexceptions </code></pre> <p>I'm assuming you extracted llvm to c:\llvm-2.6</p> <p>Handy hint - try "./configure --help"</p> <p>Consider the --enable-targets=host-only and --enable-doxygen configure script options in particular.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload