[cfe-dev] Building with mingw64 on Windows issue

Maarten Verhage via cfe-dev cfe-dev at lists.llvm.org
Wed Nov 28 10:57:18 PST 2018


Dear people of clang and llvm,

I’m completely new here. But I have some experience with C++, TDM-GCC, boost 
and Qt.

Ok, my desire is to be able to build the LLVM/clang system with mingw64 on 
Windows 7, 64bit. I’m currently stuck on an error that the shared library 
c++abi cannot be found. Below is shown how I got there.

I wasn’t able to find build guidelines specific for mingw64. But left to my 
own devices I believe I made some progress.

I downloaded MinGW-W64 GCC-8.1.0 from here:
https://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win32/Personal%20Builds/mingw-builds/8.1.0/threads-win32/

There I selected: x86_64-win32-seh for download.

I got llvm and clang plus the llvm libc++ standard library and libc++abi as
suggested on the getting started webpage.

I put the mingw-w64 bin folder in my PATH.
gcc -dumpversion
shown 8.1.0

I already figured out a way to compile the thread_win32.cpp file located in 
<llvm_path>/projects/libcxx/src/support/win32. With the following 
adjustments (hacks) to CMakeLists.txt files.

In C:\dev\llvm\projects\libcxx\CMakeLists.txt
added section at line 65:
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
  set(LIBCXX_TARGETING_GNU ON)
  message(STATUS "Configuring for GNU")
else()
  set(LIBCXX_TARGETING_GNU OFF)
endif()

Then in C:\dev\llvm\projects\libcxx\lib\CMakeLists.txt
added section at line 132
if (LIBCXX_TARGETING_GNU)
  message( STATUS "GNU Configuration here" )
  add_compile_flags(-D_LIBCPP_HAS_THREAD_API_WIN32 -D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS 
 -D_WIN32_WINNT=0x0600)
endif()

My cmake command line is:
cmake -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=Release ^
-DLLVM_PATH=C:\dev\llvm ^
-DLIBCXX_CXX_ABI=libcxxabi ^
-DLIBCXX_CXX_ABI_INCLUDE_PATHS=C:\dev\llvm\projects\libcxxabi\include ^
-S C:\dev\llvm\projects\libcxx -B 
T:\x86_64-8.1.0-release-win32-seh-rt_v6-rev0\mingw64\build > 
cmake_result.txt 2>&1

cmake_result.txt is attached.

note: T: is some ramdrive disk made with the tool Arsenal-Image-Mounter.

Then:
mingw32-make --directory=T:\x86_64-8.1.0-release-win32-seh-rt_v6-rev0\mingw64\build 
 -f Makefile cxx > build_result.txt 2>&1

build_result.txt also attached. Line 204 in that file is the error: "cannot 
find –lc++abi".

I think somehow in the folder: 
T:\x86_64-8.1.0-release-win32-seh-rt_v6-rev0\mingw64\build\lib\abi
the Makefile is not processed.

In the non-abi folder: 
T:\x86_64-8.1.0-release-win32-seh-rt_v6-rev0\mingw64\build\lib\CMakeFiles I 
can find a full folder cxx_objects.dir. So libc++ is compiled.

I’d love if some expert on the building process could help me out here. I 
hope I’ve communicated all the relevant details for this issue.

Best regards,
Maarten Verhage 
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: build_result.txt
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20181128/62809783/attachment.txt>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: cmake_result.txt
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20181128/62809783/attachment-0001.txt>


More information about the cfe-dev mailing list