clang can locate /usr/x86_64-w64-mingw32/sys-root if provided to the -sysroot option or deduce sysroot automatically if it finds /usr/x86_64-w64-mingw32/sys-root/bin/gcc binary on the path.
clang does not deduce the sysroot from the -isystem directory by itself. 2015-07-10 19:57 GMT+03:00 İsmail Dönmez <ism...@donmez.ws>: > Anyhow this is not a nice example since it uses Cygwin's ld. A better > example from Linux side: > > λ clang -v -target x86_64-w64-mingw32 -isystem > /usr/x86_64-w64-mingw32/sys-root/x86_64-w64-mingw32/include > randomworks/windows/nic.c > clang version 3.7.0 (trunk 241471) > Target: x86_64-w64-windows-gnu > Thread model: posix > "/opt/clang/bin/clang-3.7" -cc1 -triple x86_64-w64-windows-gnu > -emit-obj -mrelax-all -disable-free -main-file-name nic.c > -mrelocation-model pic -pic-level 2 -mthread-model posix -fmath-errno > -masm-verbose -mconstructor-aliases -munwind-tables -target-cpu x86-64 > -momit-leaf-frame-pointer -v -dwarf-column-info -resource-dir > /opt/clang/bin/../lib64/clang/3.7.0 -isystem > /usr/x86_64-w64-mingw32/sys-root/x86_64-w64-mingw32/include > -internal-isystem /opt/clang/bin/../lib64/clang/3.7.0/include > -internal-isystem include -internal-isystem include-fixed > -internal-isystem /usr/mingw32/include -internal-isystem /usr/include > -fdebug-compilation-dir /home/ismail -ferror-limit 19 -fmessage-length > 126 -mstackrealign -fno-use-cxa-atexit -fobjc-runtime=gcc > -fdiagnostics-show-option -fcolor-diagnostics -o /tmp/nic-08e945.o -x > c randomworks/windows/nic.c > clang -cc1 version 3.7.0 based upon LLVM 3.7.0svn default target > x86_64-suse-linux > ignoring nonexistent directory "include" > ignoring nonexistent directory "include-fixed" > ignoring nonexistent directory "/usr/mingw32/include" > #include "..." search starts here: > #include <...> search starts here: > /usr/x86_64-w64-mingw32/sys-root/x86_64-w64-mingw32/include > /opt/clang/bin/../lib64/clang/3.7.0/include > /usr/include > End of search list. > "/usr/bin/x86_64-w64-mingw32-ld" -m i386pep -Bdynamic -o a.exe crt2.o > crtbegin.o -L -L/usr/lib -L/usr/mingw32/lib /tmp/nic-08e945.o > -lmingw32 -lgcc_s -lgcc -lmoldname -lmingwex -lmsvcrt -ladvapi32 > -lshell32 -luser32 -lkernel32 -lmingw32 -lgcc_s -lgcc -lmoldname > -lmingwex -lmsvcrt crtend.o > /usr/bin/x86_64-w64-mingw32-ld: cannot find crt2.o: No such file or > directory > /usr/bin/x86_64-w64-mingw32-ld: cannot find crtbegin.o: No such file > or directory > /usr/bin/x86_64-w64-mingw32-ld: cannot find -lmingw32 > /usr/bin/x86_64-w64-mingw32-ld: cannot find -lgcc_s > /usr/bin/x86_64-w64-mingw32-ld: cannot find -lgcc > /usr/bin/x86_64-w64-mingw32-ld: cannot find -lmoldname > /usr/bin/x86_64-w64-mingw32-ld: cannot find -lmingwex > /usr/bin/x86_64-w64-mingw32-ld: cannot find -lmsvcrt > /usr/bin/x86_64-w64-mingw32-ld: cannot find -ladvapi32 > /usr/bin/x86_64-w64-mingw32-ld: cannot find -lshell32 > /usr/bin/x86_64-w64-mingw32-ld: cannot find -luser32 > /usr/bin/x86_64-w64-mingw32-ld: cannot find -lkernel32 > /usr/bin/x86_64-w64-mingw32-ld: cannot find -lmingw32 > /usr/bin/x86_64-w64-mingw32-ld: cannot find -lgcc_s > /usr/bin/x86_64-w64-mingw32-ld: cannot find -lgcc > /usr/bin/x86_64-w64-mingw32-ld: cannot find -lmoldname > /usr/bin/x86_64-w64-mingw32-ld: cannot find -lmingwex > /usr/bin/x86_64-w64-mingw32-ld: cannot find -lmsvcrt > /usr/bin/x86_64-w64-mingw32-ld: cannot find crtend.o: No such file or > directory > clang-3.7: error: linker command failed with exit code 1 (use -v to > see invocation) > > > On Fri, Jul 10, 2015 at 7:54 PM, İsmail Dönmez <ism...@donmez.ws> wrote: > > This is without any patches (r241901-win64) and the original command > > line is there: > > > > clang -v -target x86_64-w64-mingw32 -isystem > > C:/mingw-w64-6.0.0/x86_64-w64-mingw32/include -isystem > > C:/mingw-w64-6.0.0/include/c++/6.0.0 -isystem > > C:/mingw-w64-6.0.0/include/c++/6.0.0/x86_64-w64-mingw32 > > randomworks/windows/nic.c > > > > > > On Fri, Jul 10, 2015 at 7:51 PM, Yaron Keren <yaron.ke...@gmail.com> > wrote: > >> This is with or without any patches? what is the original command line? > >> > >> > >> 2015-07-10 19:30 GMT+03:00 İsmail Dönmez <ism...@donmez.ws>: > >>> > >>> Hi, > >>> > >>> I meant to try these but both on cygwin and linux hosts we have > >>> linking regression that goes like: > >>> > >>> λ clang -v -target x86_64-w64-mingw32 -isystem > >>> C:/mingw-w64-6.0.0/x86_64-w64-mingw32/include -isystem > >>> C:/mingw-w64-6.0.0/include/c++/6.0.0 -isystem > >>> C:/mingw-w64-6.0.0/include/c++/6.0.0/x86_64-w64-mingw32 > >>> randomworks/windows/nic.c > >>> clang version 3.7.0 (https://github.com/llvm-mirror/clang.git > >>> ca355c9f413a6ca4941e3033e89e5242e29bd802) > >>> Target: x86_64-w64-windows-gnu > >>> Thread model: posix > >>> "C:\\Program Files\\LLVM\\bin\\clang.exe" -cc1 -triple > >>> x86_64-w64-windows-gnu -emit-obj -mrelax-all -disable-free > >>> -main-file-name nic.c -mrelocation-model pic -pic-level 2 > >>> -mthread-model posix -fmath-errno -masm-verbose -mconstructor-aliases > >>> -munwind-tables -target-cpu x86-64 -momit-leaf-frame-pointer -v > >>> -dwarf-column-info -resource-dir "C:\\Program > >>> Files\\LLVM\\bin\\..\\lib\\clang\\3.7.0" -isystem > >>> C:/mingw-w64-6.0.0/x86_64-w64-mingw32/include -isystem > >>> C:/mingw-w64-6.0.0/include/c++/6.0.0 -isystem > >>> C:/mingw-w64-6.0.0/include/c++/6.0.0/x86_64-w64-mingw32 > >>> -internal-isystem "C:\\Program > >>> Files\\LLVM\\bin\\..\\lib\\clang\\3.7.0\\include" -internal-isystem > >>> include -internal-isystem include-fixed -internal-isystem > >>> "C:\\cygwin64\\mingw32\\include" -internal-isystem > >>> "C:\\cygwin64\\include" -std=c11 -fdebug-compilation-dir > >>> "C:\\cygwin64\\home\\ismail" -ferror-limit 19 -fmessage-length 0 > >>> -mstackrealign -fno-use-cxa-atexit -fobjc-runtime=gcc > >>> -fdiagnostics-show-option -fcolor-diagnostics -fansi-escape-codes -o > >>> "C:\\cygwin64\\tmp\\nic-6bff3b.o" -x c randomworks/windows/nic.c > >>> clang -cc1 version 3.7.0 based upon LLVM 3.7.0svn default target > >>> x86_64-pc-windows-msvc > >>> ignoring nonexistent directory "include" > >>> ignoring nonexistent directory "include-fixed" > >>> ignoring nonexistent directory "C:\cygwin64\mingw32\include" > >>> ignoring nonexistent directory "C:\cygwin64\include" > >>> #include "..." search starts here: > >>> #include <...> search starts here: > >>> C:/mingw-w64-6.0.0/x86_64-w64-mingw32/include > >>> C:/mingw-w64-6.0.0/include/c++/6.0.0 > >>> C:/mingw-w64-6.0.0/include/c++/6.0.0/x86_64-w64-mingw32 > >>> C:\Program Files\LLVM\bin\..\lib\clang\3.7.0\include > >>> End of search list. > >>> "C:\\cygwin64\\bin\\ld.exe" -m i386pep -Bdynamic -o a.exe crt2.o > >>> crtbegin.o -L "-LC:\\cygwin64\\lib" "-LC:\\cygwin64\\mingw32\\lib" > >>> "C:\\cygwin64\\tmp\\nic-6bff3b.o" -lmingw32 -lgcc_s -lgcc -lmoldname > >>> -lmingwex -lmsvcrt -ladvapi32 -lshell32 -luser32 -lkernel32 -lmingw32 > >>> -lgcc_s -lgcc -lmoldname -lmingwex -lmsvcrt crtend.o > >>> /usr/bin/ld: cannot find crt2.o: No such file or directory > >>> /usr/bin/ld: cannot find crtbegin.o: No such file or directory > >>> /usr/bin/ld: cannot find -lmingw32 > >>> /usr/bin/ld: cannot find -lgcc_s > >>> /usr/bin/ld: cannot find -lgcc > >>> /usr/bin/ld: cannot find -lmoldname > >>> /usr/bin/ld: cannot find -lmingwex > >>> /usr/bin/ld: cannot find -lmsvcrt > >>> /usr/bin/ld: cannot find -lmingw32 > >>> /usr/bin/ld: cannot find -lgcc_s > >>> /usr/bin/ld: cannot find -lgcc > >>> /usr/bin/ld: cannot find -lmoldname > >>> /usr/bin/ld: cannot find -lmingwex > >>> /usr/bin/ld: cannot find -lmsvcrt > >>> /usr/bin/ld: cannot find crtend.o: No such file or directory > >>> clang.exe: error: linker command failed with exit code 1 (use -v to > >>> see invocation) > >>> > >>> Any ideas? Also reproducible with gcc 5.1.1 on Linux. > >>> > >>> > >>> On Tue, Jul 7, 2015 at 6:19 PM, Yaron Keren <yaron.ke...@gmail.com> > wrote: > >>> > Here is a patch honoring sysroot for ld, let me know if it works for > >>> > you. > >>> > > >>> > 2015-07-07 12:13 GMT+03:00 Yaron Keren <yaron.ke...@gmail.com>: > >>> >> > >>> >> Hi, Please see if the attached patch works on opensuse. > >>> >> > >>> >> I'll look at the cygnus ld issue later. > >>> >> > >>> >> > >>> >> 2015-07-07 10:38 GMT+03:00 İsmail Dönmez <ism...@donmez.ws>: > >>> >>> > >>> >>> Hi, > >>> >>> > >>> >>> On Mon, Jul 6, 2015 at 10:40 AM, Yaron Keren < > yaron.ke...@gmail.com> > >>> >>> wrote: > >>> >>> > Author: yrnkrn > >>> >>> > Date: Mon Jul 6 02:40:10 2015 > >>> >>> > New Revision: 241432 > >>> >>> > > >>> >>> > URL: http://llvm.org/viewvc/llvm-project?rev=241432&view=rev > >>> >>> > Log: > >>> >>> > Teach mingw toolchain the msys2 mingw-w64 distribution C++ dirs. > >>> >>> > > >>> >>> > > >>> >>> > Modified: > >>> >>> > cfe/trunk/lib/Driver/MinGWToolChain.cpp > >>> >>> > cfe/trunk/lib/Driver/ToolChains.h > >>> >>> > >>> >>> I tried this revision on openSUSE MinGW toolchain and its missing > one > >>> >>> include path, which is $GCC_ROOT/nclude/c++/x86_64-w64-mingw32 > which > >>> >>> contains "bits" and "ext" directories. Would you mind adding that > to > >>> >>> the list too? > >>> >>> > >>> >>> Thanks! > >>> >> > >>> >> > >>> > > >> > >> >
_______________________________________________ cfe-commits mailing list cfe-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits