[cfe-dev] Trying again - building 64bit code on Windows

Edward Diener via cfe-dev cfe-dev at lists.llvm.org
Mon Aug 24 21:37:13 PDT 2015


On 8/24/2015 11:50 PM, Ivan Garramona via cfe-dev wrote:
> 2015-08-24 23:15 GMT-03:00 Edward Diener via cfe-dev
> <cfe-dev-NBbBogny7ofCFhaKdjpD5g at public.gmane.orgorg
> <mailto:cfe-dev-NBbBogny7ofFcdTEL8lfRQ at public.gmane.org>>:
>
>     On 8/24/2015 6:27 PM, Hans Wennborg via cfe-dev wrote:
>
>         On Mon, Aug 24, 2015 at 2:36 PM, Edward Diener via cfe-dev
>         <cfe-dev at lists.llvm.org
>         <mailto:cfe-dev-NBbBogny7ofFcdTEL8lfRQ at public.gmane.org>> wrote:
>
>             Is clang built form the latest svn source capable of
>             creating 64-bit code on
>             a Microsoft Windows 64-bit OS ?
>
>
>         Yes. We build 64-bit Chromium on Windows with Clang continuously.
>
>             If yes, is this done through the -m64 option
>             or do I have to build clang from source in some particular
>             way to enable the
>             functionality ?
>
>
>         Yes, using clang-cl -m64 is how we do it.
>
>
>     Evidently to build a version of clang on Windows targeting
>     mingw-64/gcc, which can compile 64-bit code, one must build clang
>     with a 64-bit version of mingw-64/gcc. This may be apparent to you
>     and other clang developers but it was not apparent to me.
>
>
> If i understand you correctly (english is not my native language), you
> are saying that Clang must be a 64bit app, to be able to produce 64bit apps?
>
> Where did you get that? I have a 32bit Clang here (built with 32bit
> mingw) which is perfectly capable of producing 64bit apps. I just tried
> it, targeting both Mingw and MSVC.
>
> Heres the command line i used:
> $ clang++ test2.cpp -static -m64 --sysroot=/c/Dev/Mingw64/
>
> You have to put the mingw64bit/bin folder in the PATH. I did this before
> i ran the command:
> $ export PATH="/c/Dev/Mingw64/bin/:PATH"
>
> After i did this, both Mingws were on the PATH, but the 64bit comes
> first, otherwise Clang would run the 32bit linker.

That is not my experience.

I build a 32-bit version of clang using mingw-64/gcc-5.1 32-bit. Before 
executing clang I add both the clang 32-bit 'bin' directory and a 
mingw-64/gcc-5.1 64-bit 'bin' directory to the front of my Windows PATh. 
I then open a command window and execute:

clang++ --version

The response is a Windows message saying:

"The program can't start because libgcc_s_dw2-1.dll is missing from your 
computer."

If I try:

clang++ --version -m64

I get the exact same Windows message.

So clearly my experience shows me that if I build a version of clang 
using a 32-bit version of mingw-64 I can not then execute clang++ if it 
picks up a 64-bit version of mingw-64 first in the PATH.

In the same situation with a 64-bit version of clang built using 
mingw-64/gcc-5.1 64-bit there is no problem when I execute

clang++ --version

I get back:

clang version 3.8.0 (trunk 245568)
Target: x86_64-w64-windows-gnu
Thread model: posix
InstalledDir: C:\Programming\VersionControl\bninja_installed_clang_64\bin



More information about the cfe-dev mailing list