Uploaded image for project: 'Qbs ("Cubes")'
  1. Qbs ("Cubes")
  2. QBS-1774

cpp.assemblerFlags don't work in MSVC

    XMLWordPrintable

Details

    • Windows
    • 5fcdf43b3 (2.2)

    Description

      MSCV assembler ML and ML64 command-line reference Syntax

      ML [ options ] filename [ [ options ] filename ]

      cpp.assemblerFlags are placed after the filename, so they are ignored by ML.exe. Only predefined  "/nologo" "/c" "/Fo" is valid but cpp.assemblerFlags are not .

       

       See windows-msvc-base.qbs (line 323, Rule of  inputs:"asm" )

      var args = ["/nologo", "/c",
           "/Fo" + FileInfo.toWindowsSeparators(output.filePath),
           FileInfo.toWindowsSeparators(input.filePath)];
      if (product.cpp.debugInformation)
           args.push("/Zi");
      args = args.concat(Cpp.collectMiscAssemblerArguments(input, "asm")); 

       

      My Example is:

      CppApplication { 
        targetName: "test"    
        files: "1001.asm"    
        cpp.compilerIncludePaths: "C:/Masm32/Include"    
        cpp.assemblerFlags: ["/I", "C:\\Masm32\\Include"]
      } 

      qbs build output:

      assembling 1001.asm [project]
      ERROR: "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\HostX86\x86\ml.exe" /nologo /c /FoC:\Users\98581\Desktop\QBS_Project\E1\default\project.98f54143\3a52ce780950d4d9\1001.asm.obj C:\Users\98581\Desktop\QBS_Project\E1\1001.asm /Zi /I C:\Masm32\Include
      C:\Users\98581\Desktop\QBS_Project\E1\1001.asm(6) : fatal error A1000:cannot open file : Irvine32.inc
      ERROR: Process failed with exit code 1.
      The following products could not be built for configuration default:
      project

      If  the argument ("/I C:\Masm32\Include") is ahead of the file path (***\1001.asm), it would be build successfully. 

       

      My suggestion is to put "FileInfo.toWindowsSeparators(input.filePath)]" to the last element of args.

      (file: windows-msvc-base.qbs, line: 323, Rule of asm) 

      var args = ["/nologo", "/c",  "/Fo" + FileInfo.toWindowsSeparators(output.filePath)];
      args = args.concat(Cpp.collectMiscAssemblerArguments(input, "asm"));
      if (product.cpp.debugInformation)
            args.push("/Zi");
      args.push(FileInfo.toWindowsSeparators(input.filePath));
      var cmd = new Command(product.cpp.assemblerPath, args); 

       

       

      Reference: https://learn.microsoft.com/en-us/cpp/assembler/masm/ml-and-ml64-command-line-reference?view=msvc-170

      Attachments

        For Gerrit Dashboard: QBS-1774
        # Subject Branch Project Status CR V

        Activity

          People

            arch Ivan Komissarov
            moriv4 zhicheng jiang
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes