Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-35480

moc @<file> feature fails if <file> contains cyrillic (UTF-8) symbols


    • Type: Bug
    • Status: Closed
    • Priority: Not Evaluated
    • Resolution: Out of scope
    • Affects Version/s: 4.8.5
    • Fix Version/s: None
    • Component/s: Build tools: moc
    • Labels:
    • Environment:

      Fedora release 19 (Schrödinger's Cat)


      Probably it affects Qt5 too.

      moc fails if file name contains cyrillic parts(my locale is ru_RU.UTF-8). Example:

      /usr/lib64/qt4/bin/moc-qt4 @/home/lyokha/Загрузки/geant4.10.00-build/source/interfaces/basic/include/moc_G4UIQt.cxx_parameters
      moc: Cannot open options file specified with @
      Usage: moc [options] <header-file>
      -o<file> write output to file rather than stdout
      -I<dir> add dir to the include path for header files
      -E preprocess only; do not generate meta object code
      -D<macro>[=<def>] define macro, with optional definition
      -U<macro> undefine macro
      -i do not generate an #include statement
      -p<path> path prefix for included file
      -f[<file>] force #include, optional file name
      -nn do not display notes
      -nw do not display warnings
      @<file> read additional options from file
      -v display version of moc

      The file exists and has russian part in its path (Загрузки). Looks like the issue arises from using unneeded QString::fromLatin1() call in src/tools/moc/main.cpp at line 212 where a QFile object is created. It seems that this conversion is not needed in this case as soon as this value is passed from console arguments.

      A simple patch could be:

      — tools/moc/main.cpp 2013-06-07 09:17:00.000000000 +0400
      +++ tools/moc/main.cpp.new 2013-12-09 19:25:22.709456297 +0400
      @@ -209,7 +209,7 @@
      optionsFile.remove(0, 1);
      if (optionsFile.isEmpty())
      error("The @ option requires an input file");

      • QFile f(QString::fromLatin1(optionsFile.constData()));
        + QFile f(optionsFile.constData());
        if (!f.open(QIODevice::ReadOnly | QIODevice::Text))
        error("Cannot open options file specified with @");

      but i did not check this solution.


        No reviews matched the request. Check your Options in the drop-down menu of this sections header.



            • Assignee:
              ogoffart Olivier Goffart (Woboq GmbH)
              lyokha Alexey Radkov
            • Votes:
              0 Vote for this issue
              3 Start watching this issue


              • Created:

                Gerrit Reviews

                There are no open Gerrit changes