[LLVMbugs] [Bug 11875] New: MSVC-built clang passes wrong arguments to gcc when used in msys

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Jan 27 18:48:16 PST 2012


http://llvm.org/bugs/show_bug.cgi?id=11875

             Bug #: 11875
           Summary: MSVC-built clang passes wrong arguments to gcc when
                    used in msys
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: derek.buitenhuis at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


Start off by compiling Clang as so:

cmake
-DSubversion_SVN_EXECUTABLE="C:/Users/.../Desktop/svn-win32-1.7.2/svn/bin/svn.exe"
-DCMAKE_BUILD_TYPE="Release" -DLLVM_APPEND_VC_REV=ON
-DCMAKE_INSTALL_PREFIX="C:/Msys/1.0/clang" -G "Visual Studio 10" ..\llvm

msbuild LLVM.sln /t:ALL_BUILD /maxcpucount:4 /p:Configuration=Release
/p:Platform=Win32
msbuild INSTALL.vcxproj /p:Configuration=Release /p:Platform=Win32

Now rename clang.exe to i686-w64-mingw32-clang.exe and clang++.exe to
i686-w64-mingw32-clang++.exe

Now let's try to compile something...

$ echo "int main(){return 0;}" > a.c
$ i686-w64-mingw32-clang.exe --sysroot=/mingw/i686-w64-mingw32/ a.c
gcc.exe: error: i686-w64-mingw32: No such file or directory
gcc.exe: error: unrecognized option '-target'
i686-w64-mingw32-clang: error: assembler (via gcc) command failed with exit
code 1 (use -v to see invocation)

Hmm...

$ i686-w64-mingw32-clang.exe --sysroot=/mingw/i686-w64-mingw32/ a.c -v
clang version 3.1 (trunk 149146)
Target: i686-w64-mingw32
Thread model: posix
 "c:/Msys/clang/bin/i686-w64-mingw32-clang.exe" -cc1 -triple i686-w64-mingw32
-S -disable-free -disable-llvm-verifier -main-file-name a.c -mrelocation-model
static -mdisable-fp-elim -mconstructor-aliases -target-cpu pentium4
-momit-leaf-frame-pointer -v -resource-dir
"c:/Msys/clang/bin\\..\\lib\\clang\\3.1" -isysroot
c:/Msys/1.0/mingw/i686-w64-mingw32/ -fmodule-cache-path
"C:/Users/DAEMON~1/AppData/Local/Temp\\clang-module-cache"
-fno-dwarf-directory-asm -fdebug-compilation-dir C:/Msys/1.0/home/Daemon404
-ferror-limit 19 -fmessage-length 0 -mstackrealign -fno-use-cxa-atexit
-fgnu-runtime -fobjc-runtime-has-arc -fobjc-runtime-has-weak -fobjc-fragile-abi
-fdiagnostics-show-option -o C:/Users/DAEMON~1/AppData/Local/Temp/a-990940.s -x
c a.c
clang -cc1 version 3.1 based upon LLVM 3.1svn-r149146 default target
i686-pc-win32
ignoring nonexistent directory
"c:/Msys/1.0/mingw/i686-w64-mingw32//usr/local/include"
ignoring nonexistent directory
"c:/Msys/clang/bin/../lib/clang/3.1/../../../i686-w64-mingw32/include"
ignoring nonexistent directory
"c:/Msys/clang/bin/../lib/clang/3.1/../../../x86_64-w64-mingw32/include"
ignoring nonexistent directory
"c:/Msys/1.0/mingw/i686-w64-mingw32//mingw/include"
ignoring nonexistent directory "c:/mingw/include"
#include "..." search starts here:
#include <...> search starts here:
 c:/Msys/clang/bin/../lib/clang/3.1/include
 c:/Msys/clang/bin/../lib/clang/3.1/../../../include
 c:/Msys/1.0/mingw/i686-w64-mingw32//usr/include
End of search list.
 "c:/Msys/1.0/mingw/bin/gcc.exe" -target i686-w64-mingw32
--sysroot=c:/Msys/1.0/mingw/i686-w64-mingw32/ -v -c -o
C:/Users/DAEMON~1/AppData/Local/Temp/a-990941.o -x assembler
C:/Users/DAEMON~1/AppData/Local/Temp/a-990940.s
gcc.exe: error: i686-w64-mingw32: No such file or directory
Using built-in specs.
COLLECT_GCC=c:/Msys/1.0/mingw/bin/gcc.exe
COLLECT_LTO_WRAPPER=c:/msys/1.0/mingw/bin/../libexec/gcc/i686-w64-mingw32/4.6.2/lto-wrapper.exe
gcc.exe: error: unrecognized option '-target'
Target: i686-w64-mingw32
Configured with: ../src/configure --prefix=/mingw_new --with-sysroot=/mingw_new
--with-build-sysroot=/mingw_new --build=i686-w64-mingw32
--target=i686-w64-mingw32 --enable-targets=all --with-gmp=/mingw_new/sup
--with-mpfr=/mingw_new/sup --with-mpc=/mingw_new/sup
--with-libelf=/mingw_new/sup --with-ppl=/mingw_new/sup
--with-cloog=/mingw_new/sup --disable-ppl-version-check
--disable-cloog-version-check --with-host-libstdcxx='-lstdc++ -lsupc++'
--disable-shared --enable-static --disable-bootstrap --disable-win32-registry
--enable-threads=win32 --enable-languages=c,c++
--enable-version-specific-runtime-libs --enable-multilib --disable-rpath
--with-system-zlib --disable-werror --disable-nls --enable-decimal-float
--disable-debug --enable-lto --enable-64bit --enable-largefile
--enable-sjlj-exceptions --enable-fully-dynamic-string --enable-libssp
--enable-libgomp
Thread model: win32
gcc version 4.6.2 (multilib.generic.Komisar) (GCC)
i686-w64-mingw32-clang: error: assembler (via gcc) command failed with exit
code 1 (use -v to see invocation)

This raises 2 questions:

1) Why is clang calling gcc.exe, and not i686-w64-mingw32-gcc.exe
2) Why is clang passing gcc a "-target i686-w64-mingw32" parameter, which
clearly is not right.

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list