v -arch x86 does not work

Created on 28 Sep 2020  路  3Comments  路  Source: vlang/v

V version: V 0.1.29 7c66953
OS: windows, Microsoft Windows 10 Pro v18363 64-bit
Processor: 8 cpus, 64bit, little endian, Intel(R) Core(TM) i7-10510U CPU @ 1.80GHz
CC version: N/A

vroot: C:\Users\dev\AppData\Roaming\Compilers\v
vexe: C:\Users\dev\AppData\Roaming\Compilers\v\v.exe
vexe mtime: 2020-09-27 10:07:30
is vroot writable: true
V full version: V 0.1.29 7c66953
Git version: git version 2.28.0.windows.1
Git vroot status: 0.1.29-446-g6981f2af
.git/config present: true
thirdparty/tcc: N/A

What did you do?

Using following code

fn main(){
    println("Hello World")
}

Tried to build x32 bit binary using -arch x86 flag
v -arch x86 .\testv.v

What did you expect to see?
expected to get x32 bit binary on windows OS

What did you see instead?
v -arch x86 still builds x64 binary on windows

file analysis can be seen here
https://www.virustotal.com/gui/file/82127acf2cd585447bf7b01bc8caaf876ce05728dfcb90305f4e989c7207cf57/details

Bug Confirmed

Most helpful comment

jalon@Ripper:~$ v help build-c
Usage: v [build flags] ['build'] <file.v|directory>

This command compiles the given target, along with their dependencies, into an executable.

This help topic explores C-backend specific build flags.
For help regarding building an executable, see `v help build`.

These build flags are enabled on `build` and `run` as long as the backend is set to `c`:

   -arch <architecture>
      Change the architecture that V will tell the C compiler to build.
      List of supported architectures: `x86` and `x64` (default).

All 3 comments

"Fails" the same way when cross-compiling from Linux to Windows... the -arch option seems to be ignored, as it always produces an x64 binary. I verified with wsl file <filename>

This is not a valid flag, it's not documented anywhere. Using it now results in unknown command

jalon@Ripper:~$ v help build-c
Usage: v [build flags] ['build'] <file.v|directory>

This command compiles the given target, along with their dependencies, into an executable.

This help topic explores C-backend specific build flags.
For help regarding building an executable, see `v help build`.

These build flags are enabled on `build` and `run` as long as the backend is set to `c`:

   -arch <architecture>
      Change the architecture that V will tell the C compiler to build.
      List of supported architectures: `x86` and `x64` (default).
Was this page helpful?
0 / 5 - 0 ratings

Related issues

XVilka picture XVilka  路  3Comments

vtereshkov picture vtereshkov  路  3Comments

choleraehyq picture choleraehyq  路  3Comments

PavelVozenilek picture PavelVozenilek  路  3Comments

jtkirkpatrick picture jtkirkpatrick  路  3Comments