[cfe-dev] Trying again - building 64bit code on Windows
Edward Diener via cfe-dev
cfe-dev at lists.llvm.org
Tue Aug 25 05:02:13 PDT 2015
On 8/25/2015 6:30 AM, Edward Diener via cfe-dev wrote:
> On 8/25/2015 2:41 AM, Yaron Keren via cfe-dev wrote:
>> That looks likea collision between the 32 bit and 64 bit versions of
>> mingw.
>> Which version of 32 bit and 64 bit versions exactly do you, could you
>> provide download links?
>> I ask because there are several mingw distributions around and they are
>> different.
>
> The 32-bit version of mingw-64/gcc I am using is:
>
> i686-5.1.0-posix-dwarf-rt_v4-rev0
>
> The 64-bit version of mingw-64/gcc I am using is:
>
> x86_64-5.1.0-posix-seh-rt_v4-rev0
>
> I use the mingw-64 installer called 'mingw-w64-install.exe' to install
> various flavors of mingw-64.
>
> If I run dependency walker on the 32-bit version of clang I have built
> from source with the 32-bit version of mingw-64/gcc above it shows a
> dependency in the clang++.exe on:
>
> c:\utilities\mingw-w64\i686-5.1.0-posix-dwarf-rt_v4-rev0\mingw32\bin\LIBGCC_S_DW2-1.DLL
>
> c:\utilities\mingw-w64\i686-5.1.0-posix-dwarf-rt_v4-rev0\mingw32\bin\LIBSTDC++-6.DLL
>
>
> This means that the build of clang from source is linking to
> mingw-64/gcc 32-bit DLLs needed to run clang. So the build constrains
> clang to run only with the version of mingw-64/gcc with which it was built.
I want to correct this. It does not mean that the build constrains clang
to run only with the version of mingw-64/gcc with which it was built.
But it does mean that when this clang runs it must find a
LIBGCC_S_DW2-1.DLL and a LIBSTDC++-6.DLL in its PATH which it can use.
Unfortunately the 64-bit versions of mingw-64/gcc do not support dwarf
exception handling, which is where I think the dependency on
LIBGCC_S_DW2-1.DLL comes from for the 32-bit version. The only common
exception handling between the 32-bit and 64-bit versions of
mingw-64/gcc is 'sjlj'. I will try building clang with a mingw-64/gcc
32-bit release that supports 'sjlj' exception handling and then see if
it can run with a mingw-64/gcc 64-bit release that also supports 'sjlj'
exception handling in order to create 64-bit code.
>
> I did not change any of the default CMake build parameters that I know
> of. Is there a CMake build parameter which removes this constraint so
> that the version of clang is not dependent on the version of
> mingw-64/gcc with which it is built ?
>
>>
>>
>> 2015-08-25 7:43 GMT+03:00 Edward Diener via cfe-dev
>> <cfe-dev-NBbBogny7ofFcdTEL8lfRQ at public.gmane.org
>> <mailto:cfe-dev-NBbBogny7ofFcdTEL8lfRQ at public.gmane.org>>:
>>
>> On 8/24/2015 11:38 PM, Yaron Keren via cfe-dev wrote:
>>
>> 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.
>>
>>
>> clang may be built with any supported regardless the target. For
>> example, I'm building clang using Visual C++ 64 bit and
>> targetting the
>> 32-bit version of mingw. You do need to have the target mingw
>> installed
>> for the include files, library files and linker.
>>
>>
>> Please see my other response in this thread to Ivan. My experience
>> is clearly that a 32-bit version of clang does not work when a
>> 64-bit version of mingw-64/gcc is first in the Windows PATH. I also
>> explained this previously in my post "Clang on Windows targeting
>> mingw-64/gcc building 64bit code", which was unanswered.
>>
>>
>>
>>
>> 2015-08-25 5:15 GMT+03:00 Edward Diener via cfe-dev
>>
>> <cfe-dev-NBbBogny7ofFcdTEL8lfRQ-XMD5yJDbdMReXY1tMh2IBg at public.gmane.org
>>
>> <mailto:cfe-dev-NBbBogny7ofFcdTEL8lfRQ-XMD5yJDbdMReXY1tMh2IBg at public.gmane.org>
>>
>>
>> <mailto:cfe-dev-NBbBogny7ofFcdTEL8lfRQ-XMD5yJDbdMReXY1tMh2IBg at public.gmane.org
>>
>>
>> <mailto:cfe-dev-NBbBogny7ofFcdTEL8lfRQ-XMD5yJDbdMTcBkidbGgD4Q at public.gmane.orgg>>>:
>>
>>
>> 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-NBbBogny7ofFcdTEL8lfRQ at public.gmane.org
>> <mailto:cfe-dev-NBbBogny7ofFcdTEL8lfRQ at public.gmane.org>
>>
>>
>> <mailto:cfe-dev-NBbBogny7ofFcdTEL8lfRQ-XMD5yJDbdMReXY1tMh2IBg at public.gmane.org
>>
>>
>> <mailto:cfe-dev-NBbBogny7ofFcdTEL8lfRQ-XMD5yJDbdMReXY1tMh2IBg 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.
>>
>> I would like to add to the documentation on the clang
>> "Getting
>> Started: Building and Running Clang" page at
>> http://clang.llvm.org/get_started.html a section of documentation
>> following the section "Using Visual Studio" called "Using
>> mingw(-64)/gcc". This section would explain how to build
>> clang on
>> Windows using ninja, CMake, and a mingw(-64)/gcc
>> implementation and
>> how to run clang from the command line using a
>> mingw(-64)/gcc RTL. I
>> am willing to completely write this documentation, to be
>> vetted by
>> whatever clang developer takes care of that "Getting
>> Started" page,
>> in order to help other developers build and run clang on
>> Windows
>> with the mingw(-64)/gcc RTL.
More information about the cfe-dev
mailing list