Building a 64-bit program on Windows using clang (built with Visual Studio)

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Building a 64-bit program on Windows using clang (built with Visual Studio)

This post has NOT been accepted by the mailing list yet.
Hi All,

I haven't been able to find this in the mailing list and see mention of clang on mingw but not natively on

I pulled down the source for LLVM, Clang and lld on Windows and built all of it using Visual Studio 2015 (update 3) after generating everything with CMake.

I'm now trying to compile a simple C program into a 64-bit executable as follows:

D:\testclang>clang -arch=x86-64 test.c -o test.exe

However, this fails with the following error:
clang.exe: warning: argument unused during compilation: '-arch=x86-64' [-Wunused-command-line-argument]

I used llc --version to see if I could find the right triple, but I don't see an option for building a 64-bit windows program:

D:\testclang>llc --version
  LLVM version 5.0.0svn
  DEBUG build.
  Default target: i686-pc-windows-msvc
  Host CPU: nehalem

  Registered Targets:
    aarch64    - AArch64 (little endian)
    aarch64_be - AArch64 (big endian)
    amdgcn     - AMD GCN GPUs
    arm        - ARM
    arm64      - ARM64 (little endian)
    armeb      - ARM (big endian)
    bpf        - BPF (host endian)
    bpfeb      - BPF (big endian)
    bpfel      - BPF (little endian)
    hexagon    - Hexagon
    lanai      - Lanai
    mips       - Mips
    mips64     - Mips64 [experimental]
    mips64el   - Mips64el [experimental]
    mipsel     - Mipsel
    msp430     - MSP430 [experimental]
    nvptx      - NVIDIA PTX 32-bit
    nvptx64    - NVIDIA PTX 64-bit
    ppc32      - PowerPC 32
    ppc64      - PowerPC 64
    ppc64le    - PowerPC 64 LE
    r600       - AMD GPUs HD2XXX-HD6XXX
    riscv32    - 32-bit RISC-V
    riscv64    - 64-bit RISC-V
    sparc      - Sparc
    sparcel    - Sparc LE
    sparcv9    - Sparc V9
    systemz    - SystemZ
    thumb      - Thumb
    thumbeb    - Thumb (big endian)
    x86        - 32-bit X86: Pentium-Pro and above
    x86-64     - 64-bit X86: EM64T and AMD64
    xcore      - XCore

Does anyone know what I have to do in order to make clang/lld produce a 64-bit program on Windows?

Thanks in advance,