On Tue, Jan 27, 2015 at 10:02 AM, Mueller-Roemer, Johannes Sebastian <Johannes.Sebastian.Mueller-Roemer at igd.fraunhofer.de> wrote:> Adding -D__MSVCRT_VERSION__=0x900 (or higher) to CMAKE_CXX_FLAGS and > -lmsvcr90 (or higher) to CMAKE_CXX_STANDARD_LIBRARIES appears to work. > -lmsvcrt80 does not work, contrary to the comment on the MinGW bug tracker. > However, if you do not have the runtimes installed, errors will occur later > on in the build process, such as: > > [215/1199] Building Intrinsics.gen... > > FAILED: cmd.exe /c cd D:\Slave\llvm-mingw\buildMinGW\include\llvm\IR && > D:\Slave\llvm-mingw\buildMinGW\bin\llvm-tblgen.exe -gen-intrinsic -I > D:/Slave/llvm-mingw/build/include/llvm/IR -I > D:/Slave/llvm-mingw/build/lib/Target -I D:/Slave/llvm-mingw/build/include > D:/Slave/llvm-mingw/build/include/llvm/IR/Intrinsics.td -o > D:/Slave/llvm-mingw/buildMinGW/include/llvm/IR/Intrinsics.gen.tmp > > > > As I do not have administrative privileges on the machine, I switched to > MSVCRT100, as those runtimes were already installed. Which leads me to the > question: Should the exact MSVCRT version be selectable or should the lowest > version necessary (9.0) be used? >Is there any way for CMake to detect which version of MSVCRT is present? Otherwise there's really no default we can give. If not, then we'll have to disable the error UI suppression on mingw. - Michael Spencer> > > -- > > Johannes S. Mueller-Roemer, MSc > > Wiss. Mitarbeiter - Interactive Engineering Technologies (IET) > > > > Fraunhofer-Institut für Graphische Datenverarbeitung IGD > > Fraunhoferstr. 5 | 64283 Darmstadt | Germany > > Tel +49 6151 155-606 | Fax +49 6151 155-139 > > johannes.mueller-roemer at igd.fraunhofer.de | www.igd.fraunhofer.de > > > > From: llvmdev-bounces at cs.uiuc.edu [mailto:llvmdev-bounces at cs.uiuc.edu] On > Behalf Of Mueller-Roemer, Johannes Sebastian > Sent: Tuesday, January 27, 2015 09:56 > To: llvmdev at cs.uiuc.edu > Subject: [LLVMdev] build failure on mingw gcc 4.9.1 > > > > I encountered a new build failure (r227128) on my nightly build of LLVM for > MinGW: > > > > FAILED: cmd.exe /c cd . && > D:\MinGW\x86_64-4.9.1-release-posix-seh-rt_v3-rev0\mingw64\bin\c++.exe > -Wall -W -Wno-unused-parameter -Wwrite-strings -Wcast-qual > -Wno-missing-field-initializers -pedantic -Wno-long-long > -Wno-maybe-uninitialized -Wno-comment -std=gnu++11 -g > utils/not/CMakeFiles/not.dir/not.cpp.obj -o bin/not.exe > -Wl,--major-image-version,0,--minor-image-version,0 lib/libLLVMSupportD.a > -limagehlp -lpsapi -lshell32 -lkernel32 -luser32 -lgdi32 -lwinspool > -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 && cd . > > lib/libLLVMSupportD.a(Signals.cpp.obj): In function > `llvm::sys::PrintStackTraceOnErrorSignal()': > > > > D:/Slave/llvm-mingw/build/lib/Support/Windows/Signals.inc:284: undefined > reference to `__imp__set_abort_behavior' > > > > D:/Slave/llvm-mingw/build/lib/Support/Windows/Signals.inc:286: undefined > reference to `__imp__set_abort_behavior' > > > > collect2.exe: error: ld returned 1 exit status > > > > So, _set_abort_behavior is not found. This should be solvable by specifying > a newer MSVCRT version (see > http://sourceforge.net/p/mingw/support-requests/153/ ). I’ll try it, and if > it works, could we add that to the CMakeLists? > > > > -- > > Johannes S. Mueller-Roemer, MSc > > Wiss. Mitarbeiter - Interactive Engineering Technologies (IET) > > > > Fraunhofer-Institut für Graphische Datenverarbeitung IGD > > Fraunhoferstr. 5 | 64283 Darmstadt | Germany > > Tel +49 6151 155-606 | Fax +49 6151 155-139 > > johannes.mueller-roemer at igd.fraunhofer.de | www.igd.fraunhofer.de > > > > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >
Mueller-Roemer, Johannes Sebastian
2015-Jan-27 10:54 UTC
[LLVMdev] build failure on mingw gcc 4.9.1
We could probably do a glob on C:/Windows/System32 to find all msvcr*.dll or something like that. But this seems excessively complicated. It might be better to just provide a variable MINGW_MSVCRT_VERSION which is set to 90 by default and can be set to 100 or 110 (or as soon as mingw supports it 120) as desired. None of these options require installing Visual C++, you only need to install the redistributables, so I think that requirement isn't too bad. -- Johannes S. Mueller-Roemer, MSc Wiss. Mitarbeiter - Interactive Engineering Technologies (IET) Fraunhofer-Institut für Graphische Datenverarbeitung IGD Fraunhoferstr. 5 | 64283 Darmstadt | Germany Tel +49 6151 155-606 | Fax +49 6151 155-139 johannes.mueller-roemer at igd.fraunhofer.de | www.igd.fraunhofer.de -----Original Message----- From: Michael Spencer [mailto:bigcheesegs at gmail.com] Sent: Tuesday, January 27, 2015 11:46 To: Mueller-Roemer, Johannes Sebastian Cc: llvmdev at cs.uiuc.edu Subject: Re: [LLVMdev] build failure on mingw gcc 4.9.1 On Tue, Jan 27, 2015 at 10:02 AM, Mueller-Roemer, Johannes Sebastian <Johannes.Sebastian.Mueller-Roemer at igd.fraunhofer.de> wrote:> Adding -D__MSVCRT_VERSION__=0x900 (or higher) to CMAKE_CXX_FLAGS and > -lmsvcr90 (or higher) to CMAKE_CXX_STANDARD_LIBRARIES appears to work. > -lmsvcrt80 does not work, contrary to the comment on the MinGW bug tracker. > However, if you do not have the runtimes installed, errors will occur > later on in the build process, such as: > > [215/1199] Building Intrinsics.gen... > > FAILED: cmd.exe /c cd D:\Slave\llvm-mingw\buildMinGW\include\llvm\IR > && D:\Slave\llvm-mingw\buildMinGW\bin\llvm-tblgen.exe -gen-intrinsic > -I D:/Slave/llvm-mingw/build/include/llvm/IR -I > D:/Slave/llvm-mingw/build/lib/Target -I > D:/Slave/llvm-mingw/build/include > D:/Slave/llvm-mingw/build/include/llvm/IR/Intrinsics.td -o > D:/Slave/llvm-mingw/buildMinGW/include/llvm/IR/Intrinsics.gen.tmp > > > > As I do not have administrative privileges on the machine, I switched > to MSVCRT100, as those runtimes were already installed. Which leads me > to the > question: Should the exact MSVCRT version be selectable or should the > lowest version necessary (9.0) be used? >Is there any way for CMake to detect which version of MSVCRT is present? Otherwise there's really no default we can give. If not, then we'll have to disable the error UI suppression on mingw. - Michael Spencer> > > -- > > Johannes S. Mueller-Roemer, MSc > > Wiss. Mitarbeiter - Interactive Engineering Technologies (IET) > > > > Fraunhofer-Institut für Graphische Datenverarbeitung IGD > > Fraunhoferstr. 5 | 64283 Darmstadt | Germany > > Tel +49 6151 155-606 | Fax +49 6151 155-139 > > johannes.mueller-roemer at igd.fraunhofer.de | www.igd.fraunhofer.de > > > > From: llvmdev-bounces at cs.uiuc.edu [mailto:llvmdev-bounces at cs.uiuc.edu] > On Behalf Of Mueller-Roemer, Johannes Sebastian > Sent: Tuesday, January 27, 2015 09:56 > To: llvmdev at cs.uiuc.edu > Subject: [LLVMdev] build failure on mingw gcc 4.9.1 > > > > I encountered a new build failure (r227128) on my nightly build of > LLVM for > MinGW: > > > > FAILED: cmd.exe /c cd . && > D:\MinGW\x86_64-4.9.1-release-posix-seh-rt_v3-rev0\mingw64\bin\c++.exe > -Wall -W -Wno-unused-parameter -Wwrite-strings -Wcast-qual > -Wno-missing-field-initializers -pedantic -Wno-long-long > -Wno-maybe-uninitialized -Wno-comment -std=gnu++11 -g > utils/not/CMakeFiles/not.dir/not.cpp.obj -o bin/not.exe > -Wl,--major-image-version,0,--minor-image-version,0 > lib/libLLVMSupportD.a -limagehlp -lpsapi -lshell32 -lkernel32 -luser32 > -lgdi32 -lwinspool > -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 && cd . > > lib/libLLVMSupportD.a(Signals.cpp.obj): In function > `llvm::sys::PrintStackTraceOnErrorSignal()': > > > > D:/Slave/llvm-mingw/build/lib/Support/Windows/Signals.inc:284: > undefined reference to `__imp__set_abort_behavior' > > > > D:/Slave/llvm-mingw/build/lib/Support/Windows/Signals.inc:286: > undefined reference to `__imp__set_abort_behavior' > > > > collect2.exe: error: ld returned 1 exit status > > > > So, _set_abort_behavior is not found. This should be solvable by > specifying a newer MSVCRT version (see > http://sourceforge.net/p/mingw/support-requests/153/ ). I’ll try it, > and if it works, could we add that to the CMakeLists? > > > > -- > > Johannes S. Mueller-Roemer, MSc > > Wiss. Mitarbeiter - Interactive Engineering Technologies (IET) > > > > Fraunhofer-Institut für Graphische Datenverarbeitung IGD > > Fraunhoferstr. 5 | 64283 Darmstadt | Germany > > Tel +49 6151 155-606 | Fax +49 6151 155-139 > > johannes.mueller-roemer at igd.fraunhofer.de | www.igd.fraunhofer.de > > > > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >
On Tue, Jan 27, 2015 at 2:45 AM, Michael Spencer <bigcheesegs at gmail.com> wrote:> On Tue, Jan 27, 2015 at 10:02 AM, Mueller-Roemer, Johannes Sebastian > <Johannes.Sebastian.Mueller-Roemer at igd.fraunhofer.de> wrote: > > Adding -D__MSVCRT_VERSION__=0x900 (or higher) to CMAKE_CXX_FLAGS and > > -lmsvcr90 (or higher) to CMAKE_CXX_STANDARD_LIBRARIES appears to work. > > -lmsvcrt80 does not work, contrary to the comment on the MinGW bug > tracker. > > However, if you do not have the runtimes installed, errors will occur > later > > on in the build process, such as: > > > > [215/1199] Building Intrinsics.gen... > > > > FAILED: cmd.exe /c cd D:\Slave\llvm-mingw\buildMinGW\include\llvm\IR && > > D:\Slave\llvm-mingw\buildMinGW\bin\llvm-tblgen.exe -gen-intrinsic -I > > D:/Slave/llvm-mingw/build/include/llvm/IR -I > > D:/Slave/llvm-mingw/build/lib/Target -I D:/Slave/llvm-mingw/build/include > > D:/Slave/llvm-mingw/build/include/llvm/IR/Intrinsics.td -o > > D:/Slave/llvm-mingw/buildMinGW/include/llvm/IR/Intrinsics.gen.tmp > > > > > > > > As I do not have administrative privileges on the machine, I switched to > > MSVCRT100, as those runtimes were already installed. Which leads me to > the > > question: Should the exact MSVCRT version be selectable or should the > lowest > > version necessary (9.0) be used? > > > > Is there any way for CMake to detect which version of MSVCRT is > present? Otherwise there's really no default we can give. If not, then > we'll have to disable the error UI suppression on mingw. >On MinGW, we could use GetProcAddress and GetModuleHandle(dllname) for all dll names in { "msvcrt120", "msvcrt110", ... }, as horrible as that is. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150127/2de6d58d/attachment.html>
Mueller-Roemer, Johannes Sebastian
2015-Jan-28 08:12 UTC
[LLVMdev] build failure on mingw gcc 4.9.1
That really is horrible… Here’s basically the same thing but on the CMake side of things. It works but it ain’t pretty: if(MINGW OR CYGWIN) function(get_newest_msvcrt OUTVAR) file(TO_CMAKE_PATH $ENV{WINDIR} WINDIR) file(GLOB INSTALLED_MSVCRT_RUNTIMES "${WINDIR}/System32/msvcr*.dll") set(INSTALLED_MSVCRT_NAMES) foreach(MSVCRT ${INSTALLED_MSVCRT_RUNTIMES}) get_filename_component(MSVCRT ${MSVCRT} NAME_WE) list(APPEND INSTALLED_MSVCRT_NAMES ${MSVCRT}) endforeach() foreach(VERSION 110 100 90) # try newest first list(FIND INSTALLED_MSVCRT_NAMES "msvcr${VERSION}" INDEX) if(INDEX GREATER -1) set(${OUTVAR} ${VERSION} PARENT_SCOPE) return() endif() endforeach() message(FATAL_ERROR "No compatible MSVCRT runtime installed") endfunction() get_newest_msvcrt(NEWEST_MSVCRT) foreach(LANG C CXX) set(CMAKE_${LANG}_FLAGS "${CMAKE_${LANG}_FLAGS} -D__MSVCRT_VERSION__=0x${NEWEST_MSVCRT}0") set(CMAKE_${LANG}_STANDARD_LIBRARIES "${CMAKE_${LANG}_STANDARD_LIBRARIES} -lmsvcr${NEWEST_MSVCRT}") endforeach() endif() The MSVCRT version to use could also be an editable cache variable. I could create a phabricator patch if you are ok with this solution. -- Johannes S. Mueller-Roemer, MSc Wiss. Mitarbeiter - Interactive Engineering Technologies (IET) Fraunhofer-Institut für Graphische Datenverarbeitung IGD Fraunhoferstr. 5 | 64283 Darmstadt | Germany Tel +49 6151 155-606 | Fax +49 6151 155-139 johannes.mueller-roemer at igd.fraunhofer.de | www.igd.fraunhofer.de From: Reid Kleckner [mailto:rnk at google.com] Sent: Tuesday, January 27, 2015 23:29 To: Michael Spencer Cc: Mueller-Roemer, Johannes Sebastian; llvmdev at cs.uiuc.edu Subject: Re: [LLVMdev] build failure on mingw gcc 4.9.1 On Tue, Jan 27, 2015 at 2:45 AM, Michael Spencer <bigcheesegs at gmail.com<mailto:bigcheesegs at gmail.com>> wrote: On Tue, Jan 27, 2015 at 10:02 AM, Mueller-Roemer, Johannes Sebastian <Johannes.Sebastian.Mueller-Roemer at igd.fraunhofer.de<mailto:Johannes.Sebastian.Mueller-Roemer at igd.fraunhofer.de>> wrote:> Adding -D__MSVCRT_VERSION__=0x900 (or higher) to CMAKE_CXX_FLAGS and > -lmsvcr90 (or higher) to CMAKE_CXX_STANDARD_LIBRARIES appears to work. > -lmsvcrt80 does not work, contrary to the comment on the MinGW bug tracker. > However, if you do not have the runtimes installed, errors will occur later > on in the build process, such as: > > [215/1199] Building Intrinsics.gen... > > FAILED: cmd.exe /c cd D:\Slave\llvm-mingw\buildMinGW\include\llvm\IR && > D:\Slave\llvm-mingw\buildMinGW\bin\llvm-tblgen.exe -gen-intrinsic -I > D:/Slave/llvm-mingw/build/include/llvm/IR -I > D:/Slave/llvm-mingw/build/lib/Target -I D:/Slave/llvm-mingw/build/include > D:/Slave/llvm-mingw/build/include/llvm/IR/Intrinsics.td -o > D:/Slave/llvm-mingw/buildMinGW/include/llvm/IR/Intrinsics.gen.tmp > > > > As I do not have administrative privileges on the machine, I switched to > MSVCRT100, as those runtimes were already installed. Which leads me to the > question: Should the exact MSVCRT version be selectable or should the lowest > version necessary (9.0) be used? >Is there any way for CMake to detect which version of MSVCRT is present? Otherwise there's really no default we can give. If not, then we'll have to disable the error UI suppression on mingw. On MinGW, we could use GetProcAddress and GetModuleHandle(dllname) for all dll names in { "msvcrt120", "msvcrt110", ... }, as horrible as that is. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150128/90544f47/attachment.html>