Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 574977
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T13:53:20+00:00 2026-05-13T13:53:20+00:00

I have been able to build LLVM 2.6 (the llvm-2.6.tar.gz package) using MinGW GCC

  • 0

I have been able to build LLVM 2.6 (the llvm-2.6.tar.gz package) using MinGW GCC 3.4.5. I haven’t tested properly, but it seems to work.

The trouble is, I have libraries of my own which don’t build using GCC3, but which work fine in GCC4 (template issues). I believe the first official GCC4 version for MinGW is GCC 4.4.0.

EDIT

Decluttered – everything useful in the “tried this tried that” info is now in the answer.

EDIT

Most of this question/answer is redundant with LLVM 2.7 – the standard configure, make routine works fine in MinGW with no hacks or workarounds.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T13:53:20+00:00Added an answer on May 13, 2026 at 1:53 pm

    If at first you don’t succeed…

    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.

    Before the step-by-step, here are the three problems…


    Problem 1…

    Attempting to build llvm using the standard build instructions fails with the
    following compiler error in Signals.cpp (win32/Program.inc)

    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
    

    The workaround is to use “make -k -fexceptions” – answer found in the pure language documentation.


    Problem 2…

    Even with the first workaround, the following compiler error occurs…

    ExternalFunctions.cpp: In function 'bool ffiInvoke(void (*)(), llvm::Function*, const std::vector<llvm::GenericValue, std::allocator<llvm::GenericValue> >&, const llvm::TargetData*, llvm::GenericValue&)':
    ExternalFunctions.cpp:207: error: 'alloca' was not declared in this scope
    

    It seems that an option is being specified which disables the “alloca” built-in.

    The workaround is to edit the problem file

    C:\llvm-2.6\lib\ExecutionEngine\Interpreter\ExternalFunctions.cpp
    

    Just after the “#include <string>” line, insert…

    #define alloca __builtin_alloca
    

    Problem 3…

    Even with the compilation errors fixed, the example programs won’t run. The run-time errors are…

    Assertion failed: errorcode == 0, file RWMutex.cpp, line 87
    

    This relates to the use of the pthreads library, in the following lines of
    RWMutex.cpp

    86:   // Initialize the rwlock
    87:   errorcode = pthread_rwlock_init(rwlock, &attr);
    88:   assert(errorcode == 0);
    

    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 not 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.

    One workaround is to delete the following files from mingw gcc 4.4.0 as suggested in http://markmail.org/message/d7zw2zjq7svevsci – yes, I know I previously said they weren’t there, but I had my folder layout confused…

    • mingw32\include\pthread.h
    • mingw32\include\sched.h
    • mingw32\include\semaphore.h
    • mingw32\lib\libpthread.a

    It is better, though, to simply tell the configure script to disable threads…

    ./configure --disable-threads
    

    So, the steps are…

    First, install the following MinGW and MSYS packages…

    • binutils-2.20-1-mingw32-bin.tar.gz
    • mingwrt-3.17-mingw32-dev.tar.gz
    • mingwrt-3.17-mingw32-dll.tar.gz
    • w32api-3.14-mingw32-dev.tar.gz
    • gcc-full-4.4.0-mingw32-bin-2.tar.lzma
    • make-3.81-20090914-mingw32-bin.tar.gz
    • tcltk-8.4.1-1.exe
    • MSYS-1.0.11.exe
    • msysDTK-1.0.1.exe
    • bash-3.1.17-2-msys-1.0.11-bin.tar.lzma
    • bison-2.4.1-1-msys-1.0.11-bin.tar.lzma
    • flex-2.5.35-1-msys-1.0.11-bin.tar.lzma
    • libregex-0.12-1-msys-1.0.11-dll-0.tar.lzma

    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.

    Make sure that the \bin folder of your MinGW install is on the PATH (Control Panel, System, Advanced, Environment Variables).

    Extract llvm-2.6.tar.gz

    Edit the file C:\llvm-2.6\lib\ExecutionEngine\Interpreter\ExternalFunctions.cpp, and just after the line “#include <string>”, add the line

    #define alloca __builtin_alloca
    

    Start an MSYS command prompt, and run…

    cd /c/llvm-2.6
    ./configure --disable-threads
    make -k CXXFLAGS=-fexceptions
    

    I’m assuming you extracted llvm to c:\llvm-2.6

    Handy hint – try “./configure –help”

    Consider the –enable-targets=host-only and –enable-doxygen configure script options in particular.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been trying to build a regular expression but haven't been able to
Hi I have been able to extract a VARCHAR to a date using string_to_date
I have been able to Archive on Xcode 4 successfully, but all of a
I have been using the new Windows Azure Websites preview to build a site
I am attempting to build a simple application using wicket and have been impressed
I have tried multiple times, but never have been able to install scipy via
from my research I have been able to build a function in VBA for
I have been able to successfully get an access token from Vimeo using the
Allright, I have been able to make it work with DataGrid, but for some
I am a beginner with Ruby on Rails. I have been able to build

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.